From 3a85b6b7c6d3c956df20764fceca9c90c0238740 Mon Sep 17 00:00:00 2001 From: Dipta Das Date: Sat, 8 Jul 2017 06:38:48 -0700 Subject: [PATCH 01/10] Add Azure Blob Storage as backend Environment variables: AZURE_ACCOUNT_NAME=storage-account-name AZURE_ACCOUNT_KEY=storage-account-key Environment variables for test: RESTIC_TEST_AZURE_ACCOUNT_NAME=storage-account-name RESTIC_TEST_AZURE_ACCOUNT_KEY=storage-account-key RESTIC_TEST_AZURE_REPOSITORY=azure:restic-test-container Init repository: $ restic -r azure:container-name:/prefix/dir init --- cmd/restic/global.go | 22 ++ internal/backend/azure/azure.go | 378 ++++++++++++++++++++++++++ internal/backend/azure/azure_test.go | 121 +++++++++ internal/backend/azure/config.go | 57 ++++ internal/backend/azure/config_test.go | 40 +++ internal/backend/location/location.go | 2 + 6 files changed, 620 insertions(+) create mode 100644 internal/backend/azure/azure.go create mode 100644 internal/backend/azure/azure_test.go create mode 100644 internal/backend/azure/config.go create mode 100644 internal/backend/azure/config_test.go diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 874a26408..ca6ca65b1 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -10,6 +10,7 @@ import ( "strings" "syscall" + "github.com/restic/restic/internal/backend/azure" "github.com/restic/restic/internal/backend/b2" "github.com/restic/restic/internal/backend/local" "github.com/restic/restic/internal/backend/location" @@ -363,6 +364,23 @@ func parseConfig(loc location.Location, opts options.Options) (interface{}, erro debug.Log("opening s3 repository at %#v", cfg) return cfg, nil + case "azure": + cfg := loc.Config.(azure.Config) + if cfg.AccountName == "" { + cfg.AccountName = os.Getenv("AZURE_ACCOUNT_NAME") + } + + if cfg.AccountKey == "" { + cfg.AccountKey = os.Getenv("AZURE_ACCOUNT_KEY") + } + + if err := opts.Apply(loc.Scheme, &cfg); err != nil { + return nil, err + } + + debug.Log("opening gs repository at %#v", cfg) + return cfg, nil + case "swift": cfg := loc.Config.(swift.Config) @@ -429,6 +447,8 @@ func open(s string, opts options.Options) (restic.Backend, error) { be, err = sftp.Open(cfg.(sftp.Config)) case "s3": be, err = s3.Open(cfg.(s3.Config)) + case "azure": + be, err = azure.Open(cfg.(azure.Config)) case "swift": be, err = swift.Open(cfg.(swift.Config)) case "b2": @@ -477,6 +497,8 @@ func create(s string, opts options.Options) (restic.Backend, error) { return sftp.Create(cfg.(sftp.Config)) case "s3": return s3.Create(cfg.(s3.Config)) + case "azure": + return azure.Open(cfg.(azure.Config)) case "swift": return swift.Open(cfg.(swift.Config)) case "b2": diff --git a/internal/backend/azure/azure.go b/internal/backend/azure/azure.go new file mode 100644 index 000000000..d78c6625e --- /dev/null +++ b/internal/backend/azure/azure.go @@ -0,0 +1,378 @@ +package azure + +import ( + "context" + "io" + "os" + "path" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/storage" + "github.com/pkg/errors" + "github.com/restic/restic/internal/backend" + "github.com/restic/restic/internal/debug" + "github.com/restic/restic/internal/restic" +) + +// Backend stores data on an azure endpoint. +type Backend struct { + accountName string + container *storage.Container + sem *backend.Semaphore + prefix string + backend.Layout +} + +// make sure that *Backend implements backend.Backend +var _ restic.Backend = &Backend{} + +func open(cfg Config) (*Backend, error) { + debug.Log("open, config %#v", cfg) + + client, err := storage.NewBasicClient(cfg.AccountName, cfg.AccountKey) + if err != nil { + return nil, errors.Wrap(err, "NewBasicClient") + } + + service := client.GetBlobService() + + sem, err := backend.NewSemaphore(cfg.Connections) + if err != nil { + return nil, err + } + + be := &Backend{ + container: service.GetContainerReference(cfg.Container), + accountName: cfg.AccountName, + sem: sem, + prefix: cfg.Prefix, + Layout: &backend.DefaultLayout{ + Path: cfg.Prefix, + Join: path.Join, + }, + } + + return be, nil +} + +// Open opens the Azure backend at specified container. +func Open(cfg Config) (restic.Backend, error) { + return open(cfg) +} + +// Create opens the Azure backend at specified container and creates the container if +// it does not exist yet. +func Create(cfg Config) (restic.Backend, error) { + be, err := open(cfg) + + if err != nil { + return nil, errors.Wrap(err, "open") + } + + options := storage.CreateContainerOptions{ + Access: storage.ContainerAccessTypePrivate, + } + + _, err = be.container.CreateIfNotExists(&options) + if err != nil { + return nil, errors.Wrap(err, "container.CreateIfNotExists") + } + + return be, nil +} + +// IsNotExist returns true if the error is caused by a not existing file. +func (be *Backend) IsNotExist(err error) bool { + debug.Log("IsNotExist(%T, %#v)", err, err) + return os.IsNotExist(err) +} + +// Join combines path components with slashes. +func (be *Backend) Join(p ...string) string { + return path.Join(p...) +} + +type fileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time + isDir bool +} + +func (fi fileInfo) Name() string { return fi.name } // base name of the file +func (fi fileInfo) Size() int64 { return fi.size } // length in bytes for regular files; system-dependent for others +func (fi fileInfo) Mode() os.FileMode { return fi.mode } // file mode bits +func (fi fileInfo) ModTime() time.Time { return fi.modTime } // modification time +func (fi fileInfo) IsDir() bool { return fi.isDir } // abbreviation for Mode().IsDir() +func (fi fileInfo) Sys() interface{} { return nil } // underlying data source (can return nil) + +// ReadDir returns the entries for a directory. +func (be *Backend) ReadDir(dir string) (list []os.FileInfo, err error) { + debug.Log("ReadDir(%v)", dir) + + // make sure dir ends with a slash + if dir[len(dir)-1] != '/' { + dir += "/" + } + + obj, err := be.container.ListBlobs(storage.ListBlobsParameters{Prefix: dir, Delimiter: "/"}) + if err != nil { + return nil, err + } + + for _, item := range obj.BlobPrefixes { + entry := fileInfo{ + name: strings.TrimPrefix(item, dir), + isDir: true, + mode: os.ModeDir | 0755, + } + if entry.name != "" { + list = append(list, entry) + } + } + + for _, item := range obj.Blobs { + entry := fileInfo{ + name: strings.TrimPrefix(item.Name, dir), + isDir: false, + mode: 0644, + size: item.Properties.ContentLength, + modTime: time.Time(item.Properties.LastModified), + } + if entry.name != "" { + list = append(list, entry) + } + } + + return list, nil +} + +// Location returns this backend's location (the container name). +func (be *Backend) Location() string { + return be.Join(be.container.Name, be.prefix) +} + +// Path returns the path in the bucket that is used for this backend. +func (be *Backend) Path() string { + return be.prefix +} + +// preventCloser wraps an io.Reader to run a function instead of the original Close() function. +type preventCloser struct { + io.Reader + f func() +} + +func (wr preventCloser) Close() error { + wr.f() + return nil +} + +// Save stores data in the backend at the handle. +func (be *Backend) Save(ctx context.Context, h restic.Handle, rd io.Reader) (err error) { + if err := h.Valid(); err != nil { + return err + } + + objName := be.Filename(h) + + debug.Log("Save %v at %v", h, objName) + + // Check key does not already exist + found, err := be.container.GetBlobReference(objName).Exists() + if err != nil { + return errors.Wrap(err, "GetBlobReference().Exists()") + } + if found { + debug.Log("%v already exists", h) + return errors.New("key already exists") + } + + be.sem.GetToken() + + // wrap the reader so that net/http client cannot close the reader, return + // the token instead. + rd = preventCloser{ + Reader: rd, + f: func() { + debug.Log("Close()") + }, + } + + debug.Log("InsertObject(%v, %v)", be.container.Name, objName) + + err = be.container.GetBlobReference(objName).CreateBlockBlobFromReader(rd, nil) + + be.sem.ReleaseToken() + debug.Log("%v, err %#v", objName, err) + + return errors.Wrap(err, "CreateBlockBlobFromReader") +} + +// wrapReader wraps an io.ReadCloser to run an additional function on Close. +type wrapReader struct { + io.ReadCloser + f func() +} + +func (wr wrapReader) Close() error { + err := wr.ReadCloser.Close() + wr.f() + return err +} + +// Load returns a reader that yields the contents of the file at h at the +// given offset. If length is nonzero, only a portion of the file is +// returned. rd must be closed after use. +func (be *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error) { + debug.Log("Load %v, length %v, offset %v from %v", h, length, offset, be.Filename(h)) + if err := h.Valid(); err != nil { + return nil, err + } + + if offset < 0 { + return nil, errors.New("offset is negative") + } + + if length < 0 { + return nil, errors.Errorf("invalid length %d", length) + } + + objName := be.Filename(h) + blob := be.container.GetBlobReference(objName) + + start := uint64(offset) + var end uint64 + + if length > 0 { + end = uint64(offset + int64(length) - 1) + } else { + end = 0 + } + + be.sem.GetToken() + + rd, err := blob.GetRange(&storage.GetBlobRangeOptions{Range: &storage.BlobRange{Start: start, End: end}}) + if err != nil { + be.sem.ReleaseToken() + return nil, err + } + + closeRd := wrapReader{ + ReadCloser: rd, + f: func() { + debug.Log("Close()") + be.sem.ReleaseToken() + }, + } + + return closeRd, err +} + +// Stat returns information about a blob. +func (be *Backend) Stat(ctx context.Context, h restic.Handle) (bi restic.FileInfo, err error) { + debug.Log("%v", h) + + objName := be.Filename(h) + blob := be.container.GetBlobReference(objName) + + if err := blob.GetProperties(nil); err != nil { + debug.Log("blob.GetProperties err %v", err) + return restic.FileInfo{}, errors.Wrap(err, "blob.GetProperties") + } + + return restic.FileInfo{Size: int64(blob.Properties.ContentLength)}, nil +} + +// Test returns true if a blob of the given type and name exists in the backend. +func (be *Backend) Test(ctx context.Context, h restic.Handle) (bool, error) { + objName := be.Filename(h) + found, err := be.container.GetBlobReference(objName).Exists() + if err != nil { + return false, err + } + return found, nil +} + +// Remove removes the blob with the given name and type. +func (be *Backend) Remove(ctx context.Context, h restic.Handle) error { + objName := be.Filename(h) + _, err := be.container.GetBlobReference(objName).DeleteIfExists(nil) + debug.Log("Remove(%v) at %v -> err %v", h, objName, err) + return errors.Wrap(err, "client.RemoveObject") +} + +// List returns a channel that yields all names of blobs of type t. A +// goroutine is started for this. If the channel done is closed, sending +// stops. +func (be *Backend) List(ctx context.Context, t restic.FileType) <-chan string { + debug.Log("listing %v", t) + ch := make(chan string) + + prefix := be.Dirname(restic.Handle{Type: t}) + + // make sure prefix ends with a slash + if prefix[len(prefix)-1] != '/' { + prefix += "/" + } + + go func() { + defer close(ch) + + obj, err := be.container.ListBlobs(storage.ListBlobsParameters{Prefix: prefix}) + if err != nil { + return + } + + for _, item := range obj.Blobs { + m := strings.TrimPrefix(item.Name, prefix) + if m == "" { + continue + } + + select { + case ch <- path.Base(m): + case <-ctx.Done(): + return + } + } + }() + + return ch +} + +// Remove keys for a specified backend type. +func (be *Backend) removeKeys(ctx context.Context, t restic.FileType) error { + for key := range be.List(ctx, restic.DataFile) { + err := be.Remove(ctx, restic.Handle{Type: restic.DataFile, Name: key}) + if err != nil { + return err + } + } + + return nil +} + +// Delete removes all restic keys in the bucket. It will not remove the bucket itself. +func (be *Backend) Delete(ctx context.Context) error { + alltypes := []restic.FileType{ + restic.DataFile, + restic.KeyFile, + restic.LockFile, + restic.SnapshotFile, + restic.IndexFile} + + for _, t := range alltypes { + err := be.removeKeys(ctx, t) + if err != nil { + return nil + } + } + + return be.Remove(ctx, restic.Handle{Type: restic.ConfigFile}) +} + +// Close does nothing +func (be *Backend) Close() error { return nil } diff --git a/internal/backend/azure/azure_test.go b/internal/backend/azure/azure_test.go new file mode 100644 index 000000000..813c0a1e3 --- /dev/null +++ b/internal/backend/azure/azure_test.go @@ -0,0 +1,121 @@ +package azure_test + +import ( + "context" + "errors" + "fmt" + "os" + "testing" + "time" + + "github.com/restic/restic/internal/backend/azure" + "github.com/restic/restic/internal/backend/test" + "github.com/restic/restic/internal/restic" + . "github.com/restic/restic/internal/test" +) + +func newAzureTestSuite(t testing.TB) *test.Suite { + return &test.Suite{ + // do not use excessive data + MinimalData: true, + + // NewConfig returns a config for a new temporary backend that will be used in tests. + NewConfig: func() (interface{}, error) { + azcfg, err := azure.ParseConfig(os.Getenv("RESTIC_TEST_AZURE_REPOSITORY")) + if err != nil { + return nil, err + } + + cfg := azcfg.(azure.Config) + cfg.AccountName = os.Getenv("RESTIC_TEST_AZURE_ACCOUNT_NAME") + cfg.AccountKey = os.Getenv("RESTIC_TEST_AZURE_ACCOUNT_KEY") + cfg.Prefix = fmt.Sprintf("test-%d", time.Now().UnixNano()) + return cfg, nil + }, + + // CreateFn is a function that creates a temporary repository for the tests. + Create: func(config interface{}) (restic.Backend, error) { + cfg := config.(azure.Config) + + be, err := azure.Create(cfg) + if err != nil { + return nil, err + } + + exists, err := be.Test(context.TODO(), restic.Handle{Type: restic.ConfigFile}) + if err != nil { + return nil, err + } + + if exists { + return nil, errors.New("config already exists") + } + + return be, nil + }, + + // OpenFn is a function that opens a previously created temporary repository. + Open: func(config interface{}) (restic.Backend, error) { + cfg := config.(azure.Config) + return azure.Open(cfg) + }, + + // CleanupFn removes data created during the tests. + Cleanup: func(config interface{}) error { + cfg := config.(azure.Config) + + be, err := azure.Open(cfg) + if err != nil { + return err + } + + if err := be.(restic.Deleter).Delete(context.TODO()); err != nil { + return err + } + + return nil + }, + } +} + +func TestBackendAzure(t *testing.T) { + defer func() { + if t.Skipped() { + SkipDisallowed(t, "restic/backend/azure.TestBackendAzure") + } + }() + + vars := []string{ + "RESTIC_TEST_AZURE_ACCOUNT_NAME", + "RESTIC_TEST_AZURE_ACCOUNT_KEY", + "RESTIC_TEST_AZURE_REPOSITORY", + } + + for _, v := range vars { + if os.Getenv(v) == "" { + t.Skipf("environment variable %v not set", v) + return + } + } + + t.Logf("run tests") + newAzureTestSuite(t).RunTests(t) +} + +func BenchmarkBackendAzure(t *testing.B) { + vars := []string{ + "RESTIC_TEST_AZURE_ACCOUNT_NAME", + "RESTIC_TEST_AZURE_ACCOUNT_KEY", + "RESTIC_TEST_AZURE_REPOSITORY", + } + + for _, v := range vars { + if os.Getenv(v) == "" { + t.Skipf("environment variable %v not set", v) + return + } + } + + t.Logf("run tests") + newAzureTestSuite(t).RunBenchmarks(t) +} diff --git a/internal/backend/azure/config.go b/internal/backend/azure/config.go new file mode 100644 index 000000000..e044ea7aa --- /dev/null +++ b/internal/backend/azure/config.go @@ -0,0 +1,57 @@ +package azure + +import ( + "errors" + "path" + "strings" + + "github.com/restic/restic/internal/options" +) + +// Config contains all configuration necessary to connect to an azure compatible +// server. +type Config struct { + AccountName string + AccountKey string + Container string + Prefix string + + Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 20)"` +} + +// NewConfig returns a new Config with the default values filled in. +func NewConfig() Config { + return Config{ + Connections: 5, + } +} + +func init() { + options.Register("azure", Config{}) +} + +// ParseConfig parses the string s and extracts the azure config. The +// configuration format is azure:containerName:/[prefix]. +func ParseConfig(s string) (interface{}, error) { + if strings.HasPrefix(s, "azure:") { + s = s[6:] + } else { + return nil, errors.New("azure: invalid format") + } + // use the first entry of the path as the container name and the + // remainder as prefix + path := strings.SplitN(s, ":/", 2) + return createConfig(path) +} + +func createConfig(p []string) (interface{}, error) { + if len(p) < 2 { + return nil, errors.New("azure: invalid format, container name not found") + } + cfg := NewConfig() + cfg.Container = p[0] + if p[1] != "" { + cfg.Prefix = path.Clean(p[1]) + } + return cfg, nil +} diff --git a/internal/backend/azure/config_test.go b/internal/backend/azure/config_test.go new file mode 100644 index 000000000..a57542e77 --- /dev/null +++ b/internal/backend/azure/config_test.go @@ -0,0 +1,40 @@ +package azure + +import "testing" + +var configTests = []struct { + s string + cfg Config +}{ + {"azure:container-name:/", Config{ + Container: "container-name", + Prefix: "", + Connections: 5, + }}, + {"azure:container-name:/prefix/directory", Config{ + Container: "container-name", + Prefix: "prefix/directory", + Connections: 5, + }}, + {"azure:container-name:/prefix/directory/", Config{ + Container: "container-name", + Prefix: "prefix/directory", + Connections: 5, + }}, +} + +func TestParseConfig(t *testing.T) { + for i, test := range configTests { + cfg, err := ParseConfig(test.s) + if err != nil { + t.Errorf("test %d:%s failed: %v", i, test.s, err) + continue + } + + if cfg != test.cfg { + t.Errorf("test %d:\ninput:\n %s\n wrong config, want:\n %v\ngot:\n %v", + i, test.s, test.cfg, cfg) + continue + } + } +} diff --git a/internal/backend/location/location.go b/internal/backend/location/location.go index 0466325a7..bf2c816b1 100644 --- a/internal/backend/location/location.go +++ b/internal/backend/location/location.go @@ -4,6 +4,7 @@ package location import ( "strings" + "github.com/restic/restic/internal/backend/azure" "github.com/restic/restic/internal/backend/b2" "github.com/restic/restic/internal/backend/local" "github.com/restic/restic/internal/backend/rest" @@ -32,6 +33,7 @@ var parsers = []parser{ {"local", local.ParseConfig}, {"sftp", sftp.ParseConfig}, {"s3", s3.ParseConfig}, + {"azure", azure.ParseConfig}, {"swift", swift.ParseConfig}, {"rest", rest.ParseConfig}, } From d973aa82feef310fa5e89f2a936b5e6155a86857 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 5 Aug 2017 20:30:20 +0200 Subject: [PATCH 02/10] Vendor dependencies for azure backend --- Gopkg.lock | 26 +- .../Azure/azure-sdk-for-go/.gitignore | 32 + .../Azure/azure-sdk-for-go/.travis.yml | 36 + .../Azure/azure-sdk-for-go/CHANGELOG.md | 520 + .../Azure/azure-sdk-for-go/Gododir/gen.go | 736 + .../github.com/Azure/azure-sdk-for-go/LICENSE | 202 + .../Azure/azure-sdk-for-go/README.md | 59 + .../Azure/azure-sdk-for-go/arm/README.md | 285 + .../azure-sdk-for-go/arm/advisor/client.go | 53 + .../azure-sdk-for-go/arm/advisor/models.go | 188 + .../arm/advisor/operations.go | 122 + .../arm/advisor/recommendations.go | 338 + .../arm/advisor/suppressions.go | 345 + .../azure-sdk-for-go/arm/advisor/version.go | 28 + .../arm/analysisservices/client.go | 55 + .../arm/analysisservices/models.go | 185 + .../arm/analysisservices/servers.go | 740 + .../arm/analysisservices/version.go | 28 + .../arm/apimanagement/apiexport.go | 122 + .../arm/apimanagement/apioperations.go | 535 + .../arm/apimanagement/apioperationspolicy.go | 312 + .../arm/apimanagement/apipolicy.go | 289 + .../arm/apimanagement/apiproducts.go | 166 + .../arm/apimanagement/apis.go | 512 + .../arm/apimanagement/authorizationservers.go | 500 + .../arm/apimanagement/backends.go | 492 + .../arm/apimanagement/certificates.go | 422 + .../arm/apimanagement/client.go | 53 + .../arm/apimanagement/groups.go | 501 + .../arm/apimanagement/groupusers.go | 351 + .../arm/apimanagement/identityproviders.go | 438 + .../arm/apimanagement/loggers.go | 487 + .../arm/apimanagement/models.go | 1531 ++ .../arm/apimanagement/networkstatus.go | 119 + .../apimanagement/openidconnectproviders.go | 494 + .../arm/apimanagement/operations.go | 123 + .../arm/apimanagement/policysnippets.go | 120 + .../arm/apimanagement/productapis.go | 344 + .../arm/apimanagement/productgroups.go | 345 + .../arm/apimanagement/productpolicy.go | 290 + .../arm/apimanagement/products.go | 516 + .../arm/apimanagement/productsubscriptions.go | 177 + .../arm/apimanagement/properties.go | 163 + .../arm/apimanagement/property.go | 377 + .../arm/apimanagement/quotabycounterkeys.go | 201 + .../arm/apimanagement/quotabyperiodkeys.go | 201 + .../arm/apimanagement/regions.go | 115 + .../arm/apimanagement/reports.go | 165 + .../arm/apimanagement/services.go | 1278 ++ .../arm/apimanagement/subscriptions.go | 674 + .../arm/apimanagement/tenantaccess.go | 340 + .../arm/apimanagement/tenantaccessgit.go | 263 + .../arm/apimanagement/tenantconfiguration.go | 340 + .../tenantconfigurationsyncstate.go | 119 + .../arm/apimanagement/tenantpolicy.go | 272 + .../arm/apimanagement/usergroups.go | 170 + .../arm/apimanagement/useridentities.go | 123 + .../arm/apimanagement/users.go | 601 + .../arm/apimanagement/usersubscriptions.go | 176 + .../arm/apimanagement/version.go | 28 + .../apimdeployment/apimanagementservices.go | 1060 + .../arm/apimdeployment/client.go | 58 + .../arm/apimdeployment/models.go | 251 + .../arm/apimdeployment/version.go | 60 + .../arm/appinsights/client.go | 53 + .../arm/appinsights/components.go | 497 + .../arm/appinsights/models.go | 226 + .../arm/appinsights/operations.go | 123 + .../arm/appinsights/version.go | 28 + .../arm/appinsights/webtests.go | 499 + .../authorization/classicadministrators.go | 133 + .../arm/authorization/client.go | 57 + .../arm/authorization/models.go | 223 + .../arm/authorization/permissions.go | 232 + .../provideroperationsmetadata.go | 200 + .../arm/authorization/roleassignments.go | 825 + .../arm/authorization/roledefinitions.go | 399 + .../arm/authorization/version.go | 28 + .../arm/automation/account.go | 514 + .../arm/automation/activity.go | 216 + .../agentregistrationinformation.go | 191 + .../arm/automation/certificate.go | 441 + .../azure-sdk-for-go/arm/automation/client.go | 52 + .../arm/automation/connection.go | 442 + .../arm/automation/connectiontype.go | 366 + .../arm/automation/credential.go | 443 + .../arm/automation/dsccompilationjob.go | 373 + .../arm/automation/dscconfiguration.go | 444 + .../arm/automation/dscnode.go | 362 + .../arm/automation/dscnodeconfiguration.go | 377 + .../azure-sdk-for-go/arm/automation/fields.go | 117 + .../automation/hybridrunbookworkergroup.go | 363 + .../azure-sdk-for-go/arm/automation/job.go | 654 + .../arm/automation/jobschedule.go | 365 + .../arm/automation/jobstream.go | 218 + .../azure-sdk-for-go/arm/automation/models.go | 1926 ++ .../azure-sdk-for-go/arm/automation/module.go | 443 + .../arm/automation/nodereports.go | 292 + .../arm/automation/objectdatatypes.go | 194 + .../arm/automation/operations.go | 98 + .../arm/automation/runbook.go | 523 + .../arm/automation/runbookdraft.go | 447 + .../arm/automation/schedule.go | 439 + .../arm/automation/statistics.go | 117 + .../arm/automation/testjobs.go | 410 + .../arm/automation/testjobstreams.go | 221 + .../azure-sdk-for-go/arm/automation/usages.go | 113 + .../arm/automation/variable.go | 438 + .../arm/automation/version.go | 28 + .../arm/automation/webhook.go | 512 + .../azure-sdk-for-go/arm/batch/account.go | 821 + .../azure-sdk-for-go/arm/batch/application.go | 464 + .../arm/batch/applicationpackage.go | 363 + .../azure-sdk-for-go/arm/batch/client.go | 52 + .../azure-sdk-for-go/arm/batch/location.go | 106 + .../azure-sdk-for-go/arm/batch/models.go | 264 + .../azure-sdk-for-go/arm/batch/version.go | 28 + .../azure-sdk-for-go/arm/billing/client.go | 55 + .../azure-sdk-for-go/arm/billing/invoices.go | 293 + .../azure-sdk-for-go/arm/billing/models.go | 160 + .../arm/billing/operations.go | 125 + .../azure-sdk-for-go/arm/billing/periods.go | 221 + .../azure-sdk-for-go/arm/billing/version.go | 28 + .../Azure/azure-sdk-for-go/arm/cdn/client.go | 293 + .../azure-sdk-for-go/arm/cdn/customdomains.go | 585 + .../azure-sdk-for-go/arm/cdn/edgenodes.go | 124 + .../azure-sdk-for-go/arm/cdn/endpoints.go | 1101 + .../Azure/azure-sdk-for-go/arm/cdn/models.go | 597 + .../Azure/azure-sdk-for-go/arm/cdn/origins.go | 323 + .../azure-sdk-for-go/arm/cdn/profiles.go | 774 + .../Azure/azure-sdk-for-go/arm/cdn/version.go | 28 + .../arm/cognitiveservices/accounts.go | 724 + .../arm/cognitiveservices/client.go | 53 + .../arm/cognitiveservices/models.go | 212 + .../arm/cognitiveservices/version.go | 28 + .../azure-sdk-for-go/arm/commerce/client.go | 53 + .../azure-sdk-for-go/arm/commerce/models.go | 151 + .../azure-sdk-for-go/arm/commerce/ratecard.go | 117 + .../arm/commerce/usageaggregates.go | 155 + .../azure-sdk-for-go/arm/commerce/version.go | 28 + .../arm/compute/availabilitysets.go | 374 + .../azure-sdk-for-go/arm/compute/client.go | 53 + .../azure-sdk-for-go/arm/compute/images.go | 463 + .../azure-sdk-for-go/arm/compute/models.go | 1342 ++ .../azure-sdk-for-go/arm/compute/usage.go | 137 + .../azure-sdk-for-go/arm/compute/version.go | 28 + .../compute/virtualmachineextensionimages.go | 247 + .../arm/compute/virtualmachineextensions.go | 286 + .../arm/compute/virtualmachineimages.go | 391 + .../arm/compute/virtualmachines.go | 1207 ++ .../arm/compute/virtualmachinescalesets.go | 1316 ++ .../arm/compute/virtualmachinescalesetvms.go | 872 + .../arm/compute/virtualmachinesizes.go | 114 + .../arm/consumption/client.go | 56 + .../arm/consumption/models.go | 141 + .../arm/consumption/operations.go | 125 + .../arm/consumption/usagedetails.go | 170 + .../arm/consumption/version.go | 28 + .../arm/containerregistry/client.go | 53 + .../arm/containerregistry/models.go | 223 + .../arm/containerregistry/operations.go | 124 + .../arm/containerregistry/registries.go | 783 + .../arm/containerregistry/version.go | 28 + .../arm/containerservice/client.go | 53 + .../arm/containerservice/containerservices.go | 499 + .../arm/containerservice/models.go | 257 + .../arm/containerservice/version.go | 28 + .../azure-sdk-for-go/arm/cosmos-db/client.go | 51 + .../arm/cosmos-db/databaseaccounts.go | 1053 + .../azure-sdk-for-go/arm/cosmos-db/models.go | 197 + .../azure-sdk-for-go/arm/cosmos-db/version.go | 28 + .../authorizationpolicies.go | 424 + .../arm/customer-insights/client.go | 56 + .../customer-insights/connectormappings.go | 369 + .../arm/customer-insights/connectors.go | 383 + .../arm/customer-insights/hubs.go | 521 + .../arm/customer-insights/images.go | 182 + .../arm/customer-insights/interactions.go | 375 + .../arm/customer-insights/kpi.go | 455 + .../arm/customer-insights/links.go | 370 + .../arm/customer-insights/models.go | 1257 ++ .../arm/customer-insights/profiles.go | 461 + .../customer-insights/relationshiplinks.go | 391 + .../arm/customer-insights/relationships.go | 388 + .../arm/customer-insights/roleassignments.go | 370 + .../arm/customer-insights/roles.go | 133 + .../arm/customer-insights/version.go | 28 + .../arm/customer-insights/views.go | 352 + .../arm/customer-insights/widgettypes.go | 201 + .../account/accountgroup.go | 641 + .../arm/datalake-analytics/account/client.go | 53 + .../account/datalakestoreaccounts.go | 391 + .../account/firewallrules.go | 432 + .../arm/datalake-analytics/account/models.go | 429 + .../account/storageaccounts.go | 738 + .../arm/datalake-analytics/account/version.go | 28 + .../datalake-store/account/accountgroup.go | 702 + .../arm/datalake-store/account/client.go | 53 + .../datalake-store/account/firewallrules.go | 432 + .../arm/datalake-store/account/models.go | 370 + .../account/trustedidproviders.go | 434 + .../arm/datalake-store/account/version.go | 28 + .../arm/devtestlabs/armtemplates.go | 221 + .../arm/devtestlabs/artifacts.go | 295 + .../arm/devtestlabs/artifactsources.go | 432 + .../arm/devtestlabs/client.go | 53 + .../azure-sdk-for-go/arm/devtestlabs/costs.go | 187 + .../arm/devtestlabs/customimages.go | 395 + .../azure-sdk-for-go/arm/devtestlabs/disks.go | 574 + .../arm/devtestlabs/environments.go | 403 + .../arm/devtestlabs/formulas.go | 393 + .../arm/devtestlabs/galleryimages.go | 147 + .../arm/devtestlabs/globalschedules.go | 691 + .../azure-sdk-for-go/arm/devtestlabs/labs.go | 977 + .../arm/devtestlabs/models.go | 1952 ++ .../arm/devtestlabs/notificationchannels.go | 501 + .../arm/devtestlabs/policies.go | 438 + .../arm/devtestlabs/policysets.go | 111 + .../arm/devtestlabs/schedules.go | 601 + .../arm/devtestlabs/secrets.go | 366 + .../arm/devtestlabs/servicerunners.go | 346 + .../azure-sdk-for-go/arm/devtestlabs/users.go | 439 + .../arm/devtestlabs/version.go | 28 + .../arm/devtestlabs/virtualmachines.go | 1045 + .../devtestlabs/virtualmachineschedules.go | 523 + .../arm/devtestlabs/virtualnetworks.go | 457 + .../Azure/azure-sdk-for-go/arm/disk/client.go | 53 + .../Azure/azure-sdk-for-go/arm/disk/disks.go | 728 + .../Azure/azure-sdk-for-go/arm/disk/models.go | 278 + .../azure-sdk-for-go/arm/disk/snapshots.go | 733 + .../azure-sdk-for-go/arm/disk/version.go | 28 + .../Azure/azure-sdk-for-go/arm/dns/client.go | 52 + .../Azure/azure-sdk-for-go/arm/dns/models.go | 360 + .../azure-sdk-for-go/arm/dns/recordsets.go | 545 + .../Azure/azure-sdk-for-go/arm/dns/version.go | 28 + .../Azure/azure-sdk-for-go/arm/dns/zones.go | 463 + .../azure-sdk-for-go/arm/documentdb/client.go | 53 + .../arm/documentdb/databaseaccounts.go | 1069 + .../azure-sdk-for-go/arm/documentdb/models.go | 210 + .../arm/documentdb/version.go | 29 + .../azure-sdk-for-go/arm/eventhub/client.go | 53 + .../arm/eventhub/consumergroups.go | 410 + .../arm/eventhub/eventhubs.go | 931 + .../azure-sdk-for-go/arm/eventhub/models.go | 449 + .../arm/eventhub/namespaces.go | 1163 + .../arm/eventhub/operations.go | 122 + .../azure-sdk-for-go/arm/eventhub/version.go | 28 + .../arm/examples/check/check.go | 86 + .../arm/examples/create/create.go | 85 + .../arm/examples/dns/README.md | 34 + .../arm/examples/dns/create.go | 194 + .../arm/examples/dns/paging/paging.go | 201 + .../arm/examples/helpers/helpers.go | 49 + .../arm/graphrbac/applications.go | 702 + .../azure-sdk-for-go/arm/graphrbac/client.go | 53 + .../azure-sdk-for-go/arm/graphrbac/groups.go | 786 + .../azure-sdk-for-go/arm/graphrbac/models.go | 298 + .../azure-sdk-for-go/arm/graphrbac/objects.go | 240 + .../arm/graphrbac/serviceprincipals.go | 639 + .../azure-sdk-for-go/arm/graphrbac/users.go | 516 + .../azure-sdk-for-go/arm/graphrbac/version.go | 28 + .../arm/hdinsight/applications.go | 352 + .../azure-sdk-for-go/arm/hdinsight/client.go | 52 + .../arm/hdinsight/clusters.go | 785 + .../arm/hdinsight/configurations.go | 195 + .../arm/hdinsight/extension.go | 243 + .../arm/hdinsight/location.go | 105 + .../azure-sdk-for-go/arm/hdinsight/models.go | 602 + .../arm/hdinsight/operations.go | 122 + .../arm/hdinsight/scriptactions.go | 198 + .../arm/hdinsight/scriptexecutionhistory.go | 265 + .../azure-sdk-for-go/arm/hdinsight/version.go | 28 + .../arm/insights/alertruleincidents.go | 176 + .../arm/insights/alertrules.go | 321 + .../arm/insights/autoscalesettings.go | 347 + .../azure-sdk-for-go/arm/insights/client.go | 52 + .../arm/insights/logprofiles.go | 309 + .../azure-sdk-for-go/arm/insights/models.go | 511 + .../arm/insights/servicediagnosticsettings.go | 173 + .../azure-sdk-for-go/arm/insights/version.go | 28 + .../azure-sdk-for-go/arm/intune/android.go | 875 + .../azure-sdk-for-go/arm/intune/client.go | 973 + .../Azure/azure-sdk-for-go/arm/intune/ios.go | 875 + .../azure-sdk-for-go/arm/intune/models.go | 690 + .../azure-sdk-for-go/arm/intune/version.go | 28 + .../azure-sdk-for-go/arm/iothub/client.go | 53 + .../azure-sdk-for-go/arm/iothub/models.go | 539 + .../azure-sdk-for-go/arm/iothub/resource.go | 1577 ++ .../azure-sdk-for-go/arm/iothub/version.go | 28 + .../azure-sdk-for-go/arm/keyvault/client.go | 54 + .../azure-sdk-for-go/arm/keyvault/models.go | 243 + .../azure-sdk-for-go/arm/keyvault/vaults.go | 443 + .../azure-sdk-for-go/arm/keyvault/version.go | 28 + .../azure-sdk-for-go/arm/logic/agreements.go | 779 + .../arm/logic/certificates.go | 352 + .../azure-sdk-for-go/arm/logic/client.go | 135 + .../arm/logic/integrationaccounts.go | 559 + .../Azure/azure-sdk-for-go/arm/logic/maps.go | 347 + .../azure-sdk-for-go/arm/logic/models.go | 2030 ++ .../azure-sdk-for-go/arm/logic/partners.go | 351 + .../azure-sdk-for-go/arm/logic/schemas.go | 347 + .../azure-sdk-for-go/arm/logic/sessions.go | 350 + .../azure-sdk-for-go/arm/logic/version.go | 28 + .../arm/logic/workflowrunactions.go | 209 + .../arm/logic/workflowruns.go | 271 + .../azure-sdk-for-go/arm/logic/workflows.go | 898 + .../arm/logic/workflowtriggerhistories.go | 280 + .../arm/logic/workflowtriggers.go | 340 + .../arm/logic/workflowversions.go | 276 + .../machinelearning/commitmentplans/client.go | 57 + .../commitmentplans/commitmentassociations.go | 279 + .../commitmentplans/commitmentplansgroup.go | 499 + .../machinelearning/commitmentplans/models.go | 182 + .../commitmentplans/usagehistory.go | 140 + .../commitmentplans/version.go | 28 + .../arm/machinelearning/webservices/client.go | 58 + .../arm/machinelearning/webservices/models.go | 449 + .../machinelearning/webservices/version.go | 28 + .../webservices/webservicesgroup.go | 741 + .../arm/mediaservices/client.go | 53 + .../arm/mediaservices/mediaservice.go | 716 + .../arm/mediaservices/models.go | 149 + .../arm/mediaservices/version.go | 28 + .../arm/mobileengagement/appcollections.go | 192 + .../arm/mobileengagement/apps.go | 130 + .../arm/mobileengagement/campaigns.go | 1076 + .../arm/mobileengagement/client.go | 53 + .../arm/mobileengagement/devices.go | 477 + .../arm/mobileengagement/exporttasks.go | 1007 + .../arm/mobileengagement/importtasks.go | 309 + .../arm/mobileengagement/models.go | 920 + .../mobileengagement/supportedplatforms.go | 103 + .../arm/mobileengagement/version.go | 28 + .../arm/monitor/activitylogalerts.go | 452 + .../arm/monitor/alertruleincidents.go | 176 + .../arm/monitor/alertrules.go | 315 + .../arm/monitor/autoscalesettings.go | 341 + .../azure-sdk-for-go/arm/monitor/client.go | 52 + .../arm/monitor/logprofiles.go | 311 + .../azure-sdk-for-go/arm/monitor/models.go | 586 + .../arm/monitor/servicediagnosticsettings.go | 242 + .../azure-sdk-for-go/arm/monitor/version.go | 28 + .../azure-sdk-for-go/arm/mysql/client.go | 52 + .../arm/mysql/configurations.go | 260 + .../azure-sdk-for-go/arm/mysql/databases.go | 344 + .../arm/mysql/firewallrules.go | 359 + .../azure-sdk-for-go/arm/mysql/logfiles.go | 106 + .../azure-sdk-for-go/arm/mysql/models.go | 418 + .../azure-sdk-for-go/arm/mysql/mysql_test.go | 68 + .../azure-sdk-for-go/arm/mysql/operations.go | 97 + .../azure-sdk-for-go/arm/mysql/servers.go | 503 + .../azure-sdk-for-go/arm/mysql/version.go | 28 + .../arm/network/applicationgateways.go | 773 + .../arm/network/bgpservicecommunities.go | 127 + .../azure-sdk-for-go/arm/network/client.go | 124 + .../expressroutecircuitauthorizations.go | 372 + .../network/expressroutecircuitpeerings.go | 370 + .../arm/network/expressroutecircuits.go | 840 + .../network/expressrouteserviceproviders.go | 128 + .../arm/network/interfaces.go | 871 + .../arm/network/loadbalancers.go | 450 + .../arm/network/localnetworkgateways.go | 389 + .../azure-sdk-for-go/arm/network/models.go | 2996 +++ .../arm/network/packetcaptures.go | 526 + .../arm/network/publicipaddresses.go | 465 + .../arm/network/routefilterrules.go | 468 + .../arm/network/routefilters.go | 535 + .../azure-sdk-for-go/arm/network/routes.go | 365 + .../arm/network/routetables.go | 449 + .../arm/network/securitygroups.go | 452 + .../arm/network/securityrules.go | 383 + .../azure-sdk-for-go/arm/network/subnets.go | 369 + .../azure-sdk-for-go/arm/network/usages.go | 135 + .../azure-sdk-for-go/arm/network/version.go | 28 + .../virtualnetworkgatewayconnections.go | 652 + .../arm/network/virtualnetworkgateways.go | 785 + .../arm/network/virtualnetworkpeerings.go | 370 + .../arm/network/virtualnetworks.go | 521 + .../azure-sdk-for-go/arm/network/watchers.go | 1131 + .../arm/networkwatcher/client.go | 61 + .../arm/networkwatcher/models.go | 513 + .../arm/networkwatcher/networkwatchers.go | 981 + .../arm/networkwatcher/packetcaptures.go | 463 + .../arm/networkwatcher/version.go | 60 + .../arm/notificationhubs/client.go | 53 + .../arm/notificationhubs/models.go | 395 + .../arm/notificationhubs/namespaces.go | 1018 + .../notificationhubs/notificationhubsgroup.go | 937 + .../arm/notificationhubs/version.go | 28 + .../arm/operationalinsights/client.go | 53 + .../arm/operationalinsights/datasources.go | 380 + .../arm/operationalinsights/linkedservices.go | 354 + .../arm/operationalinsights/models.go | 285 + .../arm/operationalinsights/version.go | 28 + .../arm/operationalinsights/workspaces.go | 858 + .../azure-sdk-for-go/arm/postgresql/client.go | 52 + .../arm/postgresql/configurations.go | 261 + .../arm/postgresql/databases.go | 344 + .../arm/postgresql/firewallrules.go | 360 + .../arm/postgresql/logfiles.go | 106 + .../azure-sdk-for-go/arm/postgresql/models.go | 418 + .../arm/postgresql/operations.go | 97 + .../arm/postgresql/postgresql_test.go | 68 + .../arm/postgresql/servers.go | 503 + .../arm/postgresql/version.go | 28 + .../arm/powerbiembedded/client.go | 114 + .../arm/powerbiembedded/models.go | 162 + .../arm/powerbiembedded/version.go | 28 + .../powerbiembedded/workspacecollections.go | 739 + .../arm/powerbiembedded/workspaces.go | 109 + .../arm/recoveryservices/client.go | 53 + .../arm/recoveryservices/models.go | 192 + .../arm/recoveryservices/operations.go | 131 + .../arm/recoveryservices/vaultextendedinfo.go | 250 + .../arm/recoveryservices/vaults.go | 439 + .../arm/recoveryservices/version.go | 28 + .../recoveryservicesbackup/backupengines.go | 216 + .../arm/recoveryservicesbackup/backupjobs.go | 139 + .../backupoperationresults.go | 115 + .../backupoperationstatuses.go | 115 + .../recoveryservicesbackup/backuppolicies.go | 138 + .../backupprotectableitems.go | 141 + .../backupprotecteditems.go | 141 + .../backupprotectioncontainers.go | 137 + .../backupresourcestorageconfigs.go | 174 + .../backupresourcevaultconfigs.go | 178 + .../arm/recoveryservicesbackup/backups.go | 117 + .../backupusagesummaries.go | 116 + .../arm/recoveryservicesbackup/client.go | 53 + .../exportjobsoperationresults.go | 114 + .../itemlevelrecoveryconnections.go | 198 + .../jobcancellations.go | 111 + .../arm/recoveryservicesbackup/jobdetails.go | 110 + .../joboperationresults.go | 113 + .../arm/recoveryservicesbackup/jobs.go | 111 + .../arm/recoveryservicesbackup/models.go | 2113 ++ .../arm/recoveryservicesbackup/operations.go | 125 + .../protecteditemoperationresults.go | 117 + .../protecteditemoperationstatuses.go | 122 + .../recoveryservicesbackup/protecteditems.go | 269 + .../protectioncontaineroperationresults.go | 116 + ...tectioncontainerrefreshoperationresults.go | 114 + .../protectioncontainers.go | 183 + .../protectionpolicies.go | 255 + .../protectionpolicyoperationresults.go | 115 + .../protectionpolicyoperationstatuses.go | 119 + .../recoveryservicesbackup/recoverypoints.go | 219 + .../arm/recoveryservicesbackup/restores.go | 120 + .../recoveryservicesbackup/securitypins.go | 108 + .../arm/recoveryservicesbackup/version.go | 28 + .../recoveryservicessiterecovery/client.go | 56 + .../recoveryservicessiterecovery/models.go | 2832 +++ .../operations.go | 170 + .../recoverypoints.go | 247 + .../replicationalertsettings.go | 307 + .../replicationevents.go | 237 + .../replicationfabrics.go | 741 + .../replicationjobs.go | 577 + .../replicationlogicalnetworks.go | 242 + .../replicationnetworkmappings.go | 636 + .../replicationnetworks.go | 374 + .../replicationpolicies.go | 487 + .../replicationprotectableitems.go | 245 + .../replicationprotecteditems.go | 1536 ++ .../replicationprotectioncontainermappings.go | 639 + .../replicationprotectioncontainers.go | 717 + .../replicationrecoveryplans.go | 1044 + .../replicationrecoveryservicesproviders.go | 626 + ...eplicationstorageclassificationmappings.go | 552 + .../replicationstorageclassifications.go | 376 + .../replicationvcenters.go | 628 + .../recoveryservicessiterecovery/version.go | 28 + .../azure-sdk-for-go/arm/redis/client.go | 52 + .../arm/redis/firewallrule.go | 254 + .../arm/redis/firewallrules.go | 132 + .../azure-sdk-for-go/arm/redis/models.go | 335 + .../azure-sdk-for-go/arm/redis/operations.go | 123 + .../arm/redis/patchschedules.go | 252 + .../azure-sdk-for-go/arm/redis/redisgroup.go | 916 + .../azure-sdk-for-go/arm/redis/version.go | 28 + .../azure-sdk-for-go/arm/relay/client.go | 53 + .../arm/relay/hybridconnections.go | 943 + .../azure-sdk-for-go/arm/relay/models.go | 330 + .../azure-sdk-for-go/arm/relay/namespaces.go | 1167 + .../azure-sdk-for-go/arm/relay/operations.go | 123 + .../azure-sdk-for-go/arm/relay/version.go | 28 + .../azure-sdk-for-go/arm/relay/wcfrelays.go | 929 + .../resourcehealth/availabilitystatuses.go | 425 + .../arm/resourcehealth/client.go | 55 + .../arm/resourcehealth/models.go | 163 + .../arm/resourcehealth/operations.go | 98 + .../arm/resourcehealth/version.go | 28 + .../arm/resources/features/client.go | 57 + .../arm/resources/features/featuresgroup.go | 353 + .../arm/resources/features/models.go | 58 + .../arm/resources/features/version.go | 28 + .../arm/resources/links/client.go | 57 + .../arm/resources/links/models.go | 72 + .../arm/resources/links/resourcelinks.go | 442 + .../arm/resources/links/version.go | 28 + .../arm/resources/locks/client.go | 53 + .../arm/resources/locks/managementlocks.go | 1248 ++ .../arm/resources/locks/models.go | 77 + .../arm/resources/locks/version.go | 28 + .../appliancedefinitions.go | 720 + .../managedapplications/appliances.go | 1008 + .../resources/managedapplications/client.go | 53 + .../resources/managedapplications/models.go | 275 + .../resources/managedapplications/version.go | 28 + .../arm/resources/policy/assignments.go | 754 + .../arm/resources/policy/client.go | 54 + .../arm/resources/policy/definitions.go | 326 + .../arm/resources/policy/models.go | 110 + .../arm/resources/policy/version.go | 28 + .../arm/resources/resources/client.go | 53 + .../resources/deploymentoperations.go | 230 + .../arm/resources/resources/deployments.go | 767 + .../arm/resources/resources/groups.go | 711 + .../arm/resources/resources/models.go | 457 + .../arm/resources/resources/providers.go | 338 + .../arm/resources/resources/resourcesgroup.go | 898 + .../arm/resources/resources/tags.go | 387 + .../arm/resources/resources/version.go | 28 + .../arm/resources/subscriptions/client.go | 54 + .../arm/resources/subscriptions/models.go | 132 + .../subscriptions/subscriptionsgroup.go | 252 + .../arm/resources/subscriptions/tenants.go | 124 + .../arm/resources/subscriptions/version.go | 28 + .../azure-sdk-for-go/arm/scheduler/client.go | 53 + .../arm/scheduler/jobcollections.go | 661 + .../azure-sdk-for-go/arm/scheduler/jobs.go | 600 + .../azure-sdk-for-go/arm/scheduler/models.go | 536 + .../azure-sdk-for-go/arm/scheduler/version.go | 28 + .../azure-sdk-for-go/arm/search/adminkeys.go | 196 + .../azure-sdk-for-go/arm/search/client.go | 53 + .../azure-sdk-for-go/arm/search/models.go | 200 + .../azure-sdk-for-go/arm/search/querykeys.go | 272 + .../azure-sdk-for-go/arm/search/services.go | 446 + .../azure-sdk-for-go/arm/search/version.go | 28 + .../arm/servermanagement/client.go | 53 + .../arm/servermanagement/gateway.go | 869 + .../arm/servermanagement/models.go | 413 + .../arm/servermanagement/node.go | 576 + .../arm/servermanagement/powershell.go | 693 + .../arm/servermanagement/session.go | 298 + .../arm/servermanagement/version.go | 28 + .../arm/service-map/client.go | 53 + .../arm/service-map/clientgroups.go | 357 + .../arm/service-map/machinegroups.go | 492 + .../arm/service-map/machines.go | 846 + .../azure-sdk-for-go/arm/service-map/maps.go | 122 + .../arm/service-map/models.go | 759 + .../azure-sdk-for-go/arm/service-map/ports.go | 483 + .../arm/service-map/processes.go | 478 + .../arm/service-map/summaries.go | 131 + .../arm/service-map/version.go | 28 + .../azure-sdk-for-go/arm/servicebus/client.go | 53 + .../azure-sdk-for-go/arm/servicebus/models.go | 571 + .../arm/servicebus/namespaces.go | 1161 + .../arm/servicebus/operations.go | 122 + .../azure-sdk-for-go/arm/servicebus/queues.go | 928 + .../arm/servicebus/subscriptions.go | 407 + .../azure-sdk-for-go/arm/servicebus/topics.go | 927 + .../arm/servicebus/version.go | 28 + .../arm/servicefabric/client.go | 53 + .../arm/servicefabric/clusters.go | 572 + .../arm/servicefabric/clusterversions.go | 134 + .../arm/servicefabric/models.go | 439 + .../arm/servicefabric/operations.go | 123 + .../arm/servicefabric/version.go | 28 + .../azure-sdk-for-go/arm/sql/capabilities.go | 108 + .../Azure/azure-sdk-for-go/arm/sql/client.go | 54 + .../azure-sdk-for-go/arm/sql/databases.go | 1973 ++ .../azure-sdk-for-go/arm/sql/elasticpools.go | 615 + .../azure-sdk-for-go/arm/sql/firewallrules.go | 331 + .../Azure/azure-sdk-for-go/arm/sql/models.go | 1180 ++ .../azure-sdk-for-go/arm/sql/operations.go | 101 + .../arm/sql/recommendedelasticpools.go | 390 + .../Azure/azure-sdk-for-go/arm/sql/servers.go | 576 + .../Azure/azure-sdk-for-go/arm/sql/version.go | 29 + .../azure-sdk-for-go/arm/storage/accounts.go | 960 + .../azure-sdk-for-go/arm/storage/client.go | 53 + .../azure-sdk-for-go/arm/storage/models.go | 452 + .../azure-sdk-for-go/arm/storage/usage.go | 102 + .../azure-sdk-for-go/arm/storage/version.go | 28 + .../arm/storageimportexport/client.go | 244 + .../arm/storageimportexport/jobs.go | 737 + .../arm/storageimportexport/models.go | 331 + .../arm/storageimportexport/version.go | 28 + .../accesscontrolrecords.go | 385 + .../arm/storsimple8000series/alerts.go | 341 + .../storsimple8000series/backuppolicies.go | 487 + .../arm/storsimple8000series/backups.go | 489 + .../storsimple8000series/backupschedules.go | 400 + .../storsimple8000series/bandwidthsettings.go | 384 + .../arm/storsimple8000series/client.go | 53 + .../storsimple8000series/cloudappliances.go | 214 + .../arm/storsimple8000series/devices.go | 1304 ++ .../storsimple8000series/devicesettings.go | 832 + .../hardwarecomponentgroups.go | 219 + .../arm/storsimple8000series/jobs.go | 504 + .../arm/storsimple8000series/managers.go | 1354 ++ .../arm/storsimple8000series/models.go | 1954 ++ .../arm/storsimple8000series/operations.go | 169 + .../storageaccountcredentials.go | 389 + .../arm/storsimple8000series/version.go | 28 + .../storsimple8000series/volumecontainers.go | 548 + .../arm/storsimple8000series/volumes.go | 626 + .../arm/streamanalytics/client.go | 53 + .../arm/streamanalytics/functions.go | 670 + .../arm/streamanalytics/inputs.go | 588 + .../arm/streamanalytics/models.go | 806 + .../arm/streamanalytics/operations.go | 167 + .../arm/streamanalytics/outputs.go | 588 + .../arm/streamanalytics/streamingjobs.go | 842 + .../arm/streamanalytics/subscriptions.go | 109 + .../arm/streamanalytics/transformations.go | 284 + .../arm/streamanalytics/version.go | 28 + .../arm/trafficmanager/client.go | 53 + .../arm/trafficmanager/endpoints.go | 330 + .../arm/trafficmanager/models.go | 120 + .../arm/trafficmanager/profiles.go | 508 + .../arm/trafficmanager/version.go | 28 + .../Azure/azure-sdk-for-go/arm/web/apps.go | 17607 ++++++++++++++++ .../arm/web/appservicecertificateorders.go | 1499 ++ .../arm/web/appserviceenvironments.go | 3461 +++ .../arm/web/appserviceplans.go | 2237 ++ .../azure-sdk-for-go/arm/web/certificates.go | 525 + .../Azure/azure-sdk-for-go/arm/web/client.go | 876 + .../arm/web/deletedwebapps.go | 225 + .../Azure/azure-sdk-for-go/arm/web/domains.go | 1151 + .../Azure/azure-sdk-for-go/arm/web/models.go | 3673 ++++ .../azure-sdk-for-go/arm/web/provider.go | 160 + .../arm/web/recommendations.go | 570 + .../arm/web/topleveldomains.go | 283 + .../Azure/azure-sdk-for-go/arm/web/version.go | 28 + .../Azure/azure-sdk-for-go/buildTerraform.sh | 36 + .../datalake-store/filesystem/client.go | 51 + .../filesystem/filesystemgroup.go | 1833 ++ .../datalake-store/filesystem/models.go | 242 + .../datalake-store/filesystem/version.go | 28 + .../dataplane/keyvault/client.go | 3410 +++ .../dataplane/keyvault/models.go | 608 + .../dataplane/keyvault/version.go | 28 + .../Azure/azure-sdk-for-go/glide.lock | 63 + .../Azure/azure-sdk-for-go/glide.yaml | 13 + .../azure-sdk-for-go/management/README.md | 10 + .../management/affinitygroup/client.go | 131 + .../management/affinitygroup/entities.go | 80 + .../azure-sdk-for-go/management/client.go | 152 + .../azure-sdk-for-go/management/errors.go | 36 + .../management/errors_test.go | 30 + .../management/hostedservice/client.go | 125 + .../management/hostedservice/entities.go | 58 + .../Azure/azure-sdk-for-go/management/http.go | 190 + .../management/location/client.go | 30 + .../management/location/entities.go | 37 + .../management/networksecuritygroup/client.go | 245 + .../networksecuritygroup/entities.go | 115 + .../azure-sdk-for-go/management/operations.go | 92 + .../management/osimage/client.go | 44 + .../management/osimage/entities.go | 49 + .../management/publishSettings.go | 108 + .../azure-sdk-for-go/management/sql/client.go | 316 + .../management/sql/entities.go | 124 + .../management/storageservice/client.go | 108 + .../management/storageservice/entities.go | 79 + .../storageservice/entities_test.go | 31 + .../management/testutils/managementclient.go | 87 + .../Azure/azure-sdk-for-go/management/util.go | 11 + .../azure-sdk-for-go/management/version.go | 5 + .../management/virtualmachine/client.go | 328 + .../management/virtualmachine/entities.go | 579 + .../virtualmachine/entities_test.go | 299 + .../virtualmachine/resourceextensions.go | 25 + .../virtualmachine/resourceextensions_test.go | 27 + .../management/virtualmachinedisk/client.go | 230 + .../management/virtualmachinedisk/entities.go | 134 + .../management/virtualmachineimage/client.go | 110 + .../virtualmachineimage/entities.go | 95 + .../virtualmachineimage/entities_test.go | 110 + .../management/virtualnetwork/client.go | 47 + .../management/virtualnetwork/entities.go | 90 + .../management/vmutils/configurationset.go | 28 + .../management/vmutils/datadisks.go | 58 + .../management/vmutils/deployment.go | 91 + .../management/vmutils/extensions.go | 90 + .../management/vmutils/extensions_test.go | 42 + .../management/vmutils/integration_test.go | 458 + .../management/vmutils/network.go | 83 + .../management/vmutils/rolesize.go | 76 + .../management/vmutils/rolestate.go | 58 + .../management/vmutils/vmutils.go | 177 + .../management/vmutils/vmutils_test.go | 440 + .../Azure/azure-sdk-for-go/rungas.sh | 15 + .../azure-sdk-for-go/storage/appendblob.go | 72 + .../storage/appendblob_test.go | 126 + .../azure-sdk-for-go/storage/authorization.go | 227 + .../storage/authorization_test.go | 230 + .../Azure/azure-sdk-for-go/storage/blob.go | 629 + .../azure-sdk-for-go/storage/blob_test.go | 545 + .../azure-sdk-for-go/storage/blobsasuri.go | 106 + .../storage/blobsasuri_test.go | 185 + .../storage/blobserviceclient.go | 95 + .../azure-sdk-for-go/storage/blockblob.go | 258 + .../storage/blockblob_test.go | 152 + .../Azure/azure-sdk-for-go/storage/client.go | 668 + .../azure-sdk-for-go/storage/client_test.go | 528 + .../azure-sdk-for-go/storage/container.go | 453 + .../storage/container_test.go | 554 + .../azure-sdk-for-go/storage/copyblob.go | 223 + .../azure-sdk-for-go/storage/copyblob_test.go | 171 + .../azure-sdk-for-go/storage/directory.go | 224 + .../storage/directory_test.go | 170 + .../Azure/azure-sdk-for-go/storage/entity.go | 439 + .../azure-sdk-for-go/storage/entity_test.go | 550 + .../Azure/azure-sdk-for-go/storage/file.go | 462 + .../azure-sdk-for-go/storage/file_test.go | 403 + .../storage/fileserviceclient.go | 324 + .../azure-sdk-for-go/storage/leaseblob.go | 187 + .../storage/leaseblob_test.go | 211 + .../Azure/azure-sdk-for-go/storage/message.go | 153 + .../azure-sdk-for-go/storage/message_test.go | 79 + .../Azure/azure-sdk-for-go/storage/odata.go | 33 + .../azure-sdk-for-go/storage/pageblob.go | 191 + .../azure-sdk-for-go/storage/pageblob_test.go | 179 + .../Azure/azure-sdk-for-go/storage/queue.go | 427 + .../azure-sdk-for-go/storage/queue_test.go | 361 + .../storage/queueserviceclient.go | 28 + .../AppendBlobSuite/TestPutAppendBlob.yaml | 148 + .../TestPutAppendBlobAppendBlocks.yaml | 341 + .../Test_allSharedKeys.yaml | 302 + .../TestBlobSASURICorrectness.yaml | 145 + .../BlockBlobSuite/TestCreateBlockBlob.yaml | 140 + .../TestCreateBlockBlobFromReader.yaml | 374 + .../TestGetBlockList_PutBlockList.yaml | 272 + .../BlockBlobSuite/TestPutBlock.yaml | 110 + ...estPutBlockWithLengthUsingLimitReader.yaml | 101 + .../BlockBlobSuite/TestPutEmptyBlockBlob.yaml | 152 + .../ContainerSuite/TestContainerExists.yaml | 128 + .../TestCreateContainerDeleteContainer.yaml | 64 + .../TestCreateContainerIfExists.yaml | 36 + .../TestCreateContainerIfNotExists.yaml | 64 + .../TestDeleteContainerIfExists.yaml | 124 + .../TestListBlobsPagination.yaml | 354 + .../TestListBlobsTraversal.yaml | 414 + .../TestListBlobsWithMetadata.yaml | 598 + .../TestListContainersPagination.yaml | 394 + ...tContainerPermissionsOnlySuccessfully.yaml | 100 + ...stSetContainerPermissionsSuccessfully.yaml | 100 + ...nerPermissionsWithTimeoutSuccessfully.yaml | 100 + ...tContainerPermissionsOnlySuccessfully.yaml | 136 + ...enGetContainerPermissionsSuccessfully.yaml | 136 + .../CopyBlobSuite/TestAbortBlobCopy.yaml | 274 + .../CopyBlobSuite/TestBlobCopy.yaml | 338 + .../TestIncrementalCopyBlobNoTimeout.yaml | 178 + .../TestIncrementalCopyBlobWithTimeout.yaml | 178 + .../CopyBlobSuite/TestStartBlobCopy.yaml | 182 + .../TestAcquireInfiniteLease.yaml | 144 + ...estAcquireLeaseWithBadProposedLeaseID.yaml | 142 + ...TestAcquireLeaseWithNoProposedLeaseID.yaml | 142 + .../TestAcquireLeaseWithProposedLeaseID.yaml | 144 + .../TestBreakLeaseSuccessful.yaml | 180 + ...eLeaseNotSuccessfulbadProposedLeaseID.yaml | 182 + .../TestChangeLeaseSuccessful.yaml | 184 + ...stReleaseLeaseNotSuccessfulBadLeaseID.yaml | 180 + .../TestReleaseLeaseSuccessful.yaml | 180 + .../TestRenewLeaseAgainstNoCurrentLease.yaml | 140 + .../TestRenewLeaseSuccessful.yaml | 182 + .../PageBlobSuite/TestGetPageRanges.yaml | 454 + .../PageBlobSuite/TestPutPageBlob.yaml | 152 + .../PageBlobSuite/TestPutPagesClear.yaml | 288 + .../PageBlobSuite/TestPutPagesUpdate.yaml | 408 + .../StorageBlobSuite/TestBlobExists.yaml | 212 + .../TestDeleteBlobIfExists.yaml | 128 + .../TestDeleteBlobWithConditions.yaml | 264 + .../TestGetAndSetBlobMetadata.yaml | 250 + .../TestGetBlobProperties.yaml | 180 + .../StorageBlobSuite/TestGetBlobRange.yaml | 440 + .../TestMetadataCaseMunging.yaml | 178 + .../TestPutAppendBlobSpecialChars.yaml | 389 + .../TestSetBlobProperties.yaml | 200 + .../TestSetMetadataWithExtraHeaders.yaml | 230 + .../StorageBlobSuite/TestSnapshotBlob.yaml | 138 + .../TestSnapshotBlobWithInvalidLease.yaml | 176 + .../TestSnapshotBlobWithTimeout.yaml | 138 + .../TestSnapshotBlobWithValidLease.yaml | 178 + .../TestReturnsStorageServiceError.yaml | 75 + ...orageServiceError_withoutResponseBody.yaml | 32 + .../StorageClientSuite/Test_doRetry.yaml | 94 + .../StorageDirSuite/TestCreateDirectory.yaml | 152 + .../TestCreateDirectoryIfExists.yaml | 96 + .../TestCreateDirectoryIfNotExists.yaml | 152 + .../TestDirectoryMetadata.yaml | 168 + .../StorageDirSuite/TestListDirsAndFiles.yaml | 218 + .../TestListZeroDirsAndFiles.yaml | 94 + .../StorageEntitySuite/TestDelete.yaml | 315 + .../TestExecuteQueryNextResults.yaml | 459 + .../StorageEntitySuite/TestGet.yaml | 259 + .../StorageEntitySuite/TestInsert.yaml | 195 + .../StorageEntitySuite/TestInsertOrMerge.yaml | 189 + .../TestInsertOrReplace.yaml | 189 + .../StorageEntitySuite/TestMerge.yaml | 288 + .../StorageEntitySuite/TestUpdate.yaml | 288 + .../Test_InsertAndDeleteEntities.yaml | 307 + .../Test_InsertAndExecuteQuery.yaml | 233 + .../Test_InsertAndGetEntities.yaml | 231 + .../TestCopyFileMissingFile.yaml | 132 + .../TestCopyFileSameAccountNoMetaData.yaml | 298 + .../TestCopyFileSameAccountTimeout.yaml | 260 + .../StorageFileSuite/TestCreateFile.yaml | 248 + .../StorageFileSuite/TestFileMD5.yaml | 230 + .../StorageFileSuite/TestFileMetadata.yaml | 178 + .../StorageFileSuite/TestFileProperties.yaml | 190 + .../StorageFileSuite/TestFileRanges.yaml | 1033 + .../StorageFileSuite/TestGetFile.yaml | 322 + .../TestDeleteMessages.yaml | 156 + .../TestPutMessage_Peek.yaml | 951 + .../TestPutMessage_Peek_Update_Delete.yaml | 1049 + .../TestCreateQueue_DeleteQueue.yaml | 62 + .../StorageQueueSuite/TestDeleteMessages.yaml | 156 + .../StorageQueueSuite/TestGetMessages.yaml | 222 + .../StorageQueueSuite/TestQueueExists.yaml | 126 + .../Test_GetMetadata_GetApproximateCount.yaml | 280 + .../Test_GetPermissionsAllTrueNoTimeout.yaml | 126 + ...Test_GetPermissionsAllTrueWithTimeout.yaml | 126 + ..._GetPermissionsAlternateTrueNoTimeout.yaml | 126 + ...est_SetMetadataGetMetadata_Roundtrips.yaml | 132 + .../Test_SetPermissionsAllTrueNoTimeout.yaml | 94 + ...Test_SetPermissionsAllTrueWithTimeout.yaml | 94 + ..._SetPermissionsAlternateTrueNoTimeout.yaml | 94 + ...etPermissionsAlternateTrueWithTimeout.yaml | 94 + .../TestCreateShareDeleteShare.yaml | 64 + .../TestCreateShareIfExists.yaml | 70 + .../TestCreateShareIfNotExists.yaml | 64 + .../TestDeleteShareIfNotExists.yaml | 96 + .../TestGetAndSetShareMetadata.yaml | 232 + .../TestGetAndSetShareProperties.yaml | 132 + .../StorageShareSuite/TestListShares.yaml | 94 + .../TestMetadataCaseMunging.yaml | 138 + .../StorageShareSuite/TestShareExists.yaml | 130 + .../TestGetServiceProperties.yaml | 34 + .../TestSetServiceProperties.yaml | 68 + .../recordings/StorageTableSuite/TestGet.yaml | 129 + .../TestQueryTablesNextResults.yaml | 345 + .../TestSetPermissionsSuccessfully.yaml | 125 + .../TestSetPermissionsUnsuccessfully.yaml | 41 + ...TestSetThenGetPermissionsSuccessfully.yaml | 155 + .../Test_CreateAndDeleteTable.yaml | 180 + ...eateTableWithAllResponsePayloadLevels.yaml | 354 + .../Test_BatchInsertDeleteSameEntity.yaml | 142 + .../Test_BatchInsertMultipleEntities.yaml | 179 + ...est_BatchInsertSameEntryMultipleTimes.yaml | 142 + ...BatchInsertThenDeleteDifferentBatches.yaml | 253 + ..._BatchInsertThenMergeDifferentBatches.yaml | 217 + .../Azure/azure-sdk-for-go/storage/share.go | 202 + .../azure-sdk-for-go/storage/share_test.go | 207 + .../azure-sdk-for-go/storage/storagepolicy.go | 47 + .../storage/storageservice.go | 117 + .../storage/storageservice_test.go | 85 + .../Azure/azure-sdk-for-go/storage/table.go | 412 + .../azure-sdk-for-go/storage/table_batch.go | 302 + .../storage/table_batch_test.go | 216 + .../azure-sdk-for-go/storage/table_test.go | 209 + .../storage/tableserviceclient.go | 190 + .../Azure/azure-sdk-for-go/storage/util.go | 199 + .../azure-sdk-for-go/storage/util_test.go | 187 + .../Azure/azure-sdk-for-go/storage/version.go | 5 + .../github.com/Azure/go-autorest/.gitignore | 29 + .../github.com/Azure/go-autorest/.travis.yml | 21 + .../github.com/Azure/go-autorest/CHANGELOG.md | 157 + vendor/github.com/Azure/go-autorest/LICENSE | 191 + vendor/github.com/Azure/go-autorest/README.md | 132 + .../Azure/go-autorest/autorest/adal/README.md | 253 + .../go-autorest/autorest/adal/cmd/adal.go | 284 + .../Azure/go-autorest/autorest/adal/config.go | 51 + .../go-autorest/autorest/adal/config_test.go | 30 + .../go-autorest/autorest/adal/devicetoken.go | 228 + .../autorest/adal/devicetoken_test.go | 316 + .../go-autorest/autorest/adal/persist.go | 59 + .../go-autorest/autorest/adal/persist_test.go | 157 + .../Azure/go-autorest/autorest/adal/sender.go | 46 + .../Azure/go-autorest/autorest/adal/token.go | 408 + .../go-autorest/autorest/adal/token_test.go | 599 + .../go-autorest/autorest/authorization.go | 57 + .../autorest/authorization_test.go | 137 + .../Azure/go-autorest/autorest/autorest.go | 115 + .../go-autorest/autorest/autorest_test.go | 126 + .../Azure/go-autorest/autorest/azure/async.go | 302 + .../go-autorest/autorest/azure/async_test.go | 1116 + .../Azure/go-autorest/autorest/azure/azure.go | 180 + .../go-autorest/autorest/azure/azure_test.go | 431 + .../autorest/azure/environments.go | 130 + .../autorest/azure/environments_test.go | 216 + .../autorest/azure/example/README.md | 127 + .../autorest/azure/example/main.go | 258 + .../Azure/go-autorest/autorest/client.go | 235 + .../Azure/go-autorest/autorest/client_test.go | 342 + .../Azure/go-autorest/autorest/date/date.go | 82 + .../go-autorest/autorest/date/date_test.go | 223 + .../Azure/go-autorest/autorest/date/time.go | 89 + .../go-autorest/autorest/date/time_test.go | 263 + .../go-autorest/autorest/date/timerfc1123.go | 86 + .../autorest/date/timerfc1123_test.go | 212 + .../go-autorest/autorest/date/unixtime.go | 109 + .../autorest/date/unixtime_test.go | 267 + .../go-autorest/autorest/date/utility.go | 11 + .../Azure/go-autorest/autorest/error.go | 80 + .../Azure/go-autorest/autorest/error_test.go | 188 + .../go-autorest/autorest/mocks/helpers.go | 137 + .../autorest/mocks/helpers_test.go | 1 + .../Azure/go-autorest/autorest/mocks/mocks.go | 162 + .../go-autorest/autorest/mocks/mocks_test.go | 1 + .../Azure/go-autorest/autorest/preparer.go | 428 + .../go-autorest/autorest/preparer_test.go | 752 + .../Azure/go-autorest/autorest/responder.go | 236 + .../go-autorest/autorest/responder_test.go | 651 + .../go-autorest/autorest/retriablerequest.go | 73 + .../Azure/go-autorest/autorest/sender.go | 274 + .../Azure/go-autorest/autorest/sender_test.go | 767 + .../Azure/go-autorest/autorest/to/convert.go | 133 + .../go-autorest/autorest/to/convert_test.go | 220 + .../Azure/go-autorest/autorest/utility.go | 178 + .../go-autorest/autorest/utility_test.go | 368 + .../Azure/go-autorest/autorest/utils/auth.go | 42 + .../go-autorest/autorest/utils/commit.go | 18 + .../autorest/validation/validation.go | 373 + .../autorest/validation/validation_test.go | 2417 +++ .../Azure/go-autorest/autorest/version.go | 35 + .../github.com/Azure/go-autorest/glide.lock | 42 + .../github.com/Azure/go-autorest/glide.yaml | 28 + vendor/github.com/dgrijalva/jwt-go/.gitignore | 4 + .../github.com/dgrijalva/jwt-go/.travis.yml | 8 + vendor/github.com/dgrijalva/jwt-go/LICENSE | 8 + .../dgrijalva/jwt-go/MIGRATION_GUIDE.md | 96 + vendor/github.com/dgrijalva/jwt-go/README.md | 85 + .../dgrijalva/jwt-go/VERSION_HISTORY.md | 105 + vendor/github.com/dgrijalva/jwt-go/claims.go | 134 + .../dgrijalva/jwt-go/cmd/jwt/README.md | 13 + .../dgrijalva/jwt-go/cmd/jwt/app.go | 245 + vendor/github.com/dgrijalva/jwt-go/doc.go | 4 + vendor/github.com/dgrijalva/jwt-go/ecdsa.go | 147 + .../github.com/dgrijalva/jwt-go/ecdsa_test.go | 100 + .../dgrijalva/jwt-go/ecdsa_utils.go | 67 + vendor/github.com/dgrijalva/jwt-go/errors.go | 63 + .../dgrijalva/jwt-go/example_test.go | 114 + vendor/github.com/dgrijalva/jwt-go/hmac.go | 94 + .../dgrijalva/jwt-go/hmac_example_test.go | 64 + .../github.com/dgrijalva/jwt-go/hmac_test.go | 91 + .../dgrijalva/jwt-go/http_example_test.go | 216 + .../github.com/dgrijalva/jwt-go/map_claims.go | 94 + vendor/github.com/dgrijalva/jwt-go/none.go | 52 + .../github.com/dgrijalva/jwt-go/none_test.go | 72 + vendor/github.com/dgrijalva/jwt-go/parser.go | 128 + .../dgrijalva/jwt-go/parser_test.go | 252 + .../dgrijalva/jwt-go/request/doc.go | 7 + .../dgrijalva/jwt-go/request/extractor.go | 81 + .../jwt-go/request/extractor_example_test.go | 32 + .../jwt-go/request/extractor_test.go | 91 + .../dgrijalva/jwt-go/request/oauth2.go | 28 + .../dgrijalva/jwt-go/request/request.go | 24 + .../dgrijalva/jwt-go/request/request_test.go | 103 + vendor/github.com/dgrijalva/jwt-go/rsa.go | 100 + vendor/github.com/dgrijalva/jwt-go/rsa_pss.go | 126 + .../dgrijalva/jwt-go/rsa_pss_test.go | 96 + .../github.com/dgrijalva/jwt-go/rsa_test.go | 176 + .../github.com/dgrijalva/jwt-go/rsa_utils.go | 69 + .../dgrijalva/jwt-go/signing_method.go | 35 + .../dgrijalva/jwt-go/test/ec256-private.pem | 5 + .../dgrijalva/jwt-go/test/ec256-public.pem | 4 + .../dgrijalva/jwt-go/test/ec384-private.pem | 6 + .../dgrijalva/jwt-go/test/ec384-public.pem | 5 + .../dgrijalva/jwt-go/test/ec512-private.pem | 7 + .../dgrijalva/jwt-go/test/ec512-public.pem | 6 + .../dgrijalva/jwt-go/test/helpers.go | 42 + .../dgrijalva/jwt-go/test/hmacTestKey | 1 + .../dgrijalva/jwt-go/test/sample_key | 27 + .../dgrijalva/jwt-go/test/sample_key.pub | 9 + vendor/github.com/dgrijalva/jwt-go/token.go | 108 + vendor/github.com/satori/uuid/.travis.yml | 15 + vendor/github.com/satori/uuid/LICENSE | 20 + vendor/github.com/satori/uuid/README.md | 65 + .../github.com/satori/uuid/benchmarks_test.go | 121 + vendor/github.com/satori/uuid/uuid.go | 488 + vendor/github.com/satori/uuid/uuid_test.go | 633 + 985 files changed, 326579 insertions(+), 1 deletion(-) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/.gitignore create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/.travis.yml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/Gododir/gen.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/LICENSE create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/README.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/README.md create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/recommendations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/suppressions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/servers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiexport.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperationspolicy.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apipolicy.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiproducts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apis.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/authorizationservers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/backends.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/certificates.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groupusers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/identityproviders.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/loggers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/networkstatus.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/openidconnectproviders.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/policysnippets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productapis.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productgroups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productpolicy.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/products.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productsubscriptions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/properties.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/property.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabycounterkeys.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabyperiodkeys.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/regions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/reports.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/services.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/subscriptions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccess.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccessgit.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfiguration.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfigurationsyncstate.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantpolicy.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usergroups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/useridentities.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/users.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usersubscriptions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/apimanagementservices.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/components.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/webtests.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/classicadministrators.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/permissions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/provideroperationsmetadata.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roleassignments.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roledefinitions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/account.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/activity.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/agentregistrationinformation.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/certificate.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connection.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connectiontype.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/credential.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dsccompilationjob.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscconfiguration.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnode.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnodeconfiguration.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/fields.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/hybridrunbookworkergroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/job.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobschedule.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobstream.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/module.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/nodereports.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/objectdatatypes.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbook.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbookdraft.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/schedule.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/statistics.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobstreams.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/usages.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/variable.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/automation/webhook.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/account.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/application.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/applicationpackage.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/location.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/batch/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/billing/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/billing/invoices.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/billing/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/billing/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/billing/periods.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/billing/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/accounts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/ratecard.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/usageaggregates.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/usagedetails.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/containerservices.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/databaseaccounts.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/authorizationpolicies.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectormappings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectors.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/hubs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/images.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/interactions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/kpi.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/links.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/profiles.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationshiplinks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationships.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roleassignments.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roles.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/views.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/widgettypes.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/accountgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/datalakestoreaccounts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/firewallrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/storageaccounts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/accountgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/firewallrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/trustedidproviders.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/armtemplates.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifacts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifactsources.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/costs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/customimages.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/disks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/environments.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/formulas.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/galleryimages.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/globalschedules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/labs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/notificationchannels.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policies.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policysets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/schedules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/secrets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/servicerunners.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/users.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachines.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachineschedules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualnetworks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/disk/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/disk/disks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/disk/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/disk/snapshots.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/disk/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/databaseaccounts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/examples/check/check.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/examples/create/create.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/README.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/create.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/paging/paging.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/examples/helpers/helpers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/applications.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/groups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/objects.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/serviceprincipals.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/users.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/applications.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/clusters.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/configurations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/extension.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/location.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptactions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptexecutionhistory.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertruleincidents.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/autoscalesettings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/logprofiles.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/servicediagnosticsettings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/insights/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/intune/android.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/intune/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/intune/ios.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/intune/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/intune/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/resource.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/vaults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/agreements.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/certificates.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/integrationaccounts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/maps.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/partners.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/schemas.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/sessions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowrunactions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowruns.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflows.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggerhistories.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowversions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentassociations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentplansgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/usagehistory.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/webservicesgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/mediaservice.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/appcollections.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/apps.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/campaigns.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/devices.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/exporttasks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/importtasks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/supportedplatforms.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/activitylogalerts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertruleincidents.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/autoscalesettings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/logprofiles.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/servicediagnosticsettings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/configurations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/databases.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/firewallrules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/logfiles.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/mysql_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/servers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/bgpservicecommunities.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitauthorizations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/packetcaptures.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilterrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilters.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgatewayconnections.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/network/watchers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/networkwatchers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/packetcaptures.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/namespaces.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/notificationhubsgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/datasources.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/linkedservices.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/workspaces.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/configurations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/databases.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/firewallrules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/logfiles.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/postgresql_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/servers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspacecollections.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspaces.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaultextendedinfo.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupengines.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupjobs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationstatuses.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backuppolicies.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectableitems.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotecteditems.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectioncontainers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcestorageconfigs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcevaultconfigs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupusagesummaries.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/exportjobsoperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/itemlevelrecoveryconnections.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobcancellations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobdetails.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/joboperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationstatuses.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditems.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontaineroperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainerrefreshoperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicies.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationresults.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationstatuses.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/recoverypoints.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/restores.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/securitypins.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/recoverypoints.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationalertsettings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationevents.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationfabrics.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationjobs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationlogicalnetworks.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworkmappings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworks.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationpolicies.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectableitems.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotecteditems.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectioncontainermappings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectioncontainers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationrecoveryplans.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationrecoveryservicesproviders.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassificationmappings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassifications.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationvcenters.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrule.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/patchschedules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/redisgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/redis/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/hybridconnections.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/namespaces.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/relay/wcfrelays.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/availabilitystatuses.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/featuresgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/resourcelinks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/managementlocks.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliancedefinitions.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliances.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/assignments.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/definitions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deploymentoperations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deployments.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/groups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/providers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/tags.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/subscriptionsgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/tenants.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/search/adminkeys.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/search/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/search/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/search/querykeys.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/search/services.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/search/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/gateway.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/node.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/powershell.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/session.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/clientgroups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machinegroups.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machines.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/maps.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/ports.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/processes.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/summaries.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/namespaces.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/queues.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/subscriptions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/topics.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusters.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusterversions.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/capabilities.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/databases.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/elasticpools.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/firewallrules.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/operations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/recommendedelasticpools.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/servers.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/sql/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usage.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/jobs.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/accesscontrolrecords.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/alerts.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backuppolicies.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backups.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backupschedules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/bandwidthsettings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/cloudappliances.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devices.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devicesettings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/hardwarecomponentgroups.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/jobs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/managers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/storageaccountcredentials.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumecontainers.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumes.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/functions.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/inputs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/outputs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/streamingjobs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/subscriptions.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/transformations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/endpoints.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/profiles.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/version.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/apps.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/appservicecertificateorders.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceenvironments.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceplans.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/certificates.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/deletedwebapps.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/domains.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/provider.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/recommendations.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/topleveldomains.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/arm/web/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/buildTerraform.sh create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/client.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/filesystemgroup.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/models.go create mode 100755 vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/glide.lock create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/glide.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/README.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/errors.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/http.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/location/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/location/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/osimage/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/osimage/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/publishSettings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/sql/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/sql/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/testutils/managementclient.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/util.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/entities.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/configurationset.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/datadisks.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/deployment.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/network.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolesize.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolestate.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/rungas.sh create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/authorization_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/container.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/container_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/directory_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/entity_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/file.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/message.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/message_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlob.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlobAppendBlocks.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AuthorizationSuite/Test_allSharedKeys.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlobSASURISuite/TestBlobSASURICorrectness.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlob.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReader.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestGetBlockList_PutBlockList.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlock.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlockWithLengthUsingLimitReader.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutEmptyBlockBlob.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestContainerExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerDeleteContainer.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfNotExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestDeleteContainerIfExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsPagination.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsTraversal.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsWithMetadata.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListContainersPagination.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsOnlySuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsSuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsWithTimeoutSuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsOnlySuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsSuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestAbortBlobCopy.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestBlobCopy.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobNoTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobWithTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestStartBlobCopy.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireInfiniteLease.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithBadProposedLeaseID.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithNoProposedLeaseID.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithProposedLeaseID.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestBreakLeaseSuccessful.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseNotSuccessfulbadProposedLeaseID.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseSuccessful.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseNotSuccessfulBadLeaseID.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseSuccessful.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseAgainstNoCurrentLease.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseSuccessful.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestGetPageRanges.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPageBlob.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesClear.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesUpdate.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestBlobExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobIfExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobWithConditions.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetAndSetBlobMetadata.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobProperties.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobRange.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestMetadataCaseMunging.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestPutAppendBlobSpecialChars.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetBlobProperties.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetMetadataWithExtraHeaders.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlob.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithInvalidLease.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithValidLease.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError_withoutResponseBody.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/Test_doRetry.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectory.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfNotExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestDirectoryMetadata.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListDirsAndFiles.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListZeroDirsAndFiles.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestDelete.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestExecuteQueryNextResults.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestGet.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsert.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrMerge.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrReplace.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestMerge.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestUpdate.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndDeleteEntities.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndExecuteQuery.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndGetEntities.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileMissingFile.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountNoMetaData.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCreateFile.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMD5.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMetadata.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileProperties.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileRanges.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestGetFile.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestDeleteMessages.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek_Update_Delete.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestCreateQueue_DeleteQueue.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestDeleteMessages.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestGetMessages.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestQueueExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetMetadata_GetApproximateCount.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueNoTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueWithTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAlternateTrueNoTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetMetadataGetMetadata_Roundtrips.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueNoTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueWithTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueNoTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueWithTimeout.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareDeleteShare.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfNotExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestDeleteShareIfNotExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareMetadata.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareProperties.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestListShares.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestMetadataCaseMunging.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestShareExists.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestGetServiceProperties.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestSetServiceProperties.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestGet.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestQueryTablesNextResults.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsSuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsUnsuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetThenGetPermissionsSuccessfully.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateAndDeleteTable.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateTableWithAllResponsePayloadLevels.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertDeleteSameEntity.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertMultipleEntities.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertSameEntryMultipleTimes.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenDeleteDifferentBatches.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenMergeDifferentBatches.yaml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/share.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/share_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/table.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/table_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/util.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/version.go create mode 100644 vendor/github.com/Azure/go-autorest/.gitignore create mode 100644 vendor/github.com/Azure/go-autorest/.travis.yml create mode 100644 vendor/github.com/Azure/go-autorest/CHANGELOG.md create mode 100644 vendor/github.com/Azure/go-autorest/LICENSE create mode 100644 vendor/github.com/Azure/go-autorest/README.md create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/README.md create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/cmd/adal.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/config.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/config_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/persist.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/persist_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/sender.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/token.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/token_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/authorization.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/authorization_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/autorest.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/autorest_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/async.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/async_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/azure.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/azure_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/environments.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/environments_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/example/README.md create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/example/main.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/client.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/client_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/date.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/date_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/time.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/time_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/unixtime_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/utility.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/error.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/error_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/mocks/helpers_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/mocks/mocks.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/mocks/mocks_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/preparer.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/preparer_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/responder.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/responder_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/sender.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/sender_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/to/convert.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/to/convert_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/utility.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/utility_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/utils/auth.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/utils/commit.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/validation/validation.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/validation/validation_test.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/version.go create mode 100644 vendor/github.com/Azure/go-autorest/glide.lock create mode 100644 vendor/github.com/Azure/go-autorest/glide.yaml create mode 100644 vendor/github.com/dgrijalva/jwt-go/.gitignore create mode 100644 vendor/github.com/dgrijalva/jwt-go/.travis.yml create mode 100644 vendor/github.com/dgrijalva/jwt-go/LICENSE create mode 100644 vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md create mode 100644 vendor/github.com/dgrijalva/jwt-go/README.md create mode 100644 vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md create mode 100644 vendor/github.com/dgrijalva/jwt-go/claims.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md create mode 100644 vendor/github.com/dgrijalva/jwt-go/cmd/jwt/app.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/doc.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/ecdsa.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/errors.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/example_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/hmac.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/hmac_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/http_example_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/map_claims.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/none.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/none_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/parser.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/parser_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/doc.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/extractor.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/extractor_example_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/oauth2.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/request.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/request/request_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/rsa.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/rsa_pss.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/rsa_test.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/rsa_utils.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/signing_method.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/ec256-public.pem create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/ec384-private.pem create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/ec384-public.pem create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/ec512-private.pem create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/ec512-public.pem create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/helpers.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/hmacTestKey create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/sample_key create mode 100644 vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub create mode 100644 vendor/github.com/dgrijalva/jwt-go/token.go create mode 100644 vendor/github.com/satori/uuid/.travis.yml create mode 100644 vendor/github.com/satori/uuid/LICENSE create mode 100644 vendor/github.com/satori/uuid/README.md create mode 100644 vendor/github.com/satori/uuid/benchmarks_test.go create mode 100644 vendor/github.com/satori/uuid/uuid.go create mode 100644 vendor/github.com/satori/uuid/uuid_test.go diff --git a/Gopkg.lock b/Gopkg.lock index 686eddf01..409e3d76a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -7,12 +7,30 @@ packages = [".","fs","fuseutil"] revision = "371fbbdaa8987b715bdd21d6adc4c9b20155f748" +[[projects]] + name = "github.com/Azure/azure-sdk-for-go" + packages = ["storage"] + revision = "2d49bb8f2cee530cc16f1f1a9f0aae763dee257d" + version = "v10.2.1-beta" + +[[projects]] + name = "github.com/Azure/go-autorest" + packages = ["autorest","autorest/adal","autorest/azure","autorest/date"] + revision = "f6e08fe5e4d45c9a66e40196d3fed5f37331d224" + version = "v8.1.1" + [[projects]] name = "github.com/cpuguy83/go-md2man" packages = ["md2man"] revision = "a65d4d2de4d5f7c74868dfa9b202a3c8be315aaa" version = "v1.0.6" +[[projects]] + name = "github.com/dgrijalva/jwt-go" + packages = ["."] + revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c" + version = "v3.0.0" + [[projects]] branch = "master" name = "github.com/elithrar/simple-scrypt" @@ -97,6 +115,12 @@ revision = "0b647d0506a698cca42caca173e55559b12a69f2" version = "v1.4" +[[projects]] + name = "github.com/satori/uuid" + packages = ["."] + revision = "879c5887cd475cd7864858769793b2ceb0d44feb" + version = "v1.1.0" + [[projects]] branch = "master" name = "github.com/shurcooL/sanitized_anchor_name" @@ -142,6 +166,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "0783f6c5ff3952c10a8ea9ba5e80dcc816e95f9934983b772764b867d9be7eb8" + inputs-digest = "c9fcacd2bd613364a18fa9427503621618fe681aaf9a438cada15a00cf8fc14e" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/.gitignore b/vendor/github.com/Azure/azure-sdk-for-go/.gitignore new file mode 100644 index 000000000..2da4dc358 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/.gitignore @@ -0,0 +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/ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml b/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml new file mode 100644 index 000000000..e33f601d4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml @@ -0,0 +1,36 @@ +sudo: false + +language: go + +go: + - 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 build ./arm/examples/... + - go test -v ./management/... + - go test -v ./arm/... + - go test -v ./storage/... + - test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)" + - test -z "$(golint ./storage/... | tee /dev/stderr)" + - go vet ./management/... + - go vet ./storage/... + - test -z "$(golint ./Gododir/... | tee /dev/stderr)" + - go vet ./Gododir/... + - bash buildTerraform.sh + \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md new file mode 100644 index 000000000..11173cdf8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md @@ -0,0 +1,520 @@ +# CHANGELOG + +## `v10.2.1-beta` +- Fixes polymorphic structs in `mysql` and `postgresql` packages. + +## `v10.2.0-beta` +### ARM + +| api | version | note | +|:------------------------------------|:-------------------|:------------------------------------| +| arm/cosmos-db | 2015-04-08 | new | +| arm/mysql | 2017-04-30-preview | new | +| arm/postgresql | 2017-04-30-preview | new | + +### Storage +- Bug fixes. + +### Generated code notes +- [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs) commit: 485ded7560c6309efb2f795ec6e46b7436dc6fdb +- [AutoRest](https://github.com/Azure/autorest) commit: c180952b850e677a8624655abeaded307d95cae3 + +## `v10.1.0-beta` +### ARM + +| api | version | note | +|:------------------------------------|:-------------------|:------------------------------------| +| arm/recoveryservicessiterecovery | 2016-08-10 | new | +| arm/managedapplications | 2016-09-01-preview | new | +| arm/storsimple8000series | 2017-06-01 | new | +| arm/streamanalytics | multiple | new | + +### Storage +- Bug fixes. + +### Generated code notes +- [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs) commit: a2cdf005407b81edb161c1f7b5c49b5ce8e7f041 +- [AutoRest](https://github.com/Azure/autorest) commit: 8e9c2d3704a04913a175ab76972b7d9597c77687 + +----- +## `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 new file mode 100644 index 000000000..f81b09e05 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/Gododir/gen.go @@ -0,0 +1,736 @@ +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: "cosmos-db", + Version: "2015-04-08", + }, + { + 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: "mysql", + Version: "2017-04-30-preview", + }, + { + 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: "postgresql", + Version: "2017-04-30-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: "recoveryservicessiterecovery", + Version: "2016-08-10", + Swagger: "service", + }, + { + 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: "managedapplications", + Version: "2016-09-01-preview", + }, + { + 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", + }, + { + Name: "storsimple8000series", + Version: "2017-06-01", + Swagger: "storsimple", + }, + { + Name: "streamanalytics", + Swagger: "compositeStreamAnalytics", + Modeler: compSwagger, + }, + // { + // 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) + p.Task("addVersion", nil, addVersion) +} + +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), + "-PackageVersion", sdkVersion, + } + if testGen { + commandArgs = append([]string{"-LEGACY"}, commandArgs...) + } + + // 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 addVersion(c *do.Context) { + gitStatus := exec.Command("git", "status", "-s") + out, err := runner(gitStatus) + if err != nil { + panic(fmt.Errorf("Git error: %s", err)) + } + files := strings.Split(out, "\n") + + for _, f := range files { + if strings.HasPrefix(f, " M ") && strings.HasSuffix(f, "version.go") { + gitAdd := exec.Command("git", "add", f[3:]) + _, err := runner(gitAdd) + if err != nil { + panic(fmt.Errorf("Git 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) (string, 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 stdout.String(), err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE new file mode 100644 index 000000000..af39a91e7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 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 new file mode 100644 index 000000000..c2ac320eb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/README.md @@ -0,0 +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. 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 new file mode 100644 index 000000000..ec781f17a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/README.md @@ -0,0 +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. 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 new file mode 100755 index 000000000..eccfe2c63 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..9b861c068 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..611dafec8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..beaa8e74c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/recommendations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ec0c6c494 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/suppressions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fd83eed1e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-advisor/2017-04-19" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..22fc2bd29 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..96fb36496 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..70e0e448b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/servers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fbe561d26 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-analysisservices/2016-05-16" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..5474d88fb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiexport.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5e05c51d4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2c16dedad --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperationspolicy.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..bf65107c5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apipolicy.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e1b2cf73f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiproducts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..63c6cbce9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apis.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e86fadd13 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/authorizationservers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..807088d83 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/backends.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0c4187e11 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/certificates.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8abb7d74e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..6d0b62670 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6df3b9443 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groupusers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9bc0cc054 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/identityproviders.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8a2506b79 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/loggers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f2fd0fc9d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..11625067f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/networkstatus.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5b63f1012 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/openidconnectproviders.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..335c01805 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d54456bdd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/policysnippets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..80fbe7078 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productapis.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..15c193667 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productgroups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7ed2e8146 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productpolicy.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..4c930436b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/products.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..51ee3d6cd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productsubscriptions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..10d6f1efd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/properties.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b39dc5819 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/property.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f6f16c903 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabycounterkeys.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..20da7fe1f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabyperiodkeys.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..abc3227f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/regions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..83b12cb6f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/reports.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7a396f263 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/services.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..edd18aca2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/subscriptions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..531b9913c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccess.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7d5a67c38 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccessgit.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..90aeb4dee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfiguration.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..14e36721c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfigurationsyncstate.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6bb36d409 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantpolicy.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a922a4d8f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usergroups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ce04f2d9c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/useridentities.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2ae82ce85 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/users.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..4c4281763 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usersubscriptions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..242e13897 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-apimanagement/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100644 index 000000000..d0a215094 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/apimanagementservices.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..0c4223734 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/client.go @@ -0,0 +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, + } +} 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 new file mode 100644 index 000000000..9ba2d9047 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/models.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..5099053f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/version.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e00640451 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..45c5c8282 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/components.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0cf0bb0ad --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..37e9fd47c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0ec31d218 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-appinsights/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..509dfe804 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/webtests.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..50824a38a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/classicadministrators.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5330315d2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..b615a2c3e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..36abbb9c2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/permissions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5208637b5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/provideroperationsmetadata.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6f02c9550 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roleassignments.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..cdd9efc22 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roledefinitions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6a439d70a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-authorization/2015-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..e651973d5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/account.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a103e5544 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/activity.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..02d16325c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/agentregistrationinformation.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..368c73d49 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/certificate.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..4d2bf5c16 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..7d3300e5d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connection.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5e2effaf2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connectiontype.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5834f6ac0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/credential.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..15fe2346d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dsccompilationjob.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..88a8fd845 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscconfiguration.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fbeb848b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnode.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..32c31ea07 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnodeconfiguration.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ef597c0fb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/fields.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b36eb3b68 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/hybridrunbookworkergroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d1257ab97 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/job.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a10ec7dba --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobschedule.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..95b497598 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobstream.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9bba30646 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..225b0a495 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/module.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ad9f6acb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/nodereports.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0a0952fb2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/objectdatatypes.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a70339b7a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..52a522bea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbook.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d3679ee43 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbookdraft.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9a98147d6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/schedule.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..74d027ebe --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/statistics.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..55a39599a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f5f608457 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobstreams.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..63057beba --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/usages.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..22da1431d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/variable.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2ae93d27a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-automation/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..8b172c072 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/webhook.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9b8ad8a48 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/account.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1701b2912 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/application.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0fe441880 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/applicationpackage.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e5e5c9d8e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..7ee2e0c72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/location.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8573f5005 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..372912538 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-batch/2017-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..9b65a1cac --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..25c6fa2d7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/invoices.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..03c32d20c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..32baa3a54 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3178c9828 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/periods.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fa923de26 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-billing/2017-04-24-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..bd5ca9d8b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..688927217 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a68b5c189 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dcc411e05 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f291f8c52 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f9fa1ff5c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c166a1b73 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0686ea319 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-cdn/2016-10-02" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..76cb1d4f9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/accounts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ba9db9424 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..e4ba9e691 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..2b04b63f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-cognitiveservices/2016-02-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..289d50cfe --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..1497c45d8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..2550c64ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/ratecard.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..4fe228405 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/usageaggregates.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..cfcd51a92 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-commerce/2015-06-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..738c2c61e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c60452b9d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..64f14dd08 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a9524daef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..97c53e0ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..862d94e25 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-compute/2016-04-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..fcd122704 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7a876cfef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6c090568f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..686b7ace2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..53700c8dd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..34e0934dc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c76b203e7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..54adcbaf1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..49e06fe8c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/models.go @@ -0,0 +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))) +} 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 new file mode 100755 index 000000000..d4d0b313d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f60768e73 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/usagedetails.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6a1aa180d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-consumption/2017-04-24-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..e5e99db67 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..66edd68c5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..a1694180c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fe03ba338 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ca7af7c6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-containerregistry/2017-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..7aefda8a8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..6fca953c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/containerservices.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..852420c66 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..8765e77b6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-containerservice/2017-01-31" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/client.go new file mode 100644 index 000000000..58e3e951d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/client.go @@ -0,0 +1,51 @@ +// Package cosmosdb implements the Azure ARM Cosmosdb service API version 2015-04-08. +// +// Azure Cosmos DB Database Service Resource Provider REST API +package cosmosdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Cosmosdb + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Cosmosdb. +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/cosmos-db/databaseaccounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/databaseaccounts.go new file mode 100644 index 000000000..f6c65d6a8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/databaseaccounts.go @@ -0,0 +1,1053 @@ +package cosmosdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is 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 Cosmos DB 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 Cosmos DB 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 cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "CheckNameExists") + } + + req, err := client.CheckNameExistsPreparer(accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameExistsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") + return + } + + result, err = client.CheckNameExistsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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 cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DatabaseAccount + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, createUpdateParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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 cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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 cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "FailoverPriorityChange") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.FailoverPriorityChangePreparer(resourceGroupName, accountName, failoverParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverPriorityChangeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "FailoverPriorityChange", resp, "Failure sending request") + return + } + + result, err = client.FailoverPriorityChangeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "ListConnectionStrings") + } + + req, err := client.ListConnectionStringsPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "ListReadOnlyKeys") + } + + req, err := client.ListReadOnlyKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") + return + } + + result, err = client.ListReadOnlyKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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 cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "Patch") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DatabaseAccount + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PatchPreparer(resourceGroupName, accountName, updateParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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, "cosmosdb.DatabaseAccountsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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 Cosmos DB 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 cosmos DB 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, "cosmosdb.DatabaseAccountsClient", "RegenerateKey") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, keyToRegenerate, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cosmosdb.DatabaseAccountsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cosmosdb.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/cosmos-db/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/models.go new file mode 100644 index 000000000..3fc98e79b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/models.go @@ -0,0 +1,197 @@ +package cosmosdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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" + // ConsistentPrefix specifies the consistent prefix state for default consistency level. + ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" + // 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 Cosmos DB database account. +type ConsistencyPolicy struct { + DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` + MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` + MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` +} + +// DatabaseAccount is an Azure Cosmos DB 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 Cosmos DB account +type DatabaseAccountConnectionString struct { + ConnectionString *string `json:"connectionString,omitempty"` + Description *string `json:"description,omitempty"` +} + +// DatabaseAccountCreateUpdateParameters is parameters to create and update Cosmos DB 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 Cosmos DB 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"` + EnableAutomaticFailover *bool `json:"enableAutomaticFailover,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 Cosmos DB 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"` + EnableAutomaticFailover *bool `json:"enableAutomaticFailover,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 Cosmos DB 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/cosmos-db/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/version.go new file mode 100644 index 000000000..fc21cb159 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cosmos-db/version.go @@ -0,0 +1,28 @@ +package cosmosdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-cosmosdb/2015-04-08" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..fb08c5a4d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/authorizationpolicies.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7161204a7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..fd13b7d69 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectormappings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..de3ff1d82 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectors.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..42becee80 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/hubs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c77ace5a9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/images.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1999cf078 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/interactions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7110ba198 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/kpi.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dcae7fcd1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/links.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8458d73cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..c323e8179 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/profiles.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6cac63649 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationshiplinks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..297835f2d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationships.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..22b898812 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roleassignments.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6f0bc7e77 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roles.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..35b9ec100 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-customerinsights/2017-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..6eaba3d70 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/views.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..120d613fb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/widgettypes.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e1791b1da --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/accountgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..41f91ac70 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..81bfb4243 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/datalakestoreaccounts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..deeb03252 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/firewallrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8ca7a8d2a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..d0f823938 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/storageaccounts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3f201d353 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-account/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..50042ad67 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/accountgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b48c790c3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..cd27b5ee1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/firewallrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c70781ff1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..9411268b3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/trustedidproviders.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3f201d353 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-account/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..1e017dc10 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/armtemplates.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..eaed0a1aa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifacts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..20b7306a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifactsources.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..65e59fad0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..0e4dcc256 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/costs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7cfdd5715 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/customimages.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6cf380933 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/disks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ee5f41fe7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/environments.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9c8572921 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/formulas.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..16df40fb4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/galleryimages.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8c5b5d076 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/globalschedules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0ed14dabb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/labs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5525e7f01 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f9acf5b38 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/notificationchannels.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7405b86e1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policies.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d61065502 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policysets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2a8ab3335 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/schedules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..598a7d065 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/secrets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5f473b636 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/servicerunners.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..86c22e8de --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/users.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..127a7972c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-devtestlabs/2016-05-15" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..bcd1f5194 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachines.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..509d9d03d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachineschedules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..148411c28 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualnetworks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8bab7acc1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..4f7fce74f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/disks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e8118696a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f4e5579d0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/snapshots.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..11c4a35ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-disk/2016-04-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..05ef36995 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..a95db4a29 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..8d3992dd6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dd8f8b73b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-dns/2016-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..31ad0ba36 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5c0752c01 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..7d4480742 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/databaseaccounts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..cc2d6de03 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..149f82054 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/version.go @@ -0,0 +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.2.0-beta arm-documentdb/2015-04-08" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..204ad6729 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..e9a194ba9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..359e0da10 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..299bb5e87 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..2f1f3bcbb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c86a01619 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f30757488 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-eventhub/2015-08-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100644 index 000000000..762e8c3d4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/check/check.go @@ -0,0 +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 = autorest.NewBearerAuthorizer(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 new file mode 100644 index 000000000..48ef886fd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/create/create.go @@ -0,0 +1,85 @@ +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" + "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 = autorest.NewBearerAuthorizer(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{}) + + _, errchan := ac.Create(resourceGroup, name, cp, cancel) + err = <-errchan + if 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/dns/README.md b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/README.md new file mode 100644 index 000000000..348aad4cd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/README.md @@ -0,0 +1,34 @@ +# Example Accessing the Azure DNS API + +## Prerequisites + +1. Create an Azure Resource Group. The code assumes `delete-dns` as the name: `az group create -l westus -n delete-dns` + +2. Create a Service Principal to access the resource group for example with the Azure CLI +``` +az ad sp create-for-rbac --role contributor --scopes /subscriptions//resourceGroups/delete-dns + +{ + "appId": "", + "displayName": "", + "name": "", + "password": "", + "tenant": "" +} +``` +3. Set the following environment variables from the service principal +- AZURE_CLIENT_ID= +- AZURE_CLIENT_SECRET= +- AZURE_SUBSCRIPTION_ID= +- AZURE_TENANT_ID= + +You can query the subscription id for your subscription with: `az account show --query id` + +4. Get the dependencies +- go get github.com/Azure/go-autorest/autorest +- go get github.com/Azure/go-autorest/autorest/azure +- github.com/Azure/azure-sdk-for-go/arm + +## Run the sample + +Execute with `go run create.go` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/create.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/create.go new file mode 100644 index 000000000..d8c9effe2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/create.go @@ -0,0 +1,194 @@ +package main + +import ( + "fmt" + "log" + "os" + + "github.com/Azure/azure-sdk-for-go/arm/dns" + "github.com/Azure/azure-sdk-for-go/arm/examples/helpers" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" +) + +func main() { + resourceGroup := "delete-dns" + + 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 + } + + dc := dns.NewZonesClient(c["AZURE_SUBSCRIPTION_ID"]) + dc.Authorizer = autorest.NewBearerAuthorizer(spt) + rc := dns.NewRecordSetsClient(c["AZURE_SUBSCRIPTION_ID"]) + rc.Authorizer = autorest.NewBearerAuthorizer(spt) + + newZoneName := "xtoph-test.local" + + zoneParam := &dns.Zone{ + Location: to.StringPtr("global"), + ZoneProperties: &dns.ZoneProperties{ + MaxNumberOfRecordSets: to.Int64Ptr(1), + NumberOfRecordSets: to.Int64Ptr(1), + // NameServers: [ "my-nameserver.xtoph.com" ] + }, + } + + newZone, err := dc.CreateOrUpdate(resourceGroup, newZoneName, *zoneParam, "", "") + if err != nil { + log.Fatalf("Couldn't create Zone %s Error: %v\n", newZoneName, err) + return + } + fmt.Printf("Status: %s\n", newZone.Status) + + fmt.Printf("New Zone Created\n") + + rrparams := &dns.RecordSet{ + RecordSetProperties: &dns.RecordSetProperties{ + TTL: to.Int64Ptr(1000), + ARecords: &[]dns.ARecord{ + {Ipv4Address: to.StringPtr("2.2.2.2")}, + }, + }, + } + + fmt.Printf("Creating A Rec\n") + + aRecName := "newTestARecordFromAPI" + _, err = rc.CreateOrUpdate(resourceGroup, newZoneName, aRecName, dns.A, *rrparams, "", "") + if err != nil { + log.Fatalf("Error creating Cname: %s, %v", newZoneName, err) + return + } + + cnameparams := &dns.RecordSet{ + RecordSetProperties: &dns.RecordSetProperties{ + TTL: to.Int64Ptr(1000), + CnameRecord: &dns.CnameRecord{ + Cname: to.StringPtr("my-new-cname"), + }, + }, + } + + fmt.Printf("Creating CName\n") + cnameRecordName := "newTestCNameRecordFromAPI" + _, err = rc.CreateOrUpdate(resourceGroup, newZoneName, cnameRecordName, dns.CNAME, *cnameparams, "", "") + if err != nil { + log.Fatalf("Error creating Cname: %s, %v", newZoneName, err) + return + } + + zone, err := dc.Get(resourceGroup, newZoneName) + + if err != nil { + log.Fatalf("Error getting zone: %s, %v", newZoneName, err) + return + } + + fmt.Printf("Nameservers for %s \n", *zone.Name) + + for _, ns := range *zone.NameServers { + fmt.Printf("%s\n", ns) + } + + fmt.Printf("Recordsets for %s \n", *zone.Name) + + var top int32 + top = 10 + rrsets, err := rc.ListByDNSZone(resourceGroup, newZoneName, &top) + if err != nil { + log.Fatalf("Error: %v", err) + return + } + + for _, rrset := range *rrsets.Value { + fmt.Printf("Recordset: %s Type: %s\n", *rrset.Name, *rrset.Type) + + switch *rrset.Type { + case "Microsoft.Network/dnszones/A": + printARecords(rrset) + case "Microsoft.Network/dnszones/CNAME": + printCNames(rrset) + case "Microsoft.Network/dnszones/NS": + printNS(rrset) + case "Microsoft.Network/dnszones/SOA": + printSOA(rrset) + } + } + + fmt.Printf("*** Cleaning up *** ") + rc.Delete(resourceGroup, newZoneName, cnameRecordName, dns.CNAME, "") + rc.Delete(resourceGroup, newZoneName, aRecName, dns.A, "") + dc.Delete(resourceGroup, newZoneName, "", nil) + fmt.Printf("done\n") + +} + +func printNS(rrset dns.RecordSet) { + fmt.Printf("*** NS Record ***\n") + if rrset.NsRecords != nil { + for _, ns := range *rrset.NsRecords { + fmt.Printf("Nameserver: %s\n", *ns.Nsdname) + } + } else { + fmt.Printf("*** None ***\n") + } +} + +func printSOA(rrset dns.RecordSet) { + fmt.Printf("*** SOA Record ***\n") + + if rrset.SoaRecord != nil { + fmt.Printf("Email: %s\n", *rrset.SoaRecord.Email) + fmt.Printf("Host: %s\n", *rrset.SoaRecord.Host) + } else { + fmt.Printf("*** None ***\n") + } + +} + +func printCNames(rrset dns.RecordSet) { + fmt.Printf("*** CNAME Record ***\n") + if rrset.CnameRecord != nil { + fmt.Printf("Cname %s\n", *rrset.CnameRecord.Cname) + } else { + fmt.Printf("*** None ***\n") + } + +} +func printARecords(rrset dns.RecordSet) { + fmt.Printf("*** A Records ***\n") + if rrset.ARecords != nil { + for _, arec := range *rrset.ARecords { + fmt.Printf("record %s\n", *arec.Ipv4Address) + } + } else { + fmt.Printf("*** None ***\n") + } + +} + +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/dns/paging/paging.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/paging/paging.go new file mode 100644 index 000000000..7d5744864 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns/paging/paging.go @@ -0,0 +1,201 @@ +package main + +import ( + "fmt" + "log" + "os" + "strconv" + + "github.com/Azure/azure-sdk-for-go/arm/dns" + "github.com/Azure/azure-sdk-for-go/arm/examples/helpers" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" +) + +func main() { + resourceGroup := "delete-dns" + + 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 + } + + dc := dns.NewZonesClient(c["AZURE_SUBSCRIPTION_ID"]) + dc.Authorizer = autorest.NewBearerAuthorizer(spt) + rc := dns.NewRecordSetsClient(c["AZURE_SUBSCRIPTION_ID"]) + rc.Authorizer = autorest.NewBearerAuthorizer(spt) + + newZoneName := "xtoph-test.local" + + zoneParam := &dns.Zone{ + Location: to.StringPtr("global"), + ZoneProperties: &dns.ZoneProperties{ + MaxNumberOfRecordSets: to.Int64Ptr(1), + NumberOfRecordSets: to.Int64Ptr(1), + }, + } + + newZone, err := dc.CreateOrUpdate(resourceGroup, newZoneName, *zoneParam, "", "") + if err != nil { + log.Fatalf("Couldn't create Zone %s Error: %v\n", newZoneName, err) + return + } + fmt.Printf("Status: %s\n", newZone.Status) + + fmt.Printf("New Zone Created\n") + + for i := 0; i < 12; i++ { + cnameRecordName := "www1" + strconv.Itoa(i) + cnameparams := &dns.RecordSet{ + Name: &cnameRecordName, + ID: &cnameRecordName, + RecordSetProperties: &dns.RecordSetProperties{ + TTL: to.Int64Ptr(1000), + CnameRecord: &dns.CnameRecord{ + Cname: to.StringPtr("alias." + newZoneName), + }, + }, + } + + fmt.Printf("Creating CName %q\n", cnameRecordName) + _, err = rc.CreateOrUpdate(resourceGroup, newZoneName, cnameRecordName, dns.CNAME, *cnameparams, "", "*") + if err != nil { + log.Fatalf("Error creating Cname: %s, %v", newZoneName, err) + break + } + } + + zone, err := dc.Get(resourceGroup, newZoneName) + + if err != nil { + log.Fatalf("Error getting zone: %s, %v", newZoneName, err) + return + } + + fmt.Printf("Nameservers for %s \n", *zone.Name) + + for _, ns := range *zone.NameServers { + fmt.Printf("%s\n", ns) + } + + fmt.Printf("Recordsets for %s \n", *zone.Name) + + var top int32 + top = 10 + page := 0 + rrsets := make([]dns.RecordSet, 0) + result, err := rc.ListByDNSZone(resourceGroup, newZoneName, &top) + if err != nil { + log.Fatalf("Error: %v", err) + return + } + appendListRecordSetsResult(&rrsets, result, &rc, &page) + + printResults(&rrsets) + + fmt.Printf("*** Cleaning up *** ") + defer dc.Delete(resourceGroup, newZoneName, "", nil) + fmt.Printf("done\n") +} + +func printResults(rrsets *[]dns.RecordSet) { + for _, rrset := range *rrsets { + fmt.Printf("Recordset: %s Type: %s\n", *rrset.Name, *rrset.Type) + switch *rrset.Type { + case "Microsoft.Network/dnszones/A": + printARecords(rrset) + case "Microsoft.Network/dnszones/CNAME": + printCNames(rrset) + case "Microsoft.Network/dnszones/NS": + printNS(rrset) + case "Microsoft.Network/dnszones/SOA": + printSOA(rrset) + } + } + + fmt.Printf("Got %d records\n", len(*rrsets)) + +} + +func appendListRecordSetsResult(rrsets *[]dns.RecordSet, result dns.RecordSetListResult, rc *dns.RecordSetsClient, page *int) { + for _, rset := range *result.Value { + *rrsets = append(*rrsets, rset) + } + + if result.NextLink != nil { + fmt.Printf("Fetching more from %q\n", *result.NextLink) + result, _ := rc.ListByDNSZoneNextResults(result) + // TODO Error handling + *page++ + appendListRecordSetsResult(rrsets, result, rc, page) + + } +} + +func printNS(rrset dns.RecordSet) { + fmt.Printf("*** NS Record ***\n") + if rrset.NsRecords != nil { + for _, ns := range *rrset.NsRecords { + fmt.Printf("Nameserver: %s\n", *ns.Nsdname) + } + } else { + fmt.Printf("*** None ***\n") + } +} + +func printSOA(rrset dns.RecordSet) { + fmt.Printf("*** SOA Record ***\n") + + if rrset.SoaRecord != nil { + fmt.Printf("Email: %s\n", *rrset.SoaRecord.Email) + fmt.Printf("Host: %s\n", *rrset.SoaRecord.Host) + } else { + fmt.Printf("*** None ***\n") + } + +} + +func printCNames(rrset dns.RecordSet) { + fmt.Printf("*** CNAME Record Name: %q ID: %q ***\n", *rrset.Name, *rrset.ID) + if rrset.CnameRecord != nil { + fmt.Printf("Cname %s\n", *rrset.CnameRecord.Cname) + } else { + fmt.Printf("*** None ***\n") + } + +} +func printARecords(rrset dns.RecordSet) { + fmt.Printf("*** A Record Name: %q ID: %q ***\n", *rrset.Name, *rrset.ID) + if rrset.ARecords != nil { + for _, arec := range *rrset.ARecords { + fmt.Printf("record %s\n", *arec.Ipv4Address) + } + } else { + fmt.Printf("*** None ***\n") + } + +} + +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 new file mode 100644 index 000000000..f883215ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/helpers/helpers.go @@ -0,0 +1,49 @@ +package helpers + +import ( + "encoding/json" + "fmt" + "github.com/Azure/go-autorest/autorest/adal" + "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) (*adal.ServicePrincipalToken, error) { + oauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, c["AZURE_TENANT_ID"]) + if err != nil { + panic(err) + } + return adal.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 new file mode 100755 index 000000000..cb0fad4d5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/applications.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..282c2af0d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..6c26e0805 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/groups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ab8775a72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..b0a7e94da --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/objects.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..57a173968 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/serviceprincipals.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5722cb92a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/users.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3ca0b1a59 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-graphrbac/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..c3a5cddc5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/applications.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f057af2d5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..69ec386f6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/clusters.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a1d3ee221 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/configurations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..348ef8368 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/extension.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8a94df775 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/location.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f151cb7d5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..ee3e33792 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9b5917edf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptactions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dd06c170c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptexecutionhistory.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..cee62675a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-hdinsight/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..5be1fc5e8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertruleincidents.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1e3e5f283 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f25b21070 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/autoscalesettings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1543209fb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..e17e1d470 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/logprofiles.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..06690e29a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..bd061a157 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/servicediagnosticsettings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..db406e42c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-insights/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..c9813666a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/android.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c5b0a0837 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..bcd4edd66 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/ios.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b43970f62 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..45ed1b5f6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-intune/2015-01-14-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..b54c132ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..6fa4abb25 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..83b970429 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/resource.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f7c0208c1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-iothub/2016-02-03" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..7bca66be4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..b0162c4b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..5b8c021ed --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/vaults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2be26bff3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-keyvault/2015-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..20a2bd1b9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/agreements.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..04f3e7596 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/certificates.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..673d79956 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9de0b8072 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/integrationaccounts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..40ca83df4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/maps.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..159cda6dc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f361cd261 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/partners.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a5ad456b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/schemas.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..aa7cf6012 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/sessions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..701c83a05 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-logic/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..e89d7c7f3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowrunactions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..57b8959c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowruns.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..521a2d458 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflows.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f83cf395e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggerhistories.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e374b14e9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9db33e9b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowversions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c4d5300c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..7e72a6103 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentassociations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d3ab0eb88 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentplansgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dc12d0ad6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..3fa496d08 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/usagehistory.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..25f9e609c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-commitmentplans/2016-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..24c7399fd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..c7235051d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..587565d58 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-webservices/2017-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..642b37e45 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/webservicesgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b67e498ad --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..ab632e05b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/mediaservice.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d8fa72549 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..8dbc133f2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-mediaservices/2015-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..5c91b67e2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/appcollections.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ddc0c7549 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/apps.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d1da83e0b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/campaigns.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c80e35de9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..2a221be15 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/devices.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8b7ab443d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/exporttasks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2fae682c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/importtasks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..92b9ad725 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f34b1e6e6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/supportedplatforms.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..76bdaab67 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-mobileengagement/2014-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..10e802176 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/activitylogalerts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5874e190f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertruleincidents.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..77771b880 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1dd707712 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/autoscalesettings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dc06b09f3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..0ed8686f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/logprofiles.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d10b4457a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..ead661a31 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/servicediagnosticsettings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..59985be48 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-monitor/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/client.go new file mode 100644 index 000000000..5608020c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/client.go @@ -0,0 +1,52 @@ +// Package mysql implements the Azure ARM Mysql service API version 2017-04-30-preview. +// +// The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources +// including servers, databases, firewall rules, log files and configurations. +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Mysql + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Mysql. +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/mysql/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/configurations.go new file mode 100644 index 000000000..065e9079f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/configurations.go @@ -0,0 +1,260 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +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)} +} + +// CreateOrUpdate updates a configuration of a 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. configurationName is the name of the +// server configuration. parameters is the required parameters for updating a server configuration. +func (client ConfigurationsClient) CreateOrUpdate(resourceGroupName string, serverName string, configurationName string, parameters Configuration, cancel <-chan struct{}) (<-chan Configuration, <-chan error) { + resultChan := make(chan Configuration, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Configuration + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, configurationName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationsClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, configurationName string, parameters Configuration, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforMySQL/servers/{serverName}/configurations/{configurationName}", 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 ConfigurationsClient) 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 ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result Configuration, 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 a configuration of 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. configurationName is the name of the +// server configuration. +func (client ConfigurationsClient) Get(resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.ConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationsClient) GetPreparer(resourceGroupName string, serverName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforMySQL/servers/{serverName}/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 Configuration, 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 list all the configurations in a given 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 ConfigurationsClient) ListByServer(resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ConfigurationsClient) 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 = "2017-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.DBforMySQL/servers/{serverName}/configurations", 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 ConfigurationsClient) 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 ConfigurationsClient) ListByServerResponder(resp *http.Response) (result ConfigurationListResult, 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/mysql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/databases.go new file mode 100644 index 000000000..f90bf8d5c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/databases.go @@ -0,0 +1,344 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality +// for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +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)} +} + +// CreateOrUpdate creates a new database or updates an existing 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. 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, databaseName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.DatabasesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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 +} + +// Delete deletes a 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. +func (client DatabasesClient) Delete(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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, databaseName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DatabasesClient) DeletePreparer(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 = "2017-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.DBforMySQL/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) 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 DatabasesClient) 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 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. +func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string) (result Database, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.DatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabasesClient) GetPreparer(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 = "2017-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.DBforMySQL/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 +} + +// ListByServer list all the databases in a given 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 DatabasesClient) ListByServer(resourceGroupName string, serverName string) (result DatabaseListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.DatabasesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client DatabasesClient) 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 = "2017-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.DBforMySQL/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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/firewallrules.go new file mode 100644 index 000000000..8b6301772 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/firewallrules.go @@ -0,0 +1,359 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is 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 Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +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 a new firewall rule or updates an existing firewall 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 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 +// server 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, cancel <-chan struct{}) (<-chan FirewallRule, <-chan error) { + resultChan := make(chan FirewallRule, 1) + errChan := make(chan error, 1) + 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: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, + {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "mysql.FirewallRulesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result FirewallRule + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, firewallRuleName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, cancel <-chan struct{}) (*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 = "2017-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.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, 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 server firewall 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 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 +// server firewall rule. +func (client FirewallRulesClient) Delete(resourceGroupName string, serverName string, firewallRuleName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, firewallRuleName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, serverName string, firewallRuleName string, cancel <-chan struct{}) (*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 = "2017-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.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) 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 a server 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 +// server 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, "mysql.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, "mysql.FirewallRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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 list all the firewall rules in a given 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 FirewallRulesClient) ListByServer(resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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/mysql/logfiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/logfiles.go new file mode 100644 index 000000000..19807f871 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/logfiles.go @@ -0,0 +1,106 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for +// Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +type LogFilesClient struct { + ManagementClient +} + +// NewLogFilesClient creates an instance of the LogFilesClient client. +func NewLogFilesClient(subscriptionID string) LogFilesClient { + return NewLogFilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogFilesClientWithBaseURI creates an instance of the LogFilesClient client. +func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFilesClient { + return LogFilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByServer list all the log files in a given 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 LogFilesClient) ListByServer(resourceGroupName string, serverName string) (result LogFileListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.LogFilesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.LogFilesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.LogFilesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client LogFilesClient) 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 = "2017-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.DBforMySQL/servers/{serverName}/logFiles", 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 LogFilesClient) 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 LogFilesClient) ListByServerResponder(resp *http.Response) (result LogFileListResult, 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/mysql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/models.go new file mode 100644 index 000000000..71983c769 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/models.go @@ -0,0 +1,418 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "errors" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// CreateMode enumerates the mode to create a new server +type CreateMode string + +const ( + // CreateModeDefault specifies the mode to create a new server + CreateModeDefault CreateMode = "Default" + // CreateModePointInTimeRestore specifies the mode to create a new server + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" +) + +// OperationOrigin enumerates the values for operation origin. +type OperationOrigin string + +const ( + // NotSpecified specifies the not specified state for operation origin. + NotSpecified OperationOrigin = "NotSpecified" + // System specifies the system state for operation origin. + System OperationOrigin = "system" + // User specifies the user state for operation origin. + User OperationOrigin = "user" +) + +// ServerState enumerates the values for server state. +type ServerState string + +const ( + // Disabled specifies the disabled state for server state. + Disabled ServerState = "Disabled" + // Dropping specifies the dropping state for server state. + Dropping ServerState = "Dropping" + // Ready specifies the ready state for server state. + Ready ServerState = "Ready" +) + +// ServerVersion enumerates the values for server version. +type ServerVersion string + +const ( + // FiveFullStopSeven specifies the five full stop seven state for server version. + FiveFullStopSeven ServerVersion = "5.7" + // FiveFullStopSix specifies the five full stop six state for server version. + FiveFullStopSix ServerVersion = "5.6" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic specifies the basic state for sku tier. + Basic SkuTier = "Basic" + // Standard specifies the standard state for sku tier. + Standard SkuTier = "Standard" +) + +// SslEnforcementEnum enumerates the values for ssl enforcement enum. +type SslEnforcementEnum string + +const ( + // SslEnforcementEnumDisabled specifies the ssl enforcement enum disabled state for ssl enforcement enum. + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + // SslEnforcementEnumEnabled specifies the ssl enforcement enum enabled state for ssl enforcement enum. + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +// Configuration is represents a Configuration. +type Configuration struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ConfigurationProperties `json:"properties,omitempty"` +} + +// ConfigurationListResult is a list of server configurations. +type ConfigurationListResult struct { + autorest.Response `json:"-"` + Value *[]Configuration `json:"value,omitempty"` +} + +// ConfigurationProperties is the properties of a configuration. +type ConfigurationProperties struct { + Value *string `json:"value,omitempty"` + Description *string `json:"description,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + DataType *string `json:"dataType,omitempty"` + AllowedValues *string `json:"allowedValues,omitempty"` + Source *string `json:"source,omitempty"` +} + +// 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"` + *DatabaseProperties `json:"properties,omitempty"` +} + +// DatabaseListResult is a List of databases. +type DatabaseListResult struct { + autorest.Response `json:"-"` + Value *[]Database `json:"value,omitempty"` +} + +// DatabaseProperties is the properties of a database. +type DatabaseProperties struct { + Charset *string `json:"charset,omitempty"` + Collation *string `json:"collation,omitempty"` +} + +// FirewallRule is represents a server firewall rule. +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 a list of firewall rules. +type FirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` +} + +// FirewallRuleProperties is the properties of a server firewall rule. +type FirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// LogFile is represents a log file. +type LogFile struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *LogFileProperties `json:"properties,omitempty"` +} + +// LogFileListResult is a list of log files. +type LogFileListResult struct { + autorest.Response `json:"-"` + Value *[]LogFile `json:"value,omitempty"` +} + +// LogFileProperties is the properties of a log file. +type LogFileProperties struct { + Name *string `json:"name,omitempty"` + SizeInKB *int64 `json:"sizeInKB,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Type *string `json:"type,omitempty"` + URL *string `json:"url,omitempty"` +} + +// Operation is REST API operation definition. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + Origin OperationOrigin `json:"origin,omitempty"` + Properties *map[string]*map[string]interface{} `json:"properties,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"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult is a list of resource provider operations. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// ProxyResource is resource properties. +type ProxyResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,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"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *ServerProperties `json:"properties,omitempty"` +} + +// ServerForCreate is represents a server to be created. +type ServerForCreate struct { + Sku *Sku `json:"sku,omitempty"` + Properties ServerPropertiesForCreate `json:"properties,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ServerForCreate model +func (sfc *ServerForCreate) UnmarshalJSON(b []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(b, &m) + if err != nil { + return err + } + + v := m["sku"] + if v != nil { + var sku Sku + err = json.Unmarshal(*m["sku"], &sku) + if err != nil { + return err + } + sfc.Sku = &sku + } + + v = m["properties"] + if v != nil { + p, err := unmarshalServerPropertiesForCreate(*m["properties"]) + if err != nil { + return err + } + sfc.Properties = p + } + + v = m["location"] + if v != nil { + var location string + err = json.Unmarshal(*m["location"], &location) + if err != nil { + return err + } + sfc.Location = &location + } + + v = m["tags"] + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*m["tags"], &tags) + if err != nil { + return err + } + sfc.Tags = &tags + } + + return nil +} + +func unmarshalServerPropertiesForCreate(b []byte) (ServerPropertiesForCreate, error) { + var m map[string]interface{} + err := json.Unmarshal(b, &m) + if err != nil { + return nil, err + } + + switch m["createMode"] { + case string(CreateModeDefault): + var spfdc ServerPropertiesForDefaultCreate + err := json.Unmarshal(b, &spfdc) + return spfdc, err + case string(CreateModePointInTimeRestore): + var spfr ServerPropertiesForRestore + err := json.Unmarshal(b, &spfr) + return spfr, err + default: + return nil, errors.New("Unsupported type") + } +} + +// ServerListResult is a list of servers. +type ServerListResult struct { + autorest.Response `json:"-"` + Value *[]Server `json:"value,omitempty"` +} + +// ServerProperties is the properties of a server. +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + UserVisibleState ServerState `json:"userVisibleState,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` +} + +// ServerPropertiesForCreate is interface used for polymorphic Properties in ServerForCreate +type ServerPropertiesForCreate interface { + AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) + AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) +} + +// ServerPropertiesForDefaultCreate is the properties used to create a new server. +type ServerPropertiesForDefaultCreate struct { + CreateMode CreateMode `json:"createMode,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate +func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { + spfdc.CreateMode = CreateModeDefault + type Alias ServerPropertiesForDefaultCreate + return json.Marshal(&struct { + Alias + }{ + Alias: (Alias)(spfdc), + }) +} + +// AsServerPropertiesForDefaultCreate is the IServerPropertiesForCreate for ServerPropertiesForDefaultCreate +func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { + return &spfdc, true +} + +// AsServerPropertiesForRestore is the IServerPropertiesForCreate for ServerPropertiesForDefaultCreate +func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { + return nil, false +} + +// ServerPropertiesForRestore is the properties to a new server by restoring from a backup. +type ServerPropertiesForRestore struct { + CreateMode CreateMode `json:"createMode,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + SourceServerID *string `json:"sourceServerId,omitempty"` + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerPropertiesForRestore +func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { + spfr.CreateMode = CreateModePointInTimeRestore + type Alias ServerPropertiesForRestore + return json.Marshal(&struct { + Alias + }{ + Alias: (Alias)(spfr), + }) +} + +// AsServerPropertiesForDefaultCreate is the IServerPropertiesForCreate for ServerPropertiesForRestore +func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { + return nil, false +} + +// AsServerPropertiesForRestore is the IServerPropertiesForCreate for ServerPropertiesForRestore +func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { + return &spfr, false +} + +// ServerUpdateParameters is parameters allowd to update for a server. +type ServerUpdateParameters struct { + Sku *Sku `json:"sku,omitempty"` + *ServerUpdateParametersProperties `json:"properties,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServerUpdateParametersProperties is the properties that can be updated for a server. +type ServerUpdateParametersProperties struct { + StorageMB *int64 `json:"storageMB,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` +} + +// Sku is billing information related properties of a server. +type Sku struct { + Name *string `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` +} + +// TrackedResource is resource properties including location and tags for track resources. +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"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/mysql_test.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/mysql_test.go new file mode 100644 index 000000000..cf3087c97 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/mysql_test.go @@ -0,0 +1,68 @@ +package mysql + +import ( + "encoding/json" + "testing" + + "github.com/Azure/go-autorest/autorest/to" + chk "gopkg.in/check.v1" +) + +// Hook up gocheck to testing +func Test(t *testing.T) { chk.TestingT(t) } + +type Suite struct{} + +var _ = chk.Suite(&Suite{}) + +var ( + body = `{ + "sku": { + "name": "SkuName", + "tier": "Basic", + "capacity": 100 + }, + "properties": { + "createMode": "Default", + "storageMB": 1024, + "sslEnforcement": "Enabled", + "administratorLogin": "cloudsa", + "administratorLoginPassword": "password" + }, + "location": "OneBox", + "tags": { + "ElasticServer": "1" + } +}` + sfc = ServerForCreate{ + Location: to.StringPtr("OneBox"), + Properties: ServerPropertiesForDefaultCreate{ + AdministratorLogin: to.StringPtr("cloudsa"), + AdministratorLoginPassword: to.StringPtr("password"), + StorageMB: to.Int64Ptr(1024), + SslEnforcement: SslEnforcementEnumEnabled, + CreateMode: CreateModeDefault, + }, + Sku: &Sku{ + Name: to.StringPtr("SkuName"), + Tier: Basic, + Capacity: to.Int32Ptr(100), + }, + Tags: &map[string]*string{ + "ElasticServer": to.StringPtr("1"), + }, + } +) + +func (s *Suite) TestUnmarshalServerForCreate(c *chk.C) { + var obtained ServerForCreate + err := json.Unmarshal([]byte(body), &obtained) + c.Assert(err, chk.IsNil) + c.Assert(obtained, chk.DeepEquals, sfc) +} + +func (s *Suite) TestMarshalServerForCreate(c *chk.C) { + b, err := json.MarshalIndent(sfc, "", " ") + c.Assert(err, chk.IsNil) + c.Assert(string(b), chk.Equals, body) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/operations.go new file mode 100644 index 000000000..6aa028ace --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/operations.go @@ -0,0 +1,97 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Microsoft Azure management API provides create, read, update, and delete functionality +// for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +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. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DBforMySQL/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/mysql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/servers.go new file mode 100644 index 000000000..bddf7b710 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/servers.go @@ -0,0 +1,503 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is 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 Microsoft Azure management API provides create, read, update, and delete functionality for +// Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +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 a new server or updates an existing server. The update action will overwrite the existing +// 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. parameters is the required +// parameters for creating or updating a server. +func (client ServersClient) CreateOrUpdate(resourceGroupName string, serverName string, parameters ServerForCreate, cancel <-chan struct{}) (<-chan Server, <-chan error) { + resultChan := make(chan Server, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.InclusiveMinimum, Rule: 1024, Chain: nil}}}, + }}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "mysql.ServersClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Server + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.ServersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServersClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, parameters ServerForCreate, 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 = "2017-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.DBforMySQL/servers/{serverName}", 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 ServersClient) 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 ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, 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 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. +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) + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about 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, "mysql.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, "mysql.ServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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 +} + +// List list all the servers in a given subscription. +func (client ServersClient) List() (result ServerListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.ServersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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 list all the servers in a given 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, "mysql.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, "mysql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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 = "2017-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.DBforMySQL/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 +} + +// Update updates an existing server. The request body can contain one to many of the properties present in the normal +// server definition. This method may poll for completion. Polling can be canceled by passing the 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 updating a server. +func (client ServersClient) Update(resourceGroupName string, serverName string, parameters ServerUpdateParameters, cancel <-chan struct{}) (<-chan Server, <-chan error) { + resultChan := make(chan Server, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Server + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, serverName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.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, "mysql.ServersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ServersClient) UpdatePreparer(resourceGroupName string, serverName string, parameters ServerUpdateParameters, 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 = "2017-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.DBforMySQL/servers/{serverName}", 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 ServersClient) 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 ServersClient) UpdateResponder(resp *http.Response) (result Server, 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/mysql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/version.go new file mode 100644 index 000000000..270855a39 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mysql/version.go @@ -0,0 +1,28 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-mysql/2017-04-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..4ab4e0734 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5024f5164 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/bgpservicecommunities.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ec5bf7ced --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..feb974fb9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitauthorizations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..28b926f24 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b60aa10a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..94db9a4f6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8918c08b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..11d649b27 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c1e66076e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..505691db0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..fbeb0d9ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/packetcaptures.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..896bc817d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..378a75bb2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilterrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..860ccae5c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilters.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1366d3c14 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..80339f207 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3faaf007f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2e2738605 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7d6ff882a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..34fa0df4b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b075ca676 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-network/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..13e1392d2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgatewayconnections.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..720978e83 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..27fafdfd0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..eab048c72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..28febf847 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/watchers.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..415ef6d66 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/client.go @@ -0,0 +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, + } +} 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 new file mode 100644 index 000000000..6ece95b23 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/models.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..9e6a89443 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/networkwatchers.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..4e6d35147 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/packetcaptures.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..52b97c2eb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/version.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f02acec65 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..bca8ddd1f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..ff473d09f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/namespaces.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..cbdd1c1f8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/notificationhubsgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ca846081a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-notificationhubs/2017-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..a42ac00b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..0a0653d0f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/datasources.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c7ef67562 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/linkedservices.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b4057b90c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..503cc1280 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-operationalinsights/2015-11-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..be4d9c1f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/workspaces.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/client.go new file mode 100644 index 000000000..68fd46c93 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/client.go @@ -0,0 +1,52 @@ +// Package postgresql implements the Azure ARM Postgresql service API version 2017-04-30-preview. +// +// The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL +// resources including servers, databases, firewall rules, log files and configurations. +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Postgresql + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Postgresql. +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/postgresql/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/configurations.go new file mode 100644 index 000000000..f088d19ff --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/configurations.go @@ -0,0 +1,261 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and +// configurations. +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)} +} + +// CreateOrUpdate updates a configuration of a 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. configurationName is the name of the +// server configuration. parameters is the required parameters for updating a server configuration. +func (client ConfigurationsClient) CreateOrUpdate(resourceGroupName string, serverName string, configurationName string, parameters Configuration, cancel <-chan struct{}) (<-chan Configuration, <-chan error) { + resultChan := make(chan Configuration, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Configuration + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, configurationName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationsClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, configurationName string, parameters Configuration, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}", 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 ConfigurationsClient) 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 ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result Configuration, 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 a configuration of 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. configurationName is the name of the +// server configuration. +func (client ConfigurationsClient) Get(resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.ConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationsClient) GetPreparer(resourceGroupName string, serverName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/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 Configuration, 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 list all the configurations in a given 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 ConfigurationsClient) ListByServer(resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ConfigurationsClient) 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 = "2017-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.DBforPostgreSQL/servers/{serverName}/configurations", 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 ConfigurationsClient) 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 ConfigurationsClient) ListByServerResponder(resp *http.Response) (result ConfigurationListResult, 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/postgresql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/databases.go new file mode 100644 index 000000000..610c4f265 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/databases.go @@ -0,0 +1,344 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality +// for Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +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)} +} + +// CreateOrUpdate creates a new database or updates an existing 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. 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, databaseName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.DatabasesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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 +} + +// Delete deletes a 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. +func (client DatabasesClient) Delete(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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, databaseName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DatabasesClient) DeletePreparer(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 = "2017-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.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) 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 DatabasesClient) 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 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. +func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string) (result Database, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.DatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabasesClient) GetPreparer(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 = "2017-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.DBforPostgreSQL/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 +} + +// ListByServer list all the databases in a given 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 DatabasesClient) ListByServer(resourceGroupName string, serverName string) (result DatabaseListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.DatabasesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client DatabasesClient) 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 = "2017-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.DBforPostgreSQL/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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/firewallrules.go new file mode 100644 index 000000000..e5f5d6c52 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/firewallrules.go @@ -0,0 +1,360 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is 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 Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and +// configurations. +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 a new firewall rule or updates an existing firewall 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 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 +// server 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, cancel <-chan struct{}) (<-chan FirewallRule, <-chan error) { + resultChan := make(chan FirewallRule, 1) + errChan := make(chan error, 1) + 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: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, + {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "postgresql.FirewallRulesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result FirewallRule + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, firewallRuleName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, cancel <-chan struct{}) (*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 = "2017-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.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, 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 server firewall 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 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 +// server firewall rule. +func (client FirewallRulesClient) Delete(resourceGroupName string, serverName string, firewallRuleName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, firewallRuleName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, serverName string, firewallRuleName string, cancel <-chan struct{}) (*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 = "2017-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.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) 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 a server 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 +// server 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, "postgresql.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, "postgresql.FirewallRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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 list all the firewall rules in a given 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 FirewallRulesClient) ListByServer(resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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/postgresql/logfiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/logfiles.go new file mode 100644 index 000000000..50db7f555 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/logfiles.go @@ -0,0 +1,106 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for +// Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +type LogFilesClient struct { + ManagementClient +} + +// NewLogFilesClient creates an instance of the LogFilesClient client. +func NewLogFilesClient(subscriptionID string) LogFilesClient { + return NewLogFilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogFilesClientWithBaseURI creates an instance of the LogFilesClient client. +func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFilesClient { + return LogFilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByServer list all the log files in a given 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 LogFilesClient) ListByServer(resourceGroupName string, serverName string) (result LogFileListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.LogFilesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresql.LogFilesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.LogFilesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client LogFilesClient) 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 = "2017-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.DBforPostgreSQL/servers/{serverName}/logFiles", 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 LogFilesClient) 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 LogFilesClient) ListByServerResponder(resp *http.Response) (result LogFileListResult, 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/postgresql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/models.go new file mode 100644 index 000000000..dae190e4e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/models.go @@ -0,0 +1,418 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "errors" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// CreateMode enumerates the mode to create a new server +type CreateMode string + +const ( + // CreateModeDefault specifies the mode to create a new server + CreateModeDefault CreateMode = "Default" + // CreateModePointInTimeRestore specifies the mode to create a new server + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" +) + +// OperationOrigin enumerates the values for operation origin. +type OperationOrigin string + +const ( + // NotSpecified specifies the not specified state for operation origin. + NotSpecified OperationOrigin = "NotSpecified" + // System specifies the system state for operation origin. + System OperationOrigin = "system" + // User specifies the user state for operation origin. + User OperationOrigin = "user" +) + +// ServerState enumerates the values for server state. +type ServerState string + +const ( + // Disabled specifies the disabled state for server state. + Disabled ServerState = "Disabled" + // Dropping specifies the dropping state for server state. + Dropping ServerState = "Dropping" + // Ready specifies the ready state for server state. + Ready ServerState = "Ready" +) + +// ServerVersion enumerates the values for server version. +type ServerVersion string + +const ( + // NineFullStopFive specifies the nine full stop five state for server version. + NineFullStopFive ServerVersion = "9.5" + // NineFullStopSix specifies the nine full stop six state for server version. + NineFullStopSix ServerVersion = "9.6" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic specifies the basic state for sku tier. + Basic SkuTier = "Basic" + // Standard specifies the standard state for sku tier. + Standard SkuTier = "Standard" +) + +// SslEnforcementEnum enumerates the values for ssl enforcement enum. +type SslEnforcementEnum string + +const ( + // SslEnforcementEnumDisabled specifies the ssl enforcement enum disabled state for ssl enforcement enum. + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + // SslEnforcementEnumEnabled specifies the ssl enforcement enum enabled state for ssl enforcement enum. + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +// Configuration is represents a Configuration. +type Configuration struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ConfigurationProperties `json:"properties,omitempty"` +} + +// ConfigurationListResult is a list of server configurations. +type ConfigurationListResult struct { + autorest.Response `json:"-"` + Value *[]Configuration `json:"value,omitempty"` +} + +// ConfigurationProperties is the properties of a configuration. +type ConfigurationProperties struct { + Value *string `json:"value,omitempty"` + Description *string `json:"description,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + DataType *string `json:"dataType,omitempty"` + AllowedValues *string `json:"allowedValues,omitempty"` + Source *string `json:"source,omitempty"` +} + +// 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"` + *DatabaseProperties `json:"properties,omitempty"` +} + +// DatabaseListResult is a List of databases. +type DatabaseListResult struct { + autorest.Response `json:"-"` + Value *[]Database `json:"value,omitempty"` +} + +// DatabaseProperties is the properties of a database. +type DatabaseProperties struct { + Charset *string `json:"charset,omitempty"` + Collation *string `json:"collation,omitempty"` +} + +// FirewallRule is represents a server firewall rule. +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 a list of firewall rules. +type FirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` +} + +// FirewallRuleProperties is the properties of a server firewall rule. +type FirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// LogFile is represents a log file. +type LogFile struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *LogFileProperties `json:"properties,omitempty"` +} + +// LogFileListResult is a list of log files. +type LogFileListResult struct { + autorest.Response `json:"-"` + Value *[]LogFile `json:"value,omitempty"` +} + +// LogFileProperties is the properties of a log file. +type LogFileProperties struct { + Name *string `json:"name,omitempty"` + SizeInKB *int64 `json:"sizeInKB,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Type *string `json:"type,omitempty"` + URL *string `json:"url,omitempty"` +} + +// Operation is REST API operation definition. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + Origin OperationOrigin `json:"origin,omitempty"` + Properties *map[string]*map[string]interface{} `json:"properties,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"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult is a list of resource provider operations. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// ProxyResource is resource properties. +type ProxyResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,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"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *ServerProperties `json:"properties,omitempty"` +} + +// ServerForCreate is represents a server to be created. +type ServerForCreate struct { + Sku *Sku `json:"sku,omitempty"` + Properties ServerPropertiesForCreate `json:"properties,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ServerForCreate model +func (sfc *ServerForCreate) UnmarshalJSON(b []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(b, &m) + if err != nil { + return err + } + + v := m["sku"] + if v != nil { + var sku Sku + err = json.Unmarshal(*m["sku"], &sku) + if err != nil { + return err + } + sfc.Sku = &sku + } + + v = m["properties"] + if v != nil { + p, err := unmarshalServerPropertiesForCreate(*m["properties"]) + if err != nil { + return err + } + sfc.Properties = p + } + + v = m["location"] + if v != nil { + var location string + err = json.Unmarshal(*m["location"], &location) + if err != nil { + return err + } + sfc.Location = &location + } + + v = m["tags"] + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*m["tags"], &tags) + if err != nil { + return err + } + sfc.Tags = &tags + } + + return nil +} + +func unmarshalServerPropertiesForCreate(b []byte) (ServerPropertiesForCreate, error) { + var m map[string]interface{} + err := json.Unmarshal(b, &m) + if err != nil { + return nil, err + } + + switch m["createMode"] { + case string(CreateModeDefault): + var spfdc ServerPropertiesForDefaultCreate + err := json.Unmarshal(b, &spfdc) + return spfdc, err + case string(CreateModePointInTimeRestore): + var spfr ServerPropertiesForRestore + err := json.Unmarshal(b, &spfr) + return spfr, err + default: + return nil, errors.New("Unsupported type") + } +} + +// ServerListResult is a list of servers. +type ServerListResult struct { + autorest.Response `json:"-"` + Value *[]Server `json:"value,omitempty"` +} + +// ServerProperties is the properties of a server. +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + UserVisibleState ServerState `json:"userVisibleState,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` +} + +// ServerPropertiesForCreate is interface used for polymorphic Properties in ServerForCreate +type ServerPropertiesForCreate interface { + AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) + AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) +} + +// ServerPropertiesForDefaultCreate is the properties used to create a new server. +type ServerPropertiesForDefaultCreate struct { + CreateMode CreateMode `json:"createMode,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate +func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { + spfdc.CreateMode = CreateModeDefault + type Alias ServerPropertiesForDefaultCreate + return json.Marshal(&struct { + Alias + }{ + Alias: (Alias)(spfdc), + }) +} + +// AsServerPropertiesForDefaultCreate is the IServerPropertiesForCreate for ServerPropertiesForDefaultCreate +func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { + return &spfdc, true +} + +// AsServerPropertiesForRestore is the IServerPropertiesForCreate for ServerPropertiesForDefaultCreate +func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { + return nil, false +} + +// ServerPropertiesForRestore is the properties to a new server by restoring from a backup. +type ServerPropertiesForRestore struct { + CreateMode CreateMode `json:"createMode,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + SourceServerID *string `json:"sourceServerId,omitempty"` + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerPropertiesForRestore +func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { + spfr.CreateMode = CreateModePointInTimeRestore + type Alias ServerPropertiesForRestore + return json.Marshal(&struct { + Alias + }{ + Alias: (Alias)(spfr), + }) +} + +// AsServerPropertiesForDefaultCreate is the IServerPropertiesForCreate for ServerPropertiesForRestore +func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { + return nil, false +} + +// AsServerPropertiesForRestore is the IServerPropertiesForCreate for ServerPropertiesForRestore +func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { + return &spfr, false +} + +// ServerUpdateParameters is parameters allowd to update for a server. +type ServerUpdateParameters struct { + Sku *Sku `json:"sku,omitempty"` + *ServerUpdateParametersProperties `json:"properties,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServerUpdateParametersProperties is the properties that can be updated for a server. +type ServerUpdateParametersProperties struct { + StorageMB *int64 `json:"storageMB,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + Version ServerVersion `json:"version,omitempty"` + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` +} + +// Sku is billing information related properties of a server. +type Sku struct { + Name *string `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` +} + +// TrackedResource is resource properties including location and tags for track resources. +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"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/operations.go new file mode 100644 index 000000000..18ce26ed1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/operations.go @@ -0,0 +1,97 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Microsoft Azure management API provides create, read, update, and delete functionality +// for Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +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. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DBforPostgreSQL/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/postgresql/postgresql_test.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/postgresql_test.go new file mode 100644 index 000000000..168b4dfba --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/postgresql_test.go @@ -0,0 +1,68 @@ +package postgresql + +import ( + "encoding/json" + "testing" + + "github.com/Azure/go-autorest/autorest/to" + chk "gopkg.in/check.v1" +) + +// Hook up gocheck to testing +func Test(t *testing.T) { chk.TestingT(t) } + +type Suite struct{} + +var _ = chk.Suite(&Suite{}) + +var ( + body = `{ + "sku": { + "name": "SkuName", + "tier": "Basic", + "capacity": 100 + }, + "properties": { + "createMode": "Default", + "storageMB": 1024, + "sslEnforcement": "Enabled", + "administratorLogin": "cloudsa", + "administratorLoginPassword": "password" + }, + "location": "OneBox", + "tags": { + "ElasticServer": "1" + } +}` + sfc = ServerForCreate{ + Location: to.StringPtr("OneBox"), + Properties: ServerPropertiesForDefaultCreate{ + AdministratorLogin: to.StringPtr("cloudsa"), + AdministratorLoginPassword: to.StringPtr("password"), + StorageMB: to.Int64Ptr(1024), + SslEnforcement: SslEnforcementEnumEnabled, + CreateMode: CreateModeDefault, + }, + Sku: &Sku{ + Name: to.StringPtr("SkuName"), + Tier: Basic, + Capacity: to.Int32Ptr(100), + }, + Tags: &map[string]*string{ + "ElasticServer": to.StringPtr("1"), + }, + } +) + +func (s *Suite) TestUnmarshalServerForCreate(c *chk.C) { + var obtained ServerForCreate + err := json.Unmarshal([]byte(body), &obtained) + c.Assert(err, chk.IsNil) + c.Assert(obtained, chk.DeepEquals, sfc) +} + +func (s *Suite) TestMarshalServerForCreate(c *chk.C) { + b, err := json.MarshalIndent(sfc, "", " ") + c.Assert(err, chk.IsNil) + c.Assert(string(b), chk.Equals, body) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/servers.go new file mode 100644 index 000000000..7143cc0f8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/servers.go @@ -0,0 +1,503 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is 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 Microsoft Azure management API provides create, read, update, and delete functionality for +// Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +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 a new server or updates an existing server. The update action will overwrite the existing +// 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. parameters is the required +// parameters for creating or updating a server. +func (client ServersClient) CreateOrUpdate(resourceGroupName string, serverName string, parameters ServerForCreate, cancel <-chan struct{}) (<-chan Server, <-chan error) { + resultChan := make(chan Server, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.InclusiveMinimum, Rule: 1024, Chain: nil}}}, + }}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "postgresql.ServersClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Server + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.ServersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServersClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, parameters ServerForCreate, 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 = "2017-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.DBforPostgreSQL/servers/{serverName}", 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 ServersClient) 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 ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, 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 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. +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) + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about 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, "postgresql.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, "postgresql.ServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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 +} + +// List list all the servers in a given subscription. +func (client ServersClient) List() (result ServerListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.ServersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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 list all the servers in a given 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, "postgresql.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, "postgresql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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 = "2017-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.DBforPostgreSQL/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 +} + +// Update updates an existing server. The request body can contain one to many of the properties present in the normal +// server definition. This method may poll for completion. Polling can be canceled by passing the 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 updating a server. +func (client ServersClient) Update(resourceGroupName string, serverName string, parameters ServerUpdateParameters, cancel <-chan struct{}) (<-chan Server, <-chan error) { + resultChan := make(chan Server, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Server + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, serverName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.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, "postgresql.ServersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ServersClient) UpdatePreparer(resourceGroupName string, serverName string, parameters ServerUpdateParameters, 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 = "2017-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.DBforPostgreSQL/servers/{serverName}", 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 ServersClient) 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 ServersClient) UpdateResponder(resp *http.Response) (result Server, 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/postgresql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/version.go new file mode 100644 index 000000000..104618ff5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/postgresql/version.go @@ -0,0 +1,28 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-postgresql/2017-04-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} 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 new file mode 100755 index 000000000..25116e7e2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c89e648da --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..c556b8cd6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-powerbiembedded/2016-01-29" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..77a3c749b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspacecollections.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a34b282a6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspaces.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..98b156452 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..0117b9bf7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..7e0a9cedc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9c2ca76a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaultextendedinfo.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dbbd47d8c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e3702ef21 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-recoveryservices/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..4d3c2156f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupengines.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..636cd364d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupjobs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8167c53b6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9a5f14ba3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationstatuses.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..2c81779a0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backuppolicies.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c8008db70 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectableitems.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..171dd82b9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotecteditems.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..73611a215 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectioncontainers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0a495b1bd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcestorageconfigs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..65c97f7ae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcevaultconfigs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..92587608d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..859a13680 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupusagesummaries.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..94e5c4045 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..e99b12c6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/exportjobsoperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..4df44e0ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/itemlevelrecoveryconnections.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..03f04be3c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobcancellations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b7bd259c0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobdetails.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7e7c24965 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/joboperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e505fe307 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..153523c88 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..4c70df134 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e4c9f881a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6e80f9b7e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationstatuses.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8edf293e7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditems.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c1d16a743 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontaineroperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e8ff5422a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainerrefreshoperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0b04ff18c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..21c790f82 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicies.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7fb4fe4e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationresults.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6fdb8e9bf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationstatuses.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..185ed0224 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/recoverypoints.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..17cb5c4be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/restores.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..78d89bdc9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/securitypins.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..cc0c914da --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-recoveryservicesbackup/2016-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/client.go new file mode 100644 index 000000000..306afcc27 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/client.go @@ -0,0 +1,56 @@ +// Package recoveryservicessiterecovery implements the Azure ARM Recoveryservicessiterecovery service API version +// 2016-08-10. +// +// +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Recoveryservicessiterecovery + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Recoveryservicessiterecovery. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string + ResourceGroupName string + ResourceName string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string, resourceGroupName string, resourceName string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/models.go new file mode 100644 index 000000000..20115820e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/models.go @@ -0,0 +1,2832 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause 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" +) + +// A2ARpRecoveryPointType enumerates the values for a2a rp recovery point type. +type A2ARpRecoveryPointType string + +const ( + // Latest specifies the latest state for a2a rp recovery point type. + Latest A2ARpRecoveryPointType = "Latest" + // LatestApplicationConsistent specifies the latest application consistent state for a2a rp recovery point type. + LatestApplicationConsistent A2ARpRecoveryPointType = "LatestApplicationConsistent" + // LatestCrashConsistent specifies the latest crash consistent state for a2a rp recovery point type. + LatestCrashConsistent A2ARpRecoveryPointType = "LatestCrashConsistent" + // LatestProcessed specifies the latest processed state for a2a rp recovery point type. + LatestProcessed A2ARpRecoveryPointType = "LatestProcessed" +) + +// AlternateLocationRecoveryOption enumerates the values for alternate location recovery option. +type AlternateLocationRecoveryOption string + +const ( + // CreateVMIfNotFound specifies the create vm if not found state for alternate location recovery option. + CreateVMIfNotFound AlternateLocationRecoveryOption = "CreateVmIfNotFound" + // NoAction specifies the no action state for alternate location recovery option. + NoAction AlternateLocationRecoveryOption = "NoAction" +) + +// DataSyncStatus enumerates the values for data sync status. +type DataSyncStatus string + +const ( + // ForDownTime specifies the for down time state for data sync status. + ForDownTime DataSyncStatus = "ForDownTime" + // ForSynchronization specifies the for synchronization state for data sync status. + ForSynchronization DataSyncStatus = "ForSynchronization" +) + +// DisableProtectionReason enumerates the values for disable protection reason. +type DisableProtectionReason string + +const ( + // MigrationComplete specifies the migration complete state for disable protection reason. + MigrationComplete DisableProtectionReason = "MigrationComplete" + // NotSpecified specifies the not specified state for disable protection reason. + NotSpecified DisableProtectionReason = "NotSpecified" +) + +// FailoverDeploymentModel enumerates the values for failover deployment model. +type FailoverDeploymentModel string + +const ( + // Classic specifies the classic state for failover deployment model. + Classic FailoverDeploymentModel = "Classic" + // NotApplicable specifies the not applicable state for failover deployment model. + NotApplicable FailoverDeploymentModel = "NotApplicable" + // ResourceManager specifies the resource manager state for failover deployment model. + ResourceManager FailoverDeploymentModel = "ResourceManager" +) + +// HyperVReplicaAzureRpRecoveryPointType enumerates the values for hyper v replica azure rp recovery point type. +type HyperVReplicaAzureRpRecoveryPointType string + +const ( + // HyperVReplicaAzureRpRecoveryPointTypeLatest specifies the hyper v replica azure rp recovery point type latest + // state for hyper v replica azure rp recovery point type. + HyperVReplicaAzureRpRecoveryPointTypeLatest HyperVReplicaAzureRpRecoveryPointType = "Latest" + // HyperVReplicaAzureRpRecoveryPointTypeLatestApplicationConsistent specifies the hyper v replica azure rp recovery + // point type latest application consistent state for hyper v replica azure rp recovery point type. + HyperVReplicaAzureRpRecoveryPointTypeLatestApplicationConsistent HyperVReplicaAzureRpRecoveryPointType = "LatestApplicationConsistent" + // HyperVReplicaAzureRpRecoveryPointTypeLatestProcessed specifies the hyper v replica azure rp recovery point type + // latest processed state for hyper v replica azure rp recovery point type. + HyperVReplicaAzureRpRecoveryPointTypeLatestProcessed HyperVReplicaAzureRpRecoveryPointType = "LatestProcessed" +) + +// InMageV2RpRecoveryPointType enumerates the values for in mage v2 rp recovery point type. +type InMageV2RpRecoveryPointType string + +const ( + // InMageV2RpRecoveryPointTypeLatest specifies the in mage v2 rp recovery point type latest state for in mage v2 rp + // recovery point type. + InMageV2RpRecoveryPointTypeLatest InMageV2RpRecoveryPointType = "Latest" + // InMageV2RpRecoveryPointTypeLatestApplicationConsistent specifies the in mage v2 rp recovery point type latest + // application consistent state for in mage v2 rp recovery point type. + InMageV2RpRecoveryPointTypeLatestApplicationConsistent InMageV2RpRecoveryPointType = "LatestApplicationConsistent" + // InMageV2RpRecoveryPointTypeLatestCrashConsistent specifies the in mage v2 rp recovery point type latest crash + // consistent state for in mage v2 rp recovery point type. + InMageV2RpRecoveryPointTypeLatestCrashConsistent InMageV2RpRecoveryPointType = "LatestCrashConsistent" + // InMageV2RpRecoveryPointTypeLatestProcessed specifies the in mage v2 rp recovery point type latest processed + // state for in mage v2 rp recovery point type. + InMageV2RpRecoveryPointTypeLatestProcessed InMageV2RpRecoveryPointType = "LatestProcessed" +) + +// LicenseType enumerates the values for license type. +type LicenseType string + +const ( + // LicenseTypeNoLicenseType specifies the license type no license type state for license type. + LicenseTypeNoLicenseType LicenseType = "NoLicenseType" + // LicenseTypeNotSpecified specifies the license type not specified state for license type. + LicenseTypeNotSpecified LicenseType = "NotSpecified" + // LicenseTypeWindowsServer specifies the license type windows server state for license type. + LicenseTypeWindowsServer LicenseType = "WindowsServer" +) + +// PossibleOperationsDirections enumerates the values for possible operations directions. +type PossibleOperationsDirections string + +const ( + // PrimaryToRecovery specifies the primary to recovery state for possible operations directions. + PrimaryToRecovery PossibleOperationsDirections = "PrimaryToRecovery" + // RecoveryToPrimary specifies the recovery to primary state for possible operations directions. + RecoveryToPrimary PossibleOperationsDirections = "RecoveryToPrimary" +) + +// RecoveryPlanActionLocation enumerates the values for recovery plan action location. +type RecoveryPlanActionLocation string + +const ( + // Primary specifies the primary state for recovery plan action location. + Primary RecoveryPlanActionLocation = "Primary" + // Recovery specifies the recovery state for recovery plan action location. + Recovery RecoveryPlanActionLocation = "Recovery" +) + +// RecoveryPlanGroupType enumerates the values for recovery plan group type. +type RecoveryPlanGroupType string + +const ( + // Boot specifies the boot state for recovery plan group type. + Boot RecoveryPlanGroupType = "Boot" + // Failover specifies the failover state for recovery plan group type. + Failover RecoveryPlanGroupType = "Failover" + // Shutdown specifies the shutdown state for recovery plan group type. + Shutdown RecoveryPlanGroupType = "Shutdown" +) + +// ReplicationProtectedItemOperation enumerates the values for replication protected item operation. +type ReplicationProtectedItemOperation string + +const ( + // ChangePit specifies the change pit state for replication protected item operation. + ChangePit ReplicationProtectedItemOperation = "ChangePit" + // Commit specifies the commit state for replication protected item operation. + Commit ReplicationProtectedItemOperation = "Commit" + // CompleteMigration specifies the complete migration state for replication protected item operation. + CompleteMigration ReplicationProtectedItemOperation = "CompleteMigration" + // DisableProtection specifies the disable protection state for replication protected item operation. + DisableProtection ReplicationProtectedItemOperation = "DisableProtection" + // Failback specifies the failback state for replication protected item operation. + Failback ReplicationProtectedItemOperation = "Failback" + // FinalizeFailback specifies the finalize failback state for replication protected item operation. + FinalizeFailback ReplicationProtectedItemOperation = "FinalizeFailback" + // PlannedFailover specifies the planned failover state for replication protected item operation. + PlannedFailover ReplicationProtectedItemOperation = "PlannedFailover" + // RepairReplication specifies the repair replication state for replication protected item operation. + RepairReplication ReplicationProtectedItemOperation = "RepairReplication" + // ReverseReplicate specifies the reverse replicate state for replication protected item operation. + ReverseReplicate ReplicationProtectedItemOperation = "ReverseReplicate" + // SwitchProtection specifies the switch protection state for replication protected item operation. + SwitchProtection ReplicationProtectedItemOperation = "SwitchProtection" + // TestFailover specifies the test failover state for replication protected item operation. + TestFailover ReplicationProtectedItemOperation = "TestFailover" + // TestFailoverCleanup specifies the test failover cleanup state for replication protected item operation. + TestFailoverCleanup ReplicationProtectedItemOperation = "TestFailoverCleanup" + // UnplannedFailover specifies the unplanned failover state for replication protected item operation. + UnplannedFailover ReplicationProtectedItemOperation = "UnplannedFailover" +) + +// RpInMageRecoveryPointType enumerates the values for rp in mage recovery point type. +type RpInMageRecoveryPointType string + +const ( + // Custom specifies the custom state for rp in mage recovery point type. + Custom RpInMageRecoveryPointType = "Custom" + // LatestTag specifies the latest tag state for rp in mage recovery point type. + LatestTag RpInMageRecoveryPointType = "LatestTag" + // LatestTime specifies the latest time state for rp in mage recovery point type. + LatestTime RpInMageRecoveryPointType = "LatestTime" +) + +// SetMultiVMSyncStatus enumerates the values for set multi vm sync status. +type SetMultiVMSyncStatus string + +const ( + // Disable specifies the disable state for set multi vm sync status. + Disable SetMultiVMSyncStatus = "Disable" + // Enable specifies the enable state for set multi vm sync status. + Enable SetMultiVMSyncStatus = "Enable" +) + +// SourceSiteOperations enumerates the values for source site operations. +type SourceSiteOperations string + +const ( + // NotRequired specifies the not required state for source site operations. + NotRequired SourceSiteOperations = "NotRequired" + // Required specifies the required state for source site operations. + Required SourceSiteOperations = "Required" +) + +// A2AApplyRecoveryPointInput is applyRecoveryPoint input specific to A2A provider. +type A2AApplyRecoveryPointInput struct { +} + +// A2AContainerCreationInput is a2A cloud creation input. +type A2AContainerCreationInput struct { +} + +// A2AEnableProtectionInput is a2A enable protection input. +type A2AEnableProtectionInput struct { + FabricObjectID *string `json:"fabricObjectId,omitempty"` + RecoveryContainerID *string `json:"recoveryContainerId,omitempty"` + RecoveryResourceGroupID *string `json:"recoveryResourceGroupId,omitempty"` + RecoveryCloudServiceID *string `json:"recoveryCloudServiceId,omitempty"` + RecoveryAvailabilitySetID *string `json:"recoveryAvailabilitySetId,omitempty"` + VMDisks *[]A2AVMDiskInputDetails `json:"vmDisks,omitempty"` +} + +// A2AEventDetails is model class for event details of a A2A event. +type A2AEventDetails struct { + ProtectedItemName *string `json:"protectedItemName,omitempty"` + FabricObjectID *string `json:"fabricObjectId,omitempty"` + FabricName *string `json:"fabricName,omitempty"` + FabricLocation *string `json:"fabricLocation,omitempty"` + RemoteFabricName *string `json:"remoteFabricName,omitempty"` + RemoteFabricLocation *string `json:"remoteFabricLocation,omitempty"` +} + +// A2AFailoverProviderInput is a2A provider specific input for failover. +type A2AFailoverProviderInput struct { + RecoveryPointID *string `json:"recoveryPointId,omitempty"` + CloudServiceCreationOption *string `json:"cloudServiceCreationOption,omitempty"` +} + +// A2APolicyCreationInput is a2A Policy creation input. +type A2APolicyCreationInput struct { + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + CrashConsistentFrequencyInMinutes *int32 `json:"crashConsistentFrequencyInMinutes,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus SetMultiVMSyncStatus `json:"multiVmSyncStatus,omitempty"` +} + +// A2APolicyDetails is a2A specific policy details. +type A2APolicyDetails struct { + RecoveryPointThresholdInMinutes *int32 `json:"recoveryPointThresholdInMinutes,omitempty"` + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus *string `json:"multiVmSyncStatus,omitempty"` + CrashConsistentFrequencyInMinutes *int32 `json:"crashConsistentFrequencyInMinutes,omitempty"` +} + +// A2AProtectedDiskDetails is a2A protected disk details. +type A2AProtectedDiskDetails struct { + DiskURI *string `json:"diskUri,omitempty"` + DiskName *string `json:"diskName,omitempty"` + DiskCapacityInBytes *int64 `json:"diskCapacityInBytes,omitempty"` + RecoveryAzureStorageAccountID *string `json:"recoveryAzureStorageAccountId,omitempty"` + PrimaryStagingAzureStorageAccountID *string `json:"primaryStagingAzureStorageAccountId,omitempty"` + PrimaryDiskAzureStorageAccountID *string `json:"primaryDiskAzureStorageAccountId,omitempty"` + RecoveryDiskURI *string `json:"recoveryDiskUri,omitempty"` + DiskType *string `json:"diskType,omitempty"` + ResyncRequired *bool `json:"resyncRequired,omitempty"` + MonitoringPercentageCompletion *int32 `json:"monitoringPercentageCompletion,omitempty"` + MonitoringJobType *string `json:"monitoringJobType,omitempty"` + DataPendingInStagingStorageAccountInMB *float64 `json:"dataPendingInStagingStorageAccountInMB,omitempty"` + DataPendingAtSourceAgentInMB *float64 `json:"dataPendingAtSourceAgentInMB,omitempty"` +} + +// A2AReplicationDetails is a2A provider specific settings. +type A2AReplicationDetails struct { + FabricObjectID *string `json:"fabricObjectId,omitempty"` + MultiVMGroupID *string `json:"multiVmGroupId,omitempty"` + MultiVMGroupName *string `json:"multiVmGroupName,omitempty"` + ManagementID *string `json:"managementId,omitempty"` + ProtectedDisks *[]A2AProtectedDiskDetails `json:"protectedDisks,omitempty"` + PrimaryFabricLocation *string `json:"primaryFabricLocation,omitempty"` + RecoveryFabricLocation *string `json:"recoveryFabricLocation,omitempty"` + OsType *string `json:"osType,omitempty"` + RecoveryAzureVMSize *string `json:"recoveryAzureVMSize,omitempty"` + RecoveryAzureVMName *string `json:"recoveryAzureVMName,omitempty"` + RecoveryAzureResourceGroupID *string `json:"recoveryAzureResourceGroupId,omitempty"` + RecoveryCloudService *string `json:"recoveryCloudService,omitempty"` + RecoveryAvailabilitySet *string `json:"recoveryAvailabilitySet,omitempty"` + SelectedRecoveryAzureNetworkID *string `json:"selectedRecoveryAzureNetworkId,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + VMSyncedConfigDetails *AzureToAzureVMSyncedConfigDetails `json:"vmSyncedConfigDetails,omitempty"` + MonitoringPercentageCompletion *int32 `json:"monitoringPercentageCompletion,omitempty"` + MonitoringJobType *string `json:"monitoringJobType,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + IsReplicationAgentUpdateRequired *bool `json:"isReplicationAgentUpdateRequired,omitempty"` + RecoveryFabricObjectID *string `json:"recoveryFabricObjectId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + LifecycleID *string `json:"lifecycleId,omitempty"` +} + +// A2AReprotectInput is azure specific reprotect input. +type A2AReprotectInput struct { + RecoveryContainerID *string `json:"recoveryContainerId,omitempty"` + VMDisks *[]A2AVMDiskInputDetails `json:"vmDisks,omitempty"` + RecoveryResourceGroupID *string `json:"recoveryResourceGroupId,omitempty"` + RecoveryCloudServiceID *string `json:"recoveryCloudServiceId,omitempty"` + RecoveryAvailabilitySetID *string `json:"recoveryAvailabilitySetId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` +} + +// A2ASwitchProtectionInput is a2A specific switch protection input. +type A2ASwitchProtectionInput struct { + RecoveryContainerID *string `json:"recoveryContainerId,omitempty"` + VMDisks *[]A2AVMDiskInputDetails `json:"vmDisks,omitempty"` + RecoveryResourceGroupID *string `json:"recoveryResourceGroupId,omitempty"` + RecoveryCloudServiceID *string `json:"recoveryCloudServiceId,omitempty"` + RecoveryAvailabilitySetID *string `json:"recoveryAvailabilitySetId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` +} + +// A2AUpdateReplicationProtectedItemInput is inMage Azure V2 input to update replication protected item. +type A2AUpdateReplicationProtectedItemInput struct { + RecoveryCloudServiceID *string `json:"recoveryCloudServiceId,omitempty"` + RecoveryResourceGroupID *string `json:"recoveryResourceGroupId,omitempty"` +} + +// A2AVMDiskInputDetails is azure VM disk input details. +type A2AVMDiskInputDetails struct { + DiskURI *string `json:"diskUri,omitempty"` + RecoveryAzureStorageAccountID *string `json:"recoveryAzureStorageAccountId,omitempty"` + PrimaryStagingAzureStorageAccountID *string `json:"primaryStagingAzureStorageAccountId,omitempty"` +} + +// AddVCenterRequest is input required to add vCenter. +type AddVCenterRequest struct { + Properties *AddVCenterRequestProperties `json:"properties,omitempty"` +} + +// AddVCenterRequestProperties is the properties of an add vCenter request. +type AddVCenterRequestProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + Port *string `json:"port,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` +} + +// Alert is implements the Alert class. +type Alert 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 *AlertProperties `json:"properties,omitempty"` +} + +// AlertCollection is collection of alerts. +type AlertCollection struct { + autorest.Response `json:"-"` + Value *[]Alert `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AlertCollection) AlertCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AlertProperties is the proprties of an alert. +type AlertProperties struct { + SendToOwners *string `json:"sendToOwners,omitempty"` + CustomEmailAddresses *[]string `json:"customEmailAddresses,omitempty"` + Locale *string `json:"locale,omitempty"` +} + +// ApplyRecoveryPointInput is input to apply recovery point. +type ApplyRecoveryPointInput struct { + Properties *ApplyRecoveryPointInputProperties `json:"properties,omitempty"` +} + +// ApplyRecoveryPointInputProperties is input properties to apply recovery point. +type ApplyRecoveryPointInputProperties struct { + RecoveryPointID *string `json:"recoveryPointId,omitempty"` + ProviderSpecificDetails *ApplyRecoveryPointProviderSpecificInput `json:"providerSpecificDetails,omitempty"` +} + +// ApplyRecoveryPointProviderSpecificInput is provider specific input for apply recovery point. +type ApplyRecoveryPointProviderSpecificInput struct { +} + +// ARMException is ARM inner exception class. +type ARMException struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ARMExceptionDetails `json:"details,omitempty"` + Innererror *ARMInnerError `json:"innererror,omitempty"` +} + +// ARMExceptionDetails is service based exception details. +type ARMExceptionDetails struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + PossibleCauses *string `json:"possibleCauses,omitempty"` + RecommendedAction *string `json:"recommendedAction,omitempty"` + ClientRequestID *string `json:"clientRequestId,omitempty"` + ActivityID *string `json:"activityId,omitempty"` + Target *string `json:"target,omitempty"` +} + +// ARMInnerError is ARM internal error class for providing additional debug data. +type ARMInnerError struct { + Trace *string `json:"trace,omitempty"` + Source *string `json:"source,omitempty"` + MethodStatus *MethodCallStatus `json:"methodStatus,omitempty"` + CloudID *string `json:"cloudId,omitempty"` + HVHostID *string `json:"hVHostId,omitempty"` + HVClusterID *string `json:"hVClusterId,omitempty"` + NetworkID *string `json:"networkId,omitempty"` + VMID *string `json:"vmId,omitempty"` + FabricID *string `json:"fabricId,omitempty"` + LiveID *string `json:"liveId,omitempty"` + ContainerID *string `json:"containerId,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + SerializedSRSLogContext *string `json:"serializedSRSLogContext,omitempty"` +} + +// AsrJobDetails is this class represents job details based on specific job type. +type AsrJobDetails struct { + AffectedObjectDetails *map[string]*string `json:"affectedObjectDetails,omitempty"` +} + +// ASRTask is task of the Job. +type ASRTask struct { + TaskID *string `json:"taskId,omitempty"` + Name *string `json:"name,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + AllowedActions *[]string `json:"allowedActions,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + State *string `json:"state,omitempty"` + StateDescription *string `json:"stateDescription,omitempty"` + TaskType *string `json:"taskType,omitempty"` + CustomDetails *TaskTypeDetails `json:"customDetails,omitempty"` + GroupTaskCustomDetails *GroupTaskDetails `json:"groupTaskCustomDetails,omitempty"` + Errors *[]JobErrorDetails `json:"errors,omitempty"` +} + +// AutomationRunbookTaskDetails is this class represents the task details for an automation runbook. +type AutomationRunbookTaskDetails struct { + Name *string `json:"name,omitempty"` + CloudServiceName *string `json:"cloudServiceName,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + AccountName *string `json:"accountName,omitempty"` + RunbookID *string `json:"runbookId,omitempty"` + RunbookName *string `json:"runbookName,omitempty"` + JobID *string `json:"jobId,omitempty"` + JobOutput *string `json:"jobOutput,omitempty"` + IsPrimarySideScript *bool `json:"isPrimarySideScript,omitempty"` +} + +// AzureFabricCreationInput is fabric provider specific settings. +type AzureFabricCreationInput struct { + Location *string `json:"location,omitempty"` +} + +// AzureFabricSpecificDetails is azure Fabric Specific Details. +type AzureFabricSpecificDetails struct { + Location *string `json:"location,omitempty"` + ContainerIds *[]string `json:"containerIds,omitempty"` +} + +// AzureToAzureCreateNetworkMappingInput is create network mappings input properties/behaviour specific to Azure to +// Azure Network mapping. +type AzureToAzureCreateNetworkMappingInput struct { + PrimaryNetworkID *string `json:"primaryNetworkId,omitempty"` +} + +// AzureToAzureNetworkMappingSettings is a2A Network Mapping fabric specific settings. +type AzureToAzureNetworkMappingSettings struct { + PrimaryFabricLocation *string `json:"primaryFabricLocation,omitempty"` + RecoveryFabricLocation *string `json:"recoveryFabricLocation,omitempty"` +} + +// AzureToAzureUpdateNetworkMappingInput is updates network mappings input. +type AzureToAzureUpdateNetworkMappingInput struct { + PrimaryNetworkID *string `json:"primaryNetworkId,omitempty"` +} + +// AzureToAzureVMSyncedConfigDetails is azure to Azure VM synced configuration details. +type AzureToAzureVMSyncedConfigDetails struct { + Tags *map[string]*string `json:"tags,omitempty"` + RoleAssignments *[]RoleAssignment `json:"roleAssignments,omitempty"` + InputEndpoints *[]InputEndpoint `json:"inputEndpoints,omitempty"` +} + +// AzureVMDiskDetails is disk details for E2A provider. +type AzureVMDiskDetails struct { + VhdType *string `json:"vhdType,omitempty"` + VhdID *string `json:"vhdId,omitempty"` + VhdName *string `json:"vhdName,omitempty"` + MaxSizeMB *string `json:"maxSizeMB,omitempty"` + TargetDiskLocation *string `json:"targetDiskLocation,omitempty"` + TargetDiskName *string `json:"targetDiskName,omitempty"` + LunID *string `json:"lunId,omitempty"` +} + +// ConfigurationSettings is replication provider specific settings. +type ConfigurationSettings struct { +} + +// ConfigureAlertRequest is request to configure alerts for the system. +type ConfigureAlertRequest struct { + Properties *ConfigureAlertRequestProperties `json:"properties,omitempty"` +} + +// ConfigureAlertRequestProperties is properties of a configure alert request. +type ConfigureAlertRequestProperties struct { + SendToOwners *string `json:"sendToOwners,omitempty"` + CustomEmailAddresses *[]string `json:"customEmailAddresses,omitempty"` + Locale *string `json:"locale,omitempty"` +} + +// ConsistencyCheckTaskDetails is this class contains monitoring details of all the inconsistent Protected Entites in +// Vmm. +type ConsistencyCheckTaskDetails struct { + VMDetails *[]InconsistentVMDetails `json:"vmDetails,omitempty"` +} + +// CreateNetworkMappingInput is create network mappings input. +type CreateNetworkMappingInput struct { + Properties *CreateNetworkMappingInputProperties `json:"properties,omitempty"` +} + +// CreateNetworkMappingInputProperties is common input details for network mapping operation. +type CreateNetworkMappingInputProperties struct { + RecoveryFabricName *string `json:"recoveryFabricName,omitempty"` + RecoveryNetworkID *string `json:"recoveryNetworkId,omitempty"` + FabricSpecificDetails *FabricSpecificCreateNetworkMappingInput `json:"fabricSpecificDetails,omitempty"` +} + +// CreatePolicyInput is protection profile input. +type CreatePolicyInput struct { + Properties *CreatePolicyInputProperties `json:"properties,omitempty"` +} + +// CreatePolicyInputProperties is policy creation properties. +type CreatePolicyInputProperties struct { + ProviderSpecificInput *PolicyProviderSpecificInput `json:"providerSpecificInput,omitempty"` +} + +// CreateProtectionContainerInput is create protection container input. +type CreateProtectionContainerInput struct { + Properties *CreateProtectionContainerInputProperties `json:"properties,omitempty"` +} + +// CreateProtectionContainerInputProperties is create protection container input properties. +type CreateProtectionContainerInputProperties struct { + ProviderSpecificInput *[]ReplicationProviderSpecificContainerCreationInput `json:"providerSpecificInput,omitempty"` +} + +// CreateProtectionContainerMappingInput is configure pairing input. +type CreateProtectionContainerMappingInput struct { + Properties *CreateProtectionContainerMappingInputProperties `json:"properties,omitempty"` +} + +// CreateProtectionContainerMappingInputProperties is configure pairing input properties. +type CreateProtectionContainerMappingInputProperties struct { + TargetProtectionContainerID *string `json:"targetProtectionContainerId,omitempty"` + PolicyID *string `json:"PolicyId,omitempty"` + ProviderSpecificInput *ReplicationProviderSpecificContainerMappingInput `json:"providerSpecificInput,omitempty"` +} + +// CreateRecoveryPlanInput is create recovery plan input class. +type CreateRecoveryPlanInput struct { + Properties *CreateRecoveryPlanInputProperties `json:"properties,omitempty"` +} + +// CreateRecoveryPlanInputProperties is recovery plan creation properties. +type CreateRecoveryPlanInputProperties struct { + PrimaryFabricID *string `json:"primaryFabricId,omitempty"` + RecoveryFabricID *string `json:"recoveryFabricId,omitempty"` + FailoverDeploymentModel FailoverDeploymentModel `json:"failoverDeploymentModel,omitempty"` + Groups *[]RecoveryPlanGroup `json:"groups,omitempty"` +} + +// CurrentScenarioDetails is current scenario details of the protected entity. +type CurrentScenarioDetails struct { + ScenarioName *string `json:"scenarioName,omitempty"` + JobID *string `json:"jobId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` +} + +// DataStore is the datastore details of the MT. +type DataStore struct { + SymbolicName *string `json:"symbolicName,omitempty"` + UUID *string `json:"uuid,omitempty"` + Capacity *string `json:"capacity,omitempty"` + FreeSpace *string `json:"freeSpace,omitempty"` + Type *string `json:"type,omitempty"` +} + +// DisableProtectionInput is disable protection input. +type DisableProtectionInput struct { + Properties *DisableProtectionInputProperties `json:"properties,omitempty"` +} + +// DisableProtectionInputProperties is disable protection input properties. +type DisableProtectionInputProperties struct { + DisableProtectionReason DisableProtectionReason `json:"disableProtectionReason,omitempty"` + ReplicationProviderInput *DisableProtectionProviderSpecificInput `json:"replicationProviderInput,omitempty"` +} + +// DisableProtectionProviderSpecificInput is disable protection provider specific input. +type DisableProtectionProviderSpecificInput struct { +} + +// DiscoverProtectableItemRequest is request to add a physical machine as a protectable item in a container. +type DiscoverProtectableItemRequest struct { + Properties *DiscoverProtectableItemRequestProperties `json:"properties,omitempty"` +} + +// DiscoverProtectableItemRequestProperties is discover protectable item properties. +type DiscoverProtectableItemRequestProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + OsType *string `json:"osType,omitempty"` +} + +// DiskDetails is onprem disk details data. +type DiskDetails struct { + MaxSizeMB *int64 `json:"maxSizeMB,omitempty"` + VhdType *string `json:"vhdType,omitempty"` + VhdID *string `json:"vhdId,omitempty"` + VhdName *string `json:"vhdName,omitempty"` +} + +// DiskVolumeDetails is volume details. +type DiskVolumeDetails struct { + Label *string `json:"label,omitempty"` + Name *string `json:"name,omitempty"` +} + +// Display is contains the localized display information for this particular operation / action. These value will be +// used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; +// and (3) audit history / records for management operations. +type Display struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// EnableProtectionInput is enable protection input. +type EnableProtectionInput struct { + Properties *EnableProtectionInputProperties `json:"properties,omitempty"` +} + +// EnableProtectionInputProperties is enable protection input properties. +type EnableProtectionInputProperties struct { + PolicyID *string `json:"policyId,omitempty"` + ProtectableItemID *string `json:"protectableItemId,omitempty"` + ProviderSpecificDetails *EnableProtectionProviderSpecificInput `json:"providerSpecificDetails,omitempty"` +} + +// EnableProtectionProviderSpecificInput is enable protection provider specific input. +type EnableProtectionProviderSpecificInput struct { +} + +// EncryptionDetails is encryption details for the fabric. +type EncryptionDetails struct { + KekState *string `json:"kekState,omitempty"` + KekCertThumbprint *string `json:"kekCertThumbprint,omitempty"` + KekCertExpiryDate *date.Time `json:"kekCertExpiryDate,omitempty"` +} + +// Event is implements the Event class. +type Event 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 *EventProperties `json:"properties,omitempty"` +} + +// EventCollection is collection of fabric details. +type EventCollection struct { + autorest.Response `json:"-"` + Value *[]Event `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// EventCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client EventCollection) EventCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// EventProperties is the properties of a monitoring event. +type EventProperties struct { + EventCode *string `json:"eventCode,omitempty"` + Description *string `json:"description,omitempty"` + EventType *string `json:"eventType,omitempty"` + AffectedObjectFriendlyName *string `json:"affectedObjectFriendlyName,omitempty"` + Severity *string `json:"severity,omitempty"` + TimeOfOccurrence *date.Time `json:"timeOfOccurrence,omitempty"` + FabricID *string `json:"fabricId,omitempty"` + ProviderSpecificDetails *EventProviderSpecificDetails `json:"providerSpecificDetails,omitempty"` + EventSpecificDetails *EventSpecificDetails `json:"eventSpecificDetails,omitempty"` + HealthErrors *[]HealthError `json:"healthErrors,omitempty"` +} + +// EventProviderSpecificDetails is model class for provider specific details for an event. +type EventProviderSpecificDetails struct { +} + +// EventSpecificDetails is model class for event specific details for an event. +type EventSpecificDetails struct { +} + +// ExportJobDetails is this class represents details for export jobs workflow. +type ExportJobDetails struct { + AffectedObjectDetails *map[string]*string `json:"affectedObjectDetails,omitempty"` + BlobURI *string `json:"blobUri,omitempty"` + SasToken *string `json:"sasToken,omitempty"` +} + +// Fabric is fabric definition. +type Fabric 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 *FabricProperties `json:"properties,omitempty"` +} + +// FabricCollection is collection of fabric details. +type FabricCollection struct { + autorest.Response `json:"-"` + Value *[]Fabric `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// FabricCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client FabricCollection) FabricCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// FabricCreationInput is site details provided during the time of site creation +type FabricCreationInput struct { + Properties *FabricCreationInputProperties `json:"properties,omitempty"` +} + +// FabricCreationInputProperties is properties of site details provided during the time of site creation +type FabricCreationInputProperties struct { + CustomDetails *FabricSpecificCreationInput `json:"customDetails,omitempty"` +} + +// FabricProperties is fabric properties. +type FabricProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + EncryptionDetails *EncryptionDetails `json:"encryptionDetails,omitempty"` + RolloverEncryptionDetails *EncryptionDetails `json:"rolloverEncryptionDetails,omitempty"` + InternalIdentifier *string `json:"internalIdentifier,omitempty"` + BcdrState *string `json:"bcdrState,omitempty"` + CustomDetails *FabricSpecificDetails `json:"customDetails,omitempty"` + HealthErrorDetails *[]HealthError `json:"healthErrorDetails,omitempty"` + Health *string `json:"health,omitempty"` +} + +// FabricReplicationGroupTaskDetails is this class represents the fabric replication group task details. +type FabricReplicationGroupTaskDetails struct { + SkippedReason *string `json:"skippedReason,omitempty"` + SkippedReasonString *string `json:"skippedReasonString,omitempty"` + JobTask *JobEntity `json:"jobTask,omitempty"` +} + +// FabricSpecificCreateNetworkMappingInput is input details specific to fabrics during Network Mapping. +type FabricSpecificCreateNetworkMappingInput struct { +} + +// FabricSpecificCreationInput is fabric provider specific settings. +type FabricSpecificCreationInput struct { +} + +// FabricSpecificDetails is fabric specific details. +type FabricSpecificDetails struct { +} + +// FabricSpecificUpdateNetworkMappingInput is input details specific to fabrics during Network Mapping. +type FabricSpecificUpdateNetworkMappingInput struct { +} + +// FailoverProcessServerRequest is request to failover a process server. +type FailoverProcessServerRequest struct { + Properties *FailoverProcessServerRequestProperties `json:"properties,omitempty"` +} + +// FailoverProcessServerRequestProperties is the properties of the Failover Process Server request. +type FailoverProcessServerRequestProperties struct { + ContainerName *string `json:"containerName,omitempty"` + SourceProcessServerID *string `json:"sourceProcessServerId,omitempty"` + TargetProcessServerID *string `json:"targetProcessServerId,omitempty"` + VmsToMigrate *[]string `json:"vmsToMigrate,omitempty"` + UpdateType *string `json:"updateType,omitempty"` +} + +// GroupTaskDetails is this class represents the group task details when parent child relationship exists in the drill +// down. +type GroupTaskDetails struct { + ChildTasks *[]ASRTask `json:"childTasks,omitempty"` +} + +// HealthError is the health error class. +type HealthError struct { + ErrorLevel *string `json:"errorLevel,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + PossibleCauses *string `json:"possibleCauses,omitempty"` + RecommendedAction *string `json:"recommendedAction,omitempty"` + CreationTimeUtc *date.Time `json:"creationTimeUtc,omitempty"` + RecoveryProviderErrorMessage *string `json:"recoveryProviderErrorMessage,omitempty"` + EntityID *string `json:"entityId,omitempty"` +} + +// HyperVReplica2012EventDetails is model class for event details of a HyperVReplica E2E event. +type HyperVReplica2012EventDetails struct { + ContainerName *string `json:"containerName,omitempty"` + FabricName *string `json:"fabricName,omitempty"` + RemoteContainerName *string `json:"remoteContainerName,omitempty"` + RemoteFabricName *string `json:"remoteFabricName,omitempty"` +} + +// HyperVReplica2012R2EventDetails is model class for event details of a HyperVReplica blue E2E event. +type HyperVReplica2012R2EventDetails struct { + ContainerName *string `json:"containerName,omitempty"` + FabricName *string `json:"fabricName,omitempty"` + RemoteContainerName *string `json:"remoteContainerName,omitempty"` + RemoteFabricName *string `json:"remoteFabricName,omitempty"` +} + +// HyperVReplicaAzureApplyRecoveryPointInput is applyRecoveryPoint input specific to HyperVReplicaAzure provider. +type HyperVReplicaAzureApplyRecoveryPointInput struct { + VaultLocation *string `json:"vaultLocation,omitempty"` + PrimaryKekCertificatePfx *string `json:"primaryKekCertificatePfx,omitempty"` + SecondaryKekCertificatePfx *string `json:"secondaryKekCertificatePfx,omitempty"` +} + +// HyperVReplicaAzureEnableProtectionInput is azure specific enable protection input. +type HyperVReplicaAzureEnableProtectionInput struct { + HvHostVMID *string `json:"hvHostVmId,omitempty"` + VMName *string `json:"vmName,omitempty"` + OsType *string `json:"osType,omitempty"` + VhdID *string `json:"vhdId,omitempty"` + TargetStorageAccountID *string `json:"targetStorageAccountId,omitempty"` + TargetAzureNetworkID *string `json:"targetAzureNetworkId,omitempty"` + TargetAzureSubnetID *string `json:"targetAzureSubnetId,omitempty"` + EnableRDPOnTargetOption *string `json:"enableRDPOnTargetOption,omitempty"` + TargetAzureVMName *string `json:"targetAzureVmName,omitempty"` + LogStorageAccountID *string `json:"logStorageAccountId,omitempty"` + DisksToInclude *[]string `json:"disksToInclude,omitempty"` + TargetAzureV1ResourceGroupID *string `json:"targetAzureV1ResourceGroupId,omitempty"` + TargetAzureV2ResourceGroupID *string `json:"targetAzureV2ResourceGroupId,omitempty"` + UseManagedDisks *string `json:"useManagedDisks,omitempty"` +} + +// HyperVReplicaAzureEventDetails is model class for event details of a HyperVReplica E2A event. +type HyperVReplicaAzureEventDetails struct { + ContainerName *string `json:"containerName,omitempty"` + FabricName *string `json:"fabricName,omitempty"` + RemoteContainerName *string `json:"remoteContainerName,omitempty"` +} + +// HyperVReplicaAzureFailbackProviderInput is hvrA provider specific input for failback. +type HyperVReplicaAzureFailbackProviderInput struct { + DataSyncOption *string `json:"dataSyncOption,omitempty"` + RecoveryVMCreationOption *string `json:"recoveryVmCreationOption,omitempty"` + ProviderIDForAlternateRecovery *string `json:"providerIdForAlternateRecovery,omitempty"` +} + +// HyperVReplicaAzureFailoverProviderInput is hvrA provider specific input for failover. +type HyperVReplicaAzureFailoverProviderInput struct { + VaultLocation *string `json:"vaultLocation,omitempty"` + PrimaryKekCertificatePfx *string `json:"primaryKekCertificatePfx,omitempty"` + SecondaryKekCertificatePfx *string `json:"secondaryKekCertificatePfx,omitempty"` + RecoveryPointID *string `json:"recoveryPointId,omitempty"` +} + +// HyperVReplicaAzurePolicyDetails is hyper-V Replica Azure specific protection profile details. +type HyperVReplicaAzurePolicyDetails struct { + RecoveryPointHistoryDurationInHours *int32 `json:"recoveryPointHistoryDurationInHours,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + ReplicationInterval *int32 `json:"replicationInterval,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + Encryption *string `json:"encryption,omitempty"` + ActiveStorageAccountID *string `json:"activeStorageAccountId,omitempty"` +} + +// HyperVReplicaAzurePolicyInput is hyper-V Replica Azure specific input for creating a protection profile. +type HyperVReplicaAzurePolicyInput struct { + RecoveryPointHistoryDuration *int32 `json:"recoveryPointHistoryDuration,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + ReplicationInterval *int32 `json:"replicationInterval,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + Encryption *string `json:"encryption,omitempty"` + StorageAccounts *[]string `json:"storageAccounts,omitempty"` +} + +// HyperVReplicaAzureReplicationDetails is hyper V Replica Azure provider specific settings. +type HyperVReplicaAzureReplicationDetails struct { + AzureVMDiskDetails *[]AzureVMDiskDetails `json:"azureVMDiskDetails,omitempty"` + RecoveryAzureVMName *string `json:"recoveryAzureVMName,omitempty"` + RecoveryAzureVMSize *string `json:"recoveryAzureVMSize,omitempty"` + RecoveryAzureStorageAccount *string `json:"recoveryAzureStorageAccount,omitempty"` + RecoveryAzureLogStorageAccountID *string `json:"recoveryAzureLogStorageAccountId,omitempty"` + LastReplicatedTime *date.Time `json:"lastReplicatedTime,omitempty"` + VMID *string `json:"vmId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + InitialReplicationDetails *InitialReplicationDetails `json:"initialReplicationDetails,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + SelectedRecoveryAzureNetworkID *string `json:"selectedRecoveryAzureNetworkId,omitempty"` + Encryption *string `json:"encryption,omitempty"` + OSDetails *OSDetails `json:"oSDetails,omitempty"` + SourceVMRAMSizeInMB *int32 `json:"sourceVmRAMSizeInMB,omitempty"` + SourceVMCPUCount *int32 `json:"sourceVmCPUCount,omitempty"` + EnableRDPOnTargetOption *string `json:"enableRDPOnTargetOption,omitempty"` + RecoveryAzureResourceGroupID *string `json:"recoveryAzureResourceGroupId,omitempty"` + RecoveryAvailabilitySetID *string `json:"recoveryAvailabilitySetId,omitempty"` + UseManagedDisks *string `json:"useManagedDisks,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` +} + +// HyperVReplicaAzureReprotectInput is azure specific reprotect input. +type HyperVReplicaAzureReprotectInput struct { + HvHostVMID *string `json:"hvHostVmId,omitempty"` + VMName *string `json:"vmName,omitempty"` + OsType *string `json:"osType,omitempty"` + VHDID *string `json:"vHDId,omitempty"` + StorageAccountID *string `json:"storageAccountId,omitempty"` + LogStorageAccountID *string `json:"logStorageAccountId,omitempty"` +} + +// HyperVReplicaAzureUpdateReplicationProtectedItemInput is hyperV replica Azure input to update replication protected +// item. +type HyperVReplicaAzureUpdateReplicationProtectedItemInput struct { + RecoveryAzureV1ResourceGroupID *string `json:"recoveryAzureV1ResourceGroupId,omitempty"` + RecoveryAzureV2ResourceGroupID *string `json:"recoveryAzureV2ResourceGroupId,omitempty"` + UseManagedDisks *string `json:"useManagedDisks,omitempty"` +} + +// HyperVReplicaBaseEventDetails is abstract model class for event details of a HyperVReplica E2E event. +type HyperVReplicaBaseEventDetails struct { + ContainerName *string `json:"containerName,omitempty"` + FabricName *string `json:"fabricName,omitempty"` + RemoteContainerName *string `json:"remoteContainerName,omitempty"` + RemoteFabricName *string `json:"remoteFabricName,omitempty"` +} + +// HyperVReplicaBasePolicyDetails is base class for HyperVReplica policy details. +type HyperVReplicaBasePolicyDetails struct { + RecoveryPoints *int32 `json:"recoveryPoints,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + Compression *string `json:"compression,omitempty"` + InitialReplicationMethod *string `json:"initialReplicationMethod,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + OfflineReplicationImportPath *string `json:"offlineReplicationImportPath,omitempty"` + OfflineReplicationExportPath *string `json:"offlineReplicationExportPath,omitempty"` + ReplicationPort *int32 `json:"replicationPort,omitempty"` + AllowedAuthenticationType *int32 `json:"allowedAuthenticationType,omitempty"` + ReplicaDeletionOption *string `json:"replicaDeletionOption,omitempty"` +} + +// HyperVReplicaBaseReplicationDetails is hyper V replica provider specific settings base class. +type HyperVReplicaBaseReplicationDetails struct { + LastReplicatedTime *date.Time `json:"lastReplicatedTime,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + VMID *string `json:"vmId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + InitialReplicationDetails *InitialReplicationDetails `json:"initialReplicationDetails,omitempty"` + VMDiskDetails *[]DiskDetails `json:"vMDiskDetails,omitempty"` +} + +// HyperVReplicaBluePolicyDetails is hyper-V Replica Blue specific protection profile details. +type HyperVReplicaBluePolicyDetails struct { + ReplicationFrequencyInSeconds *int32 `json:"replicationFrequencyInSeconds,omitempty"` + RecoveryPoints *int32 `json:"recoveryPoints,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + Compression *string `json:"compression,omitempty"` + InitialReplicationMethod *string `json:"initialReplicationMethod,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + OfflineReplicationImportPath *string `json:"offlineReplicationImportPath,omitempty"` + OfflineReplicationExportPath *string `json:"offlineReplicationExportPath,omitempty"` + ReplicationPort *int32 `json:"replicationPort,omitempty"` + AllowedAuthenticationType *int32 `json:"allowedAuthenticationType,omitempty"` + ReplicaDeletionOption *string `json:"replicaDeletionOption,omitempty"` +} + +// HyperVReplicaBluePolicyInput is hyperV Replica Blue policy input. +type HyperVReplicaBluePolicyInput struct { + ReplicationFrequencyInSeconds *int32 `json:"replicationFrequencyInSeconds,omitempty"` + RecoveryPoints *int32 `json:"recoveryPoints,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + Compression *string `json:"compression,omitempty"` + InitialReplicationMethod *string `json:"initialReplicationMethod,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + OfflineReplicationImportPath *string `json:"offlineReplicationImportPath,omitempty"` + OfflineReplicationExportPath *string `json:"offlineReplicationExportPath,omitempty"` + ReplicationPort *int32 `json:"replicationPort,omitempty"` + AllowedAuthenticationType *int32 `json:"allowedAuthenticationType,omitempty"` + ReplicaDeletion *string `json:"replicaDeletion,omitempty"` +} + +// HyperVReplicaBlueReplicationDetails is hyperV replica 2012 R2 (Blue) replication details. +type HyperVReplicaBlueReplicationDetails struct { + LastReplicatedTime *date.Time `json:"lastReplicatedTime,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + VMID *string `json:"vmId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + InitialReplicationDetails *InitialReplicationDetails `json:"initialReplicationDetails,omitempty"` + VMDiskDetails *[]DiskDetails `json:"vMDiskDetails,omitempty"` +} + +// HyperVReplicaPolicyDetails is hyper-V Replica Blue specific protection profile details. +type HyperVReplicaPolicyDetails struct { + RecoveryPoints *int32 `json:"recoveryPoints,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + Compression *string `json:"compression,omitempty"` + InitialReplicationMethod *string `json:"initialReplicationMethod,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + OfflineReplicationImportPath *string `json:"offlineReplicationImportPath,omitempty"` + OfflineReplicationExportPath *string `json:"offlineReplicationExportPath,omitempty"` + ReplicationPort *int32 `json:"replicationPort,omitempty"` + AllowedAuthenticationType *int32 `json:"allowedAuthenticationType,omitempty"` + ReplicaDeletionOption *string `json:"replicaDeletionOption,omitempty"` +} + +// HyperVReplicaPolicyInput is hyper-V Replica specific protection profile Input. +type HyperVReplicaPolicyInput struct { + RecoveryPoints *int32 `json:"recoveryPoints,omitempty"` + ApplicationConsistentSnapshotFrequencyInHours *int32 `json:"applicationConsistentSnapshotFrequencyInHours,omitempty"` + Compression *string `json:"compression,omitempty"` + InitialReplicationMethod *string `json:"initialReplicationMethod,omitempty"` + OnlineReplicationStartTime *string `json:"onlineReplicationStartTime,omitempty"` + OfflineReplicationImportPath *string `json:"offlineReplicationImportPath,omitempty"` + OfflineReplicationExportPath *string `json:"offlineReplicationExportPath,omitempty"` + ReplicationPort *int32 `json:"replicationPort,omitempty"` + AllowedAuthenticationType *int32 `json:"allowedAuthenticationType,omitempty"` + ReplicaDeletion *string `json:"replicaDeletion,omitempty"` +} + +// HyperVReplicaReplicationDetails is hyperV replica 2012 replication details. +type HyperVReplicaReplicationDetails struct { + LastReplicatedTime *date.Time `json:"lastReplicatedTime,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + VMID *string `json:"vmId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + InitialReplicationDetails *InitialReplicationDetails `json:"initialReplicationDetails,omitempty"` + VMDiskDetails *[]DiskDetails `json:"vMDiskDetails,omitempty"` +} + +// HyperVSiteDetails is hyperVSite fabric specific details. +type HyperVSiteDetails struct { +} + +// HyperVVirtualMachineDetails is hyper V replica provider specific settings +type HyperVVirtualMachineDetails struct { + SourceItemID *string `json:"sourceItemId,omitempty"` + Generation *string `json:"generation,omitempty"` + OsDetails *OSDetails `json:"osDetails,omitempty"` + DiskDetails *[]DiskDetails `json:"diskDetails,omitempty"` +} + +// InconsistentVMDetails is this class stores the monitoring details for consistency check of inconsistent Protected +// Entity. +type InconsistentVMDetails struct { + VMName *string `json:"vmName,omitempty"` + CloudName *string `json:"cloudName,omitempty"` + Details *[]string `json:"details,omitempty"` + ErrorIds *[]string `json:"errorIds,omitempty"` +} + +// InitialReplicationDetails is initial replication details. +type InitialReplicationDetails struct { + InitialReplicationType *string `json:"initialReplicationType,omitempty"` + InitialReplicationProgressPercentage *string `json:"initialReplicationProgressPercentage,omitempty"` +} + +// InlineWorkflowTaskDetails is this class represents the inline workflow task details. +type InlineWorkflowTaskDetails struct { + ChildTasks *[]ASRTask `json:"childTasks,omitempty"` + WorkflowIds *[]string `json:"workflowIds,omitempty"` +} + +// InMageAgentDetails is the details of the InMage agent. +type InMageAgentDetails struct { + AgentVersion *string `json:"agentVersion,omitempty"` + AgentUpdateStatus *string `json:"agentUpdateStatus,omitempty"` + PostUpdateRebootStatus *string `json:"postUpdateRebootStatus,omitempty"` +} + +// InMageAzureV2ApplyRecoveryPointInput is applyRecoveryPoint input specific to InMageAzureV2 provider. +type InMageAzureV2ApplyRecoveryPointInput struct { + VaultLocation *string `json:"vaultLocation,omitempty"` +} + +// InMageAzureV2EnableProtectionInput is vMware Azure specific enable protection input. +type InMageAzureV2EnableProtectionInput struct { + MasterTargetID *string `json:"masterTargetId,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + StorageAccountID *string `json:"storageAccountId,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` + MultiVMGroupID *string `json:"multiVmGroupId,omitempty"` + MultiVMGroupName *string `json:"multiVmGroupName,omitempty"` + DisksToInclude *[]string `json:"disksToInclude,omitempty"` + TargetAzureNetworkID *string `json:"targetAzureNetworkId,omitempty"` + TargetAzureSubnetID *string `json:"targetAzureSubnetId,omitempty"` + EnableRDPOnTargetOption *string `json:"enableRDPOnTargetOption,omitempty"` + TargetAzureVMName *string `json:"targetAzureVmName,omitempty"` + LogStorageAccountID *string `json:"logStorageAccountId,omitempty"` + TargetAzureV1ResourceGroupID *string `json:"targetAzureV1ResourceGroupId,omitempty"` + TargetAzureV2ResourceGroupID *string `json:"targetAzureV2ResourceGroupId,omitempty"` + UseManagedDisks *string `json:"useManagedDisks,omitempty"` +} + +// InMageAzureV2EventDetails is model class for event details of a VMwareAzureV2 event. +type InMageAzureV2EventDetails struct { + EventType *string `json:"eventType,omitempty"` + Category *string `json:"category,omitempty"` + Component *string `json:"component,omitempty"` + CorrectiveAction *string `json:"correctiveAction,omitempty"` + Details *string `json:"details,omitempty"` + Summary *string `json:"summary,omitempty"` + SiteName *string `json:"siteName,omitempty"` +} + +// InMageAzureV2FailoverProviderInput is inMageAzureV2 provider specific input for failover. +type InMageAzureV2FailoverProviderInput struct { + VaultLocation *string `json:"vaultLocation,omitempty"` + RecoveryPointID *string `json:"recoveryPointId,omitempty"` +} + +// InMageAzureV2PolicyDetails is inMage Azure v2 specific protection profile details. +type InMageAzureV2PolicyDetails struct { + CrashConsistentFrequencyInMinutes *int32 `json:"crashConsistentFrequencyInMinutes,omitempty"` + RecoveryPointThresholdInMinutes *int32 `json:"recoveryPointThresholdInMinutes,omitempty"` + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus *string `json:"multiVmSyncStatus,omitempty"` +} + +// InMageAzureV2PolicyInput is vMWare Azure specific protection profile Input. +type InMageAzureV2PolicyInput struct { + RecoveryPointThresholdInMinutes *int32 `json:"recoveryPointThresholdInMinutes,omitempty"` + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + CrashConsistentFrequencyInMinutes *int32 `json:"crashConsistentFrequencyInMinutes,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus SetMultiVMSyncStatus `json:"multiVmSyncStatus,omitempty"` +} + +// InMageAzureV2ProtectedDiskDetails is inMageAzureV2 protected disk details. +type InMageAzureV2ProtectedDiskDetails struct { + DiskID *string `json:"diskId,omitempty"` + DiskName *string `json:"diskName,omitempty"` + ProtectionStage *string `json:"protectionStage,omitempty"` + HealthErrorCode *string `json:"healthErrorCode,omitempty"` + RpoInSeconds *int64 `json:"rpoInSeconds,omitempty"` + ResyncRequired *string `json:"resyncRequired,omitempty"` + ResyncProgressPercentage *int32 `json:"resyncProgressPercentage,omitempty"` + ResyncDurationInSeconds *int64 `json:"resyncDurationInSeconds,omitempty"` + DiskCapacityInBytes *int64 `json:"diskCapacityInBytes,omitempty"` + FileSystemCapacityInBytes *int64 `json:"fileSystemCapacityInBytes,omitempty"` + SourceDataInMegaBytes *float64 `json:"sourceDataInMegaBytes,omitempty"` + PsDataInMegaBytes *float64 `json:"psDataInMegaBytes,omitempty"` + TargetDataInMegaBytes *float64 `json:"targetDataInMegaBytes,omitempty"` + DiskResized *string `json:"diskResized,omitempty"` +} + +// InMageAzureV2ReplicationDetails is inMageAzureV2 provider specific settings +type InMageAzureV2ReplicationDetails struct { + InfrastructureVMID *string `json:"infrastructureVmId,omitempty"` + VCenterInfrastructureID *string `json:"vCenterInfrastructureId,omitempty"` + ProtectionStage *string `json:"protectionStage,omitempty"` + VMID *string `json:"vmId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + ResyncProgressPercentage *int32 `json:"resyncProgressPercentage,omitempty"` + RpoInSeconds *int64 `json:"rpoInSeconds,omitempty"` + CompressedDataRateInMB *float64 `json:"compressedDataRateInMB,omitempty"` + UncompressedDataRateInMB *float64 `json:"uncompressedDataRateInMB,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + IsAgentUpdateRequired *string `json:"isAgentUpdateRequired,omitempty"` + IsRebootAfterUpdateRequired *string `json:"isRebootAfterUpdateRequired,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + MultiVMGroupID *string `json:"multiVmGroupId,omitempty"` + MultiVMGroupName *string `json:"multiVmGroupName,omitempty"` + MultiVMSyncStatus *string `json:"multiVmSyncStatus,omitempty"` + ProtectedDisks *[]InMageAzureV2ProtectedDiskDetails `json:"protectedDisks,omitempty"` + DiskResized *string `json:"diskResized,omitempty"` + MasterTargetID *string `json:"masterTargetId,omitempty"` + SourceVMCPUCount *int32 `json:"sourceVmCPUCount,omitempty"` + SourceVMRAMSizeInMB *int32 `json:"sourceVmRAMSizeInMB,omitempty"` + OsType *string `json:"osType,omitempty"` + VhdName *string `json:"vhdName,omitempty"` + OsDiskID *string `json:"osDiskId,omitempty"` + AzureVMDiskDetails *[]AzureVMDiskDetails `json:"azureVMDiskDetails,omitempty"` + RecoveryAzureVMName *string `json:"recoveryAzureVMName,omitempty"` + RecoveryAzureVMSize *string `json:"recoveryAzureVMSize,omitempty"` + RecoveryAzureStorageAccount *string `json:"recoveryAzureStorageAccount,omitempty"` + RecoveryAzureLogStorageAccountID *string `json:"recoveryAzureLogStorageAccountId,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + SelectedRecoveryAzureNetworkID *string `json:"selectedRecoveryAzureNetworkId,omitempty"` + DiscoveryType *string `json:"discoveryType,omitempty"` + EnableRDPOnTargetOption *string `json:"enableRDPOnTargetOption,omitempty"` + Datastores *[]string `json:"datastores,omitempty"` + TargetVMID *string `json:"targetVmId,omitempty"` + RecoveryAzureResourceGroupID *string `json:"recoveryAzureResourceGroupId,omitempty"` + RecoveryAvailabilitySetID *string `json:"recoveryAvailabilitySetId,omitempty"` + UseManagedDisks *string `json:"useManagedDisks,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + ValidationErrors *[]HealthError `json:"validationErrors,omitempty"` +} + +// InMageAzureV2ReprotectInput is inMageAzureV2 specific provider input. +type InMageAzureV2ReprotectInput struct { + MasterTargetID *string `json:"masterTargetId,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + StorageAccountID *string `json:"storageAccountId,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LogStorageAccountID *string `json:"logStorageAccountId,omitempty"` + DisksToInclude *[]string `json:"disksToInclude,omitempty"` +} + +// InMageAzureV2UpdateReplicationProtectedItemInput is inMage Azure V2 input to update replication protected item. +type InMageAzureV2UpdateReplicationProtectedItemInput struct { + RecoveryAzureV1ResourceGroupID *string `json:"recoveryAzureV1ResourceGroupId,omitempty"` + RecoveryAzureV2ResourceGroupID *string `json:"recoveryAzureV2ResourceGroupId,omitempty"` + UseManagedDisks *string `json:"useManagedDisks,omitempty"` +} + +// InMageBasePolicyDetails is base class for the policies of providers using InMage replication. +type InMageBasePolicyDetails struct { + RecoveryPointThresholdInMinutes *int32 `json:"recoveryPointThresholdInMinutes,omitempty"` + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus *string `json:"multiVmSyncStatus,omitempty"` +} + +// InMageDisableProtectionProviderSpecificInput is inMage disable protection provider specific input. +type InMageDisableProtectionProviderSpecificInput struct { + ReplicaVMDeletionStatus *string `json:"replicaVmDeletionStatus,omitempty"` +} + +// InMageDiskDetails is vMware/Physical specific Disk Details +type InMageDiskDetails struct { + DiskID *string `json:"diskId,omitempty"` + DiskName *string `json:"diskName,omitempty"` + DiskSizeInMB *string `json:"diskSizeInMB,omitempty"` + DiskType *string `json:"diskType,omitempty"` + DiskConfiguration *string `json:"diskConfiguration,omitempty"` + VolumeList *[]DiskVolumeDetails `json:"volumeList,omitempty"` +} + +// InMageDiskExclusionInput is diskExclusionInput when doing enable protection of virtual machine in InMage provider. +type InMageDiskExclusionInput struct { + VolumeOptions *[]InMageVolumeExclusionOptions `json:"volumeOptions,omitempty"` + DiskSignatureOptions *[]InMageDiskSignatureExclusionOptions `json:"diskSignatureOptions,omitempty"` +} + +// InMageDiskSignatureExclusionOptions is guest disk signature based disk exclusion option when doing enable protection +// of virtual machine in InMage provider. +type InMageDiskSignatureExclusionOptions struct { + DiskSignature *string `json:"diskSignature,omitempty"` +} + +// InMageEnableProtectionInput is vMware Azure specific enable protection input. +type InMageEnableProtectionInput struct { + VMFriendlyName *string `json:"vmFriendlyName,omitempty"` + MasterTargetID *string `json:"masterTargetId,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + RetentionDrive *string `json:"retentionDrive,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` + MultiVMGroupID *string `json:"multiVmGroupId,omitempty"` + MultiVMGroupName *string `json:"multiVmGroupName,omitempty"` + DatastoreName *string `json:"datastoreName,omitempty"` + DiskExclusionInput *InMageDiskExclusionInput `json:"diskExclusionInput,omitempty"` + DisksToInclude *[]string `json:"disksToInclude,omitempty"` +} + +// InMageFailoverProviderInput is provider specific input for InMage failover. +type InMageFailoverProviderInput struct { + RecoveryPointType *string `json:"recoveryPointType,omitempty"` + RecoveryPointID *string `json:"recoveryPointId,omitempty"` +} + +// InMagePolicyDetails is inMage specific protection profile details. +type InMagePolicyDetails struct { + RecoveryPointThresholdInMinutes *int32 `json:"recoveryPointThresholdInMinutes,omitempty"` + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus *string `json:"multiVmSyncStatus,omitempty"` +} + +// InMagePolicyInput is vMWare Azure specific protection profile Input. +type InMagePolicyInput struct { + RecoveryPointThresholdInMinutes *int32 `json:"recoveryPointThresholdInMinutes,omitempty"` + RecoveryPointHistory *int32 `json:"recoveryPointHistory,omitempty"` + AppConsistentFrequencyInMinutes *int32 `json:"appConsistentFrequencyInMinutes,omitempty"` + MultiVMSyncStatus SetMultiVMSyncStatus `json:"multiVmSyncStatus,omitempty"` +} + +// InMageProtectedDiskDetails is inMage protected disk details. +type InMageProtectedDiskDetails struct { + DiskID *string `json:"diskId,omitempty"` + DiskName *string `json:"diskName,omitempty"` + ProtectionStage *string `json:"protectionStage,omitempty"` + HealthErrorCode *string `json:"healthErrorCode,omitempty"` + RpoInSeconds *int64 `json:"rpoInSeconds,omitempty"` + ResyncRequired *string `json:"resyncRequired,omitempty"` + ResyncProgressPercentage *int32 `json:"resyncProgressPercentage,omitempty"` + ResyncDurationInSeconds *int64 `json:"resyncDurationInSeconds,omitempty"` + DiskCapacityInBytes *int64 `json:"diskCapacityInBytes,omitempty"` + FileSystemCapacityInBytes *int64 `json:"fileSystemCapacityInBytes,omitempty"` + SourceDataInMB *float64 `json:"sourceDataInMB,omitempty"` + PsDataInMB *float64 `json:"psDataInMB,omitempty"` + TargetDataInMB *float64 `json:"targetDataInMB,omitempty"` + DiskResized *string `json:"diskResized,omitempty"` +} + +// InMageReplicationDetails is inMage provider specific settings +type InMageReplicationDetails struct { + ActiveSiteType *string `json:"activeSiteType,omitempty"` + SourceVMCPUCount *int32 `json:"sourceVmCPUCount,omitempty"` + SourceVMRAMSizeInMB *int32 `json:"sourceVmRAMSizeInMB,omitempty"` + OsDetails *OSDiskDetails `json:"osDetails,omitempty"` + ProtectionStage *string `json:"protectionStage,omitempty"` + VMID *string `json:"vmId,omitempty"` + VMProtectionState *string `json:"vmProtectionState,omitempty"` + VMProtectionStateDescription *string `json:"vmProtectionStateDescription,omitempty"` + ResyncDetails *InitialReplicationDetails `json:"resyncDetails,omitempty"` + RetentionWindowStart *date.Time `json:"retentionWindowStart,omitempty"` + RetentionWindowEnd *date.Time `json:"retentionWindowEnd,omitempty"` + CompressedDataRateInMB *float64 `json:"compressedDataRateInMB,omitempty"` + UncompressedDataRateInMB *float64 `json:"uncompressedDataRateInMB,omitempty"` + RpoInSeconds *int64 `json:"rpoInSeconds,omitempty"` + ProtectedDisks *[]InMageProtectedDiskDetails `json:"protectedDisks,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + MasterTargetID *string `json:"masterTargetId,omitempty"` + ConsistencyPoints *map[string]*date.Time `json:"consistencyPoints,omitempty"` + DiskResized *string `json:"diskResized,omitempty"` + RebootAfterUpdateStatus *string `json:"rebootAfterUpdateStatus,omitempty"` + MultiVMGroupID *string `json:"multiVmGroupId,omitempty"` + MultiVMGroupName *string `json:"multiVmGroupName,omitempty"` + MultiVMSyncStatus *string `json:"multiVmSyncStatus,omitempty"` + AgentDetails *InMageAgentDetails `json:"agentDetails,omitempty"` + VCenterInfrastructureID *string `json:"vCenterInfrastructureId,omitempty"` + InfrastructureVMID *string `json:"infrastructureVmId,omitempty"` + VMNics *[]VMNicDetails `json:"vmNics,omitempty"` + DiscoveryType *string `json:"discoveryType,omitempty"` + AzureStorageAccountID *string `json:"azureStorageAccountId,omitempty"` + Datastores *[]string `json:"datastores,omitempty"` + ValidationErrors *[]HealthError `json:"validationErrors,omitempty"` +} + +// InMageReprotectInput is inMageAzureV2 specific provider input. +type InMageReprotectInput struct { + MasterTargetID *string `json:"masterTargetId,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + RetentionDrive *string `json:"retentionDrive,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` + DatastoreName *string `json:"datastoreName,omitempty"` + DiskExclusionInput *InMageDiskExclusionInput `json:"diskExclusionInput,omitempty"` + ProfileID *string `json:"profileId,omitempty"` + DisksToInclude *[]string `json:"disksToInclude,omitempty"` +} + +// InMageVolumeExclusionOptions is guest disk signature based disk exclusion option when doing enable protection of +// virtual machine in InMage provider. +type InMageVolumeExclusionOptions struct { + VolumeLabel *string `json:"volumeLabel,omitempty"` + OnlyExcludeIfSingleVolume *string `json:"OnlyExcludeIfSingleVolume,omitempty"` +} + +// InputEndpoint is azure VM input endpoint details. +type InputEndpoint struct { + EndpointName *string `json:"endpointName,omitempty"` + PrivatePort *int32 `json:"privatePort,omitempty"` + PublicPort *int32 `json:"publicPort,omitempty"` + Protocol *string `json:"protocol,omitempty"` +} + +// Job is job details. +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"` + Properties *JobProperties `json:"properties,omitempty"` + Status *string `json:"status,omitempty"` + Error *ARMException `json:"error,omitempty"` + StartTime *string `json:"startTime,omitempty"` + EndTime *string `json:"endTime,omitempty"` +} + +// JobCollection is collection of jobs. +type JobCollection struct { + autorest.Response `json:"-"` + Value *[]Job `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobCollection) JobCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobDetails is job details based on specific job type. +type JobDetails struct { + AffectedObjectDetails *map[string]*string `json:"affectedObjectDetails,omitempty"` +} + +// JobEntity is this class contains the minimal job details required to navigate to the desired drill down. +type JobEntity struct { + JobID *string `json:"jobId,omitempty"` + JobFriendlyName *string `json:"jobFriendlyName,omitempty"` + TargetObjectID *string `json:"targetObjectId,omitempty"` + TargetObjectName *string `json:"targetObjectName,omitempty"` + TargetInstanceType *string `json:"targetInstanceType,omitempty"` + JobScenarioName *string `json:"jobScenarioName,omitempty"` +} + +// JobErrorDetails is this class contains the error details per object. +type JobErrorDetails struct { + ServiceErrorDetails *ServiceError `json:"serviceErrorDetails,omitempty"` + ProviderErrorDetails *ProviderError `json:"providerErrorDetails,omitempty"` + ErrorLevel *string `json:"errorLevel,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + TaskID *string `json:"taskId,omitempty"` +} + +// JobProperties is job custom data details. +type JobProperties struct { + ActivityID *string `json:"activityId,omitempty"` + ScenarioName *string `json:"scenarioName,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + State *string `json:"state,omitempty"` + StateDescription *string `json:"stateDescription,omitempty"` + Tasks *[]ASRTask `json:"tasks,omitempty"` + Errors *[]JobErrorDetails `json:"errors,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + AllowedActions *[]string `json:"allowedActions,omitempty"` + TargetObjectID *string `json:"targetObjectId,omitempty"` + TargetObjectName *string `json:"targetObjectName,omitempty"` + TargetInstanceType *string `json:"targetInstanceType,omitempty"` + CustomDetails *JobDetails `json:"customDetails,omitempty"` +} + +// JobQueryParameter is query parameter to enumerate jobs. +type JobQueryParameter struct { + StartTime *string `json:"startTime,omitempty"` + EndTime *string `json:"endTime,omitempty"` + FabricID *string `json:"fabricId,omitempty"` + AffectedObjectTypes *[]string `json:"affectedObjectTypes,omitempty"` + JobStatus *[]string `json:"jobStatus,omitempty"` +} + +// JobStatusEventDetails is model class for event details of a job status event. +type JobStatusEventDetails struct { + JobID *string `json:"jobId,omitempty"` + JobFriendlyName *string `json:"jobFriendlyName,omitempty"` + JobStatus *string `json:"jobStatus,omitempty"` + AffectedObjectType *string `json:"affectedObjectType,omitempty"` +} + +// JobTaskDetails is this class represents a task which is actually a workflow so that one can navigate to its +// individual drill down. +type JobTaskDetails struct { + JobTask *JobEntity `json:"jobTask,omitempty"` +} + +// LogicalNetwork is logical network data model. +type LogicalNetwork 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 *LogicalNetworkProperties `json:"properties,omitempty"` +} + +// LogicalNetworkCollection is list of logical networks. +type LogicalNetworkCollection struct { + autorest.Response `json:"-"` + Value *[]LogicalNetwork `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// LogicalNetworkCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client LogicalNetworkCollection) LogicalNetworkCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// LogicalNetworkProperties is logical Network Properties. +type LogicalNetworkProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + NetworkVirtualizationStatus *string `json:"networkVirtualizationStatus,omitempty"` + LogicalNetworkUsage *string `json:"logicalNetworkUsage,omitempty"` + LogicalNetworkDefinitionsStatus *string `json:"logicalNetworkDefinitionsStatus,omitempty"` +} + +// ManualActionTaskDetails is this class represents the manual action task details. +type ManualActionTaskDetails struct { + Name *string `json:"name,omitempty"` + Instructions *string `json:"instructions,omitempty"` + Observation *string `json:"observation,omitempty"` +} + +// MasterTargetServer is details of a Master Target Server. +type MasterTargetServer struct { + ID *string `json:"id,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + Name *string `json:"name,omitempty"` + OsType *string `json:"osType,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + VersionStatus *string `json:"versionStatus,omitempty"` + RetentionVolumes *[]RetentionVolume `json:"retentionVolumes,omitempty"` + DataStores *[]DataStore `json:"dataStores,omitempty"` + ValidationErrors *[]HealthError `json:"validationErrors,omitempty"` +} + +// MethodCallStatus is reports method status where exception was raised. +type MethodCallStatus struct { + IsVirtual *string `json:"isVirtual,omitempty"` + Parameters *[]string `json:"parameters,omitempty"` + ContainsGenericParameters *string `json:"containsGenericParameters,omitempty"` +} + +// MobilityServiceUpdate is the Mobility Service update details. +type MobilityServiceUpdate struct { + Version *string `json:"version,omitempty"` + RebootStatus *string `json:"rebootStatus,omitempty"` + OsType *string `json:"osType,omitempty"` +} + +// Network is network model. +type Network 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 *NetworkProperties `json:"properties,omitempty"` +} + +// NetworkCollection is list of networks. +type NetworkCollection struct { + autorest.Response `json:"-"` + Value *[]Network `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NetworkCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NetworkCollection) NetworkCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NetworkMapping is network Mapping model. Ideally it should have been possible to inherit this class from prev +// version in InheritedModels as long as there is no difference in structure or method signature. Since there were no +// base Models for certain fields and methods viz NetworkMappingProperties and Load with required return type, the +// class has been introduced in its entirety with references to base models to facilitate exensions in subsequent +// versions. +type NetworkMapping 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 *NetworkMappingProperties `json:"properties,omitempty"` +} + +// NetworkMappingCollection is list of network mappings. As with NetworkMapping, it should be possible to reuse a prev +// version of this class. It doesn't seem likely this class could be anything more than a slightly bespoke collection +// of NetworkMapping. Hence it makes sense to override Load with Base.NetworkMapping instead of existing +// CurrentVersion.NetworkMapping. +type NetworkMappingCollection struct { + autorest.Response `json:"-"` + Value *[]NetworkMapping `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NetworkMappingCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NetworkMappingCollection) NetworkMappingCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NetworkMappingFabricSpecificSettings is network Mapping fabric specific settings. +type NetworkMappingFabricSpecificSettings struct { +} + +// NetworkMappingProperties is network Mapping Properties. +type NetworkMappingProperties struct { + State *string `json:"state,omitempty"` + PrimaryNetworkFriendlyName *string `json:"primaryNetworkFriendlyName,omitempty"` + PrimaryNetworkID *string `json:"primaryNetworkId,omitempty"` + PrimaryFabricFriendlyName *string `json:"primaryFabricFriendlyName,omitempty"` + RecoveryNetworkFriendlyName *string `json:"recoveryNetworkFriendlyName,omitempty"` + RecoveryNetworkID *string `json:"recoveryNetworkId,omitempty"` + RecoveryFabricArmID *string `json:"recoveryFabricArmId,omitempty"` + RecoveryFabricFriendlyName *string `json:"recoveryFabricFriendlyName,omitempty"` + FabricSpecificSettings *NetworkMappingFabricSpecificSettings `json:"fabricSpecificSettings,omitempty"` +} + +// NetworkProperties is network Properties +type NetworkProperties struct { + FabricType *string `json:"fabricType,omitempty"` + Subnets *[]Subnet `json:"subnets,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + NetworkType *string `json:"networkType,omitempty"` +} + +// OperationsDiscovery is operations discovery class. +type OperationsDiscovery struct { + Name *string `json:"name,omitempty"` + Display *Display `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// OperationsDiscoveryCollection is collection of ClientDiscovery details. +type OperationsDiscoveryCollection struct { + autorest.Response `json:"-"` + Value *[]OperationsDiscovery `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationsDiscoveryCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationsDiscoveryCollection) OperationsDiscoveryCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OSDetails is disk Details. +type OSDetails struct { + OsType *string `json:"osType,omitempty"` + ProductType *string `json:"productType,omitempty"` + OsEdition *string `json:"osEdition,omitempty"` + OSVersion *string `json:"oSVersion,omitempty"` + OSMajorVersion *string `json:"oSMajorVersion,omitempty"` + OSMinorVersion *string `json:"oSMinorVersion,omitempty"` +} + +// OSDiskDetails is details of the OS Disk. +type OSDiskDetails struct { + OsVhdID *string `json:"osVhdId,omitempty"` + OsType *string `json:"osType,omitempty"` + VhdName *string `json:"vhdName,omitempty"` +} + +// PlannedFailoverInput is input definition for planned failover. +type PlannedFailoverInput struct { + Properties *PlannedFailoverInputProperties `json:"properties,omitempty"` +} + +// PlannedFailoverInputProperties is input definition for planned failover input properties. +type PlannedFailoverInputProperties struct { + FailoverDirection *string `json:"failoverDirection,omitempty"` + ProviderSpecificDetails *ProviderSpecificFailoverInput `json:"providerSpecificDetails,omitempty"` +} + +// Policy is protection profile details. +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"` + Properties *PolicyProperties `json:"properties,omitempty"` +} + +// PolicyCollection is protection Profile Collection details. +type PolicyCollection struct { + autorest.Response `json:"-"` + Value *[]Policy `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PolicyCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PolicyCollection) PolicyCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PolicyProperties is protection profile custom data details. +type PolicyProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + ProviderSpecificDetails *PolicyProviderSpecificDetails `json:"providerSpecificDetails,omitempty"` +} + +// PolicyProviderSpecificDetails is base class for Provider specific details for policies. +type PolicyProviderSpecificDetails struct { +} + +// PolicyProviderSpecificInput is base class for provider specific input +type PolicyProviderSpecificInput struct { +} + +// ProcessServer is details of the Process Server. +type ProcessServer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + ID *string `json:"id,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + OsType *string `json:"osType,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + VersionStatus *string `json:"versionStatus,omitempty"` + MobilityServiceUpdates *[]MobilityServiceUpdate `json:"mobilityServiceUpdates,omitempty"` + HostID *string `json:"hostId,omitempty"` + MachineCount *string `json:"machineCount,omitempty"` + ReplicationPairCount *string `json:"replicationPairCount,omitempty"` + SystemLoad *string `json:"systemLoad,omitempty"` + SystemLoadStatus *string `json:"systemLoadStatus,omitempty"` + CPULoad *string `json:"cpuLoad,omitempty"` + CPULoadStatus *string `json:"cpuLoadStatus,omitempty"` + TotalMemoryInBytes *int64 `json:"totalMemoryInBytes,omitempty"` + AvailableMemoryInBytes *int64 `json:"availableMemoryInBytes,omitempty"` + MemoryUsageStatus *string `json:"memoryUsageStatus,omitempty"` + TotalSpaceInBytes *int64 `json:"totalSpaceInBytes,omitempty"` + AvailableSpaceInBytes *int64 `json:"availableSpaceInBytes,omitempty"` + SpaceUsageStatus *string `json:"spaceUsageStatus,omitempty"` + PsServiceStatus *string `json:"psServiceStatus,omitempty"` + SslCertExpiryDate *date.Time `json:"sslCertExpiryDate,omitempty"` + SslCertExpiryRemainingDays *int32 `json:"sslCertExpiryRemainingDays,omitempty"` +} + +// ProtectableItem is replication protected item +type ProtectableItem 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 *ProtectableItemProperties `json:"properties,omitempty"` +} + +// ProtectableItemCollection is protectable item collection. +type ProtectableItemCollection struct { + autorest.Response `json:"-"` + Value *[]ProtectableItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProtectableItemCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProtectableItemCollection) ProtectableItemCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProtectableItemProperties is replication protected item custom data details. +type ProtectableItemProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + ProtectionStatus *string `json:"protectionStatus,omitempty"` + ReplicationProtectedItemID *string `json:"replicationProtectedItemId,omitempty"` + RecoveryServicesProviderID *string `json:"recoveryServicesProviderId,omitempty"` + ProtectionReadinessErrors *[]string `json:"protectionReadinessErrors,omitempty"` + SupportedReplicationProviders *[]string `json:"supportedReplicationProviders,omitempty"` + CustomDetails *ConfigurationSettings `json:"customDetails,omitempty"` +} + +// ProtectedItemsQueryParameter is query parameter to enumerate protected items. +type ProtectedItemsQueryParameter struct { + SourceFabricName *string `json:"sourceFabricName,omitempty"` + RecoveryPlanName *string `json:"recoveryPlanName,omitempty"` +} + +// ProtectionContainer is protection container details. +type ProtectionContainer 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 *ProtectionContainerProperties `json:"properties,omitempty"` +} + +// ProtectionContainerCollection is protection Container collection. +type ProtectionContainerCollection struct { + autorest.Response `json:"-"` + Value *[]ProtectionContainer `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProtectionContainerCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProtectionContainerCollection) ProtectionContainerCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProtectionContainerFabricSpecificDetails is base class for fabric specific details of container. +type ProtectionContainerFabricSpecificDetails struct { + InstanceType *string `json:"instanceType,omitempty"` +} + +// ProtectionContainerMapping is protection container mapping object. +type ProtectionContainerMapping 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 *ProtectionContainerMappingProperties `json:"properties,omitempty"` +} + +// ProtectionContainerMappingCollection is protection container mapping collection class. +type ProtectionContainerMappingCollection struct { + autorest.Response `json:"-"` + Value *[]ProtectionContainerMapping `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProtectionContainerMappingCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProtectionContainerMappingCollection) ProtectionContainerMappingCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProtectionContainerMappingProperties is protection container mapping properties. +type ProtectionContainerMappingProperties struct { + TargetProtectionContainerID *string `json:"targetProtectionContainerId,omitempty"` + TargetProtectionContainerFriendlyName *string `json:"targetProtectionContainerFriendlyName,omitempty"` + ProviderSpecificDetails *ProtectionContainerMappingProviderSpecificDetails `json:"providerSpecificDetails,omitempty"` + Health *string `json:"health,omitempty"` + HealthErrorDetails *[]HealthError `json:"healthErrorDetails,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + State *string `json:"state,omitempty"` + SourceProtectionContainerFriendlyName *string `json:"sourceProtectionContainerFriendlyName,omitempty"` + SourceFabricFriendlyName *string `json:"sourceFabricFriendlyName,omitempty"` + TargetFabricFriendlyName *string `json:"targetFabricFriendlyName,omitempty"` + PolicyFriendlyName *string `json:"policyFriendlyName,omitempty"` +} + +// ProtectionContainerMappingProviderSpecificDetails is container mapping provider specific details. +type ProtectionContainerMappingProviderSpecificDetails struct { + InstanceType *string `json:"instanceType,omitempty"` +} + +// ProtectionContainerProperties is protection profile custom data details. +type ProtectionContainerProperties struct { + FabricFriendlyName *string `json:"fabricFriendlyName,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + FabricType *string `json:"fabricType,omitempty"` + ProtectedItemCount *int32 `json:"protectedItemCount,omitempty"` + PairingStatus *string `json:"pairingStatus,omitempty"` + Role *string `json:"role,omitempty"` + FabricSpecificDetails *ProtectionContainerFabricSpecificDetails `json:"fabricSpecificDetails,omitempty"` +} + +// ProviderError is this class contains the error details per object. +type ProviderError struct { + ErrorCode *int32 `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + ErrorID *string `json:"errorId,omitempty"` + PossibleCauses *string `json:"possibleCauses,omitempty"` + RecommendedAction *string `json:"recommendedAction,omitempty"` +} + +// ProviderSpecificFailoverInput is provider specific failover input. +type ProviderSpecificFailoverInput struct { +} + +// RecoveryPlan is recovery plan details. +type RecoveryPlan 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 *RecoveryPlanProperties `json:"properties,omitempty"` +} + +// RecoveryPlanA2AFailoverInput is recovery plan A2A failover input. +type RecoveryPlanA2AFailoverInput struct { + RecoveryPointType A2ARpRecoveryPointType `json:"recoveryPointType,omitempty"` + CloudServiceCreationOption *string `json:"cloudServiceCreationOption,omitempty"` +} + +// RecoveryPlanAction is recovery plan action details. +type RecoveryPlanAction struct { + ActionName *string `json:"actionName,omitempty"` + FailoverTypes *[]ReplicationProtectedItemOperation `json:"failoverTypes,omitempty"` + FailoverDirections *[]PossibleOperationsDirections `json:"failoverDirections,omitempty"` + CustomDetails *RecoveryPlanActionDetails `json:"customDetails,omitempty"` +} + +// RecoveryPlanActionDetails is recovery plan action custom details. +type RecoveryPlanActionDetails struct { +} + +// RecoveryPlanAutomationRunbookActionDetails is recovery plan Automation runbook action details. +type RecoveryPlanAutomationRunbookActionDetails struct { + RunbookID *string `json:"runbookId,omitempty"` + Timeout *string `json:"timeout,omitempty"` + FabricLocation RecoveryPlanActionLocation `json:"fabricLocation,omitempty"` +} + +// RecoveryPlanCollection is recovery plan collection details. +type RecoveryPlanCollection struct { + autorest.Response `json:"-"` + Value *[]RecoveryPlan `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RecoveryPlanCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RecoveryPlanCollection) RecoveryPlanCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecoveryPlanGroup is recovery plan group details. +type RecoveryPlanGroup struct { + GroupType RecoveryPlanGroupType `json:"groupType,omitempty"` + ReplicationProtectedItems *[]RecoveryPlanProtectedItem `json:"replicationProtectedItems,omitempty"` + StartGroupActions *[]RecoveryPlanAction `json:"startGroupActions,omitempty"` + EndGroupActions *[]RecoveryPlanAction `json:"endGroupActions,omitempty"` +} + +// RecoveryPlanGroupTaskDetails is this class represents the recovery plan group task. +type RecoveryPlanGroupTaskDetails struct { + ChildTasks *[]ASRTask `json:"childTasks,omitempty"` + Name *string `json:"name,omitempty"` + GroupID *string `json:"groupId,omitempty"` + RpGroupType *string `json:"rpGroupType,omitempty"` +} + +// RecoveryPlanHyperVReplicaAzureFailbackInput is recovery plan HVR Azure failback input. +type RecoveryPlanHyperVReplicaAzureFailbackInput struct { + DataSyncOption DataSyncStatus `json:"dataSyncOption,omitempty"` + RecoveryVMCreationOption AlternateLocationRecoveryOption `json:"recoveryVmCreationOption,omitempty"` +} + +// RecoveryPlanHyperVReplicaAzureFailoverInput is recovery plan HVR Azure failover input. +type RecoveryPlanHyperVReplicaAzureFailoverInput struct { + VaultLocation *string `json:"vaultLocation,omitempty"` + PrimaryKekCertificatePfx *string `json:"primaryKekCertificatePfx,omitempty"` + SecondaryKekCertificatePfx *string `json:"secondaryKekCertificatePfx,omitempty"` + RecoveryPointType HyperVReplicaAzureRpRecoveryPointType `json:"recoveryPointType,omitempty"` +} + +// RecoveryPlanInMageAzureV2FailoverInput is recovery plan InMageAzureV2 failover input. +type RecoveryPlanInMageAzureV2FailoverInput struct { + VaultLocation *string `json:"vaultLocation,omitempty"` + RecoveryPointType InMageV2RpRecoveryPointType `json:"recoveryPointType,omitempty"` +} + +// RecoveryPlanInMageFailoverInput is recovery plan InMage failover input. +type RecoveryPlanInMageFailoverInput struct { + RecoveryPointType RpInMageRecoveryPointType `json:"recoveryPointType,omitempty"` +} + +// RecoveryPlanManualActionDetails is recovery plan manual action details. +type RecoveryPlanManualActionDetails struct { + Description *string `json:"description,omitempty"` +} + +// RecoveryPlanPlannedFailoverInput is recovery plan planned failover input. +type RecoveryPlanPlannedFailoverInput struct { + Properties *RecoveryPlanPlannedFailoverInputProperties `json:"properties,omitempty"` +} + +// RecoveryPlanPlannedFailoverInputProperties is recovery plan planned failover input properties. +type RecoveryPlanPlannedFailoverInputProperties struct { + FailoverDirection PossibleOperationsDirections `json:"failoverDirection,omitempty"` + ProviderSpecificDetails *[]RecoveryPlanProviderSpecificFailoverInput `json:"providerSpecificDetails,omitempty"` +} + +// RecoveryPlanProperties is recovery plan custom details. +type RecoveryPlanProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + PrimaryFabricID *string `json:"primaryFabricId,omitempty"` + PrimaryFabricFriendlyName *string `json:"primaryFabricFriendlyName,omitempty"` + RecoveryFabricID *string `json:"recoveryFabricId,omitempty"` + RecoveryFabricFriendlyName *string `json:"recoveryFabricFriendlyName,omitempty"` + FailoverDeploymentModel *string `json:"failoverDeploymentModel,omitempty"` + ReplicationProviders *[]string `json:"replicationProviders,omitempty"` + AllowedOperations *[]string `json:"allowedOperations,omitempty"` + LastPlannedFailoverTime *date.Time `json:"lastPlannedFailoverTime,omitempty"` + LastTestFailoverTime *date.Time `json:"lastTestFailoverTime,omitempty"` + CurrentScenario *CurrentScenarioDetails `json:"currentScenario,omitempty"` + CurrentScenarioStatus *string `json:"currentScenarioStatus,omitempty"` + CurrentScenarioStatusDescription *string `json:"currentScenarioStatusDescription,omitempty"` + Groups *[]RecoveryPlanGroup `json:"groups,omitempty"` +} + +// RecoveryPlanProtectedItem is recovery plan protected item. +type RecoveryPlanProtectedItem struct { + ID *string `json:"id,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` +} + +// RecoveryPlanProviderSpecificFailoverInput is recovery plan provider specific failover input base class. +type RecoveryPlanProviderSpecificFailoverInput struct { +} + +// RecoveryPlanScriptActionDetails is recovery plan script action details. +type RecoveryPlanScriptActionDetails struct { + Path *string `json:"path,omitempty"` + Timeout *string `json:"timeout,omitempty"` + FabricLocation RecoveryPlanActionLocation `json:"fabricLocation,omitempty"` +} + +// RecoveryPlanShutdownGroupTaskDetails is this class represents the recovery plan shutdown group task details. +type RecoveryPlanShutdownGroupTaskDetails struct { + ChildTasks *[]ASRTask `json:"childTasks,omitempty"` + Name *string `json:"name,omitempty"` + GroupID *string `json:"groupId,omitempty"` + RpGroupType *string `json:"rpGroupType,omitempty"` +} + +// RecoveryPlanTestFailoverCleanupInput is recovery plan test failover cleanup input. +type RecoveryPlanTestFailoverCleanupInput struct { + Properties *RecoveryPlanTestFailoverCleanupInputProperties `json:"properties,omitempty"` +} + +// RecoveryPlanTestFailoverCleanupInputProperties is recovery plan test failover cleanup input properties. +type RecoveryPlanTestFailoverCleanupInputProperties struct { + Comments *string `json:"comments,omitempty"` +} + +// RecoveryPlanTestFailoverInput is recovery plan test failover input. +type RecoveryPlanTestFailoverInput struct { + Properties *RecoveryPlanTestFailoverInputProperties `json:"properties,omitempty"` +} + +// RecoveryPlanTestFailoverInputProperties is recovery plan test failover input properties. +type RecoveryPlanTestFailoverInputProperties struct { + FailoverDirection PossibleOperationsDirections `json:"failoverDirection,omitempty"` + NetworkType *string `json:"networkType,omitempty"` + NetworkID *string `json:"networkId,omitempty"` + SkipTestFailoverCleanup *string `json:"skipTestFailoverCleanup,omitempty"` + ProviderSpecificDetails *[]RecoveryPlanProviderSpecificFailoverInput `json:"providerSpecificDetails,omitempty"` +} + +// RecoveryPlanUnplannedFailoverInput is recovery plan unplanned failover input. +type RecoveryPlanUnplannedFailoverInput struct { + Properties *RecoveryPlanUnplannedFailoverInputProperties `json:"properties,omitempty"` +} + +// RecoveryPlanUnplannedFailoverInputProperties is recovery plan unplanned failover input properties. +type RecoveryPlanUnplannedFailoverInputProperties struct { + FailoverDirection PossibleOperationsDirections `json:"failoverDirection,omitempty"` + SourceSiteOperations SourceSiteOperations `json:"sourceSiteOperations,omitempty"` + ProviderSpecificDetails *[]RecoveryPlanProviderSpecificFailoverInput `json:"providerSpecificDetails,omitempty"` +} + +// RecoveryPoint is base class representing a recovery point. +type RecoveryPoint 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 *RecoveryPointProperties `json:"properties,omitempty"` +} + +// RecoveryPointCollection is collection of recovery point details. +type RecoveryPointCollection struct { + autorest.Response `json:"-"` + Value *[]RecoveryPoint `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RecoveryPointCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RecoveryPointCollection) RecoveryPointCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecoveryPointProperties is recovery point properties. +type RecoveryPointProperties struct { + RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` + RecoveryPointType *string `json:"recoveryPointType,omitempty"` +} + +// RecoveryServicesProvider is provider details. +type RecoveryServicesProvider 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 *RecoveryServicesProviderProperties `json:"properties,omitempty"` +} + +// RecoveryServicesProviderCollection is collection of providers. +type RecoveryServicesProviderCollection struct { + autorest.Response `json:"-"` + Value *[]RecoveryServicesProvider `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RecoveryServicesProviderCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RecoveryServicesProviderCollection) RecoveryServicesProviderCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecoveryServicesProviderProperties is recovery services provider properties. +type RecoveryServicesProviderProperties struct { + FabricType *string `json:"fabricType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ProviderVersion *string `json:"providerVersion,omitempty"` + ServerVersion *string `json:"serverVersion,omitempty"` + ProviderVersionState *string `json:"providerVersionState,omitempty"` + ProviderVersionExpiryDate *date.Time `json:"providerVersionExpiryDate,omitempty"` + FabricFriendlyName *string `json:"fabricFriendlyName,omitempty"` + LastHeartBeat *date.Time `json:"lastHeartBeat,omitempty"` + ConnectionStatus *string `json:"connectionStatus,omitempty"` + ProtectedItemCount *int32 `json:"protectedItemCount,omitempty"` + AllowedScenarios *[]string `json:"allowedScenarios,omitempty"` + HealthErrorDetails *[]HealthError `json:"healthErrorDetails,omitempty"` +} + +// RemoveProtectionContainerMappingInput is container unpairing input. +type RemoveProtectionContainerMappingInput struct { + Properties *RemoveProtectionContainerMappingInputProperties `json:"properties,omitempty"` +} + +// RemoveProtectionContainerMappingInputProperties is unpairing input properties. +type RemoveProtectionContainerMappingInputProperties struct { + ProviderSpecificInput *ReplicationProviderContainerUnmappingInput `json:"providerSpecificInput,omitempty"` +} + +// RenewCertificateInput is certificate renewal input. +type RenewCertificateInput struct { + Properties *RenewCertificateInputProperties `json:"properties,omitempty"` +} + +// RenewCertificateInputProperties is renew Certificate input properties. +type RenewCertificateInputProperties struct { + RenewCertificateType *string `json:"renewCertificateType,omitempty"` +} + +// ReplicationGroupDetails is replication group details. This will be used in case of San and Wvr. +type ReplicationGroupDetails struct { +} + +// ReplicationProtectedItem is replication protected item. +type ReplicationProtectedItem 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 *ReplicationProtectedItemProperties `json:"properties,omitempty"` +} + +// ReplicationProtectedItemCollection is replication protected item collection. +type ReplicationProtectedItemCollection struct { + autorest.Response `json:"-"` + Value *[]ReplicationProtectedItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ReplicationProtectedItemCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ReplicationProtectedItemCollection) ReplicationProtectedItemCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ReplicationProtectedItemProperties is replication protected item custom data details. +type ReplicationProtectedItemProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + ProtectedItemType *string `json:"protectedItemType,omitempty"` + ProtectableItemID *string `json:"protectableItemId,omitempty"` + RecoveryServicesProviderID *string `json:"recoveryServicesProviderId,omitempty"` + PrimaryFabricFriendlyName *string `json:"primaryFabricFriendlyName,omitempty"` + RecoveryFabricFriendlyName *string `json:"recoveryFabricFriendlyName,omitempty"` + RecoveryFabricID *string `json:"recoveryFabricId,omitempty"` + PrimaryProtectionContainerFriendlyName *string `json:"primaryProtectionContainerFriendlyName,omitempty"` + RecoveryProtectionContainerFriendlyName *string `json:"recoveryProtectionContainerFriendlyName,omitempty"` + ProtectionState *string `json:"protectionState,omitempty"` + ProtectionStateDescription *string `json:"protectionStateDescription,omitempty"` + ActiveLocation *string `json:"activeLocation,omitempty"` + TestFailoverState *string `json:"testFailoverState,omitempty"` + TestFailoverStateDescription *string `json:"testFailoverStateDescription,omitempty"` + AllowedOperations *[]string `json:"allowedOperations,omitempty"` + ReplicationHealth *string `json:"replicationHealth,omitempty"` + ReplicationHealthErrors *[]HealthError `json:"replicationHealthErrors,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + PolicyFriendlyName *string `json:"policyFriendlyName,omitempty"` + LastSuccessfulFailoverTime *date.Time `json:"lastSuccessfulFailoverTime,omitempty"` + LastSuccessfulTestFailoverTime *date.Time `json:"lastSuccessfulTestFailoverTime,omitempty"` + CurrentScenario *CurrentScenarioDetails `json:"currentScenario,omitempty"` + FailoverRecoveryPointID *string `json:"failoverRecoveryPointId,omitempty"` + ProviderSpecificDetails *ReplicationProviderSpecificSettings `json:"providerSpecificDetails,omitempty"` + RecoveryContainerID *string `json:"recoveryContainerId,omitempty"` +} + +// ReplicationProviderContainerUnmappingInput is provider specific input for unpairing operations. +type ReplicationProviderContainerUnmappingInput struct { + InstanceType *string `json:"instanceType,omitempty"` +} + +// ReplicationProviderSpecificContainerCreationInput is provider specific input for container creation operation. +type ReplicationProviderSpecificContainerCreationInput struct { +} + +// ReplicationProviderSpecificContainerMappingInput is provider specific input for pairing operations. +type ReplicationProviderSpecificContainerMappingInput struct { + InstanceType *string `json:"instanceType,omitempty"` +} + +// ReplicationProviderSpecificSettings is replication provider specific settings. +type ReplicationProviderSpecificSettings struct { +} + +// Resource is 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"` +} + +// ResumeJobParams is resume job params. +type ResumeJobParams struct { + Properties *ResumeJobParamsProperties `json:"properties,omitempty"` +} + +// ResumeJobParamsProperties is resume job properties. +type ResumeJobParamsProperties struct { + Comments *string `json:"comments,omitempty"` +} + +// RetentionVolume is the retention details of the MT. +type RetentionVolume struct { + VolumeName *string `json:"volumeName,omitempty"` + CapacityInBytes *int64 `json:"capacityInBytes,omitempty"` + FreeSpaceInBytes *int64 `json:"freeSpaceInBytes,omitempty"` + ThresholdPercentage *int32 `json:"thresholdPercentage,omitempty"` +} + +// ReverseReplicationInput is reverse replication input. +type ReverseReplicationInput struct { + Properties *ReverseReplicationInputProperties `json:"properties,omitempty"` +} + +// ReverseReplicationInputProperties is reverse replication input properties. +type ReverseReplicationInputProperties struct { + FailoverDirection *string `json:"failoverDirection,omitempty"` + ProviderSpecificDetails *ReverseReplicationProviderSpecificInput `json:"providerSpecificDetails,omitempty"` +} + +// ReverseReplicationProviderSpecificInput is provider specific reverse replication input. +type ReverseReplicationProviderSpecificInput struct { +} + +// RoleAssignment is azure role assignment details. +type RoleAssignment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Scope *string `json:"scope,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` +} + +// RunAsAccount is CS Accounts Details. +type RunAsAccount struct { + AccountID *string `json:"accountId,omitempty"` + AccountName *string `json:"accountName,omitempty"` +} + +// SanEnableProtectionInput is san enable protection provider specific input. +type SanEnableProtectionInput struct { +} + +// ScriptActionTaskDetails is this class represents the script action task details. +type ScriptActionTaskDetails struct { + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` + Output *string `json:"output,omitempty"` + IsPrimarySideScript *bool `json:"isPrimarySideScript,omitempty"` +} + +// ServiceError is ASR error model +type ServiceError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + PossibleCauses *string `json:"possibleCauses,omitempty"` + RecommendedAction *string `json:"recommendedAction,omitempty"` + ActivityID *string `json:"activityId,omitempty"` +} + +// StorageClassification is storage object definition. +type StorageClassification 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 *StorageClassificationProperties `json:"properties,omitempty"` +} + +// StorageClassificationCollection is collection of storage details. +type StorageClassificationCollection struct { + autorest.Response `json:"-"` + Value *[]StorageClassification `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageClassificationCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client StorageClassificationCollection) StorageClassificationCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// StorageClassificationMapping is storage mapping object. +type StorageClassificationMapping 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 *StorageClassificationMappingProperties `json:"properties,omitempty"` +} + +// StorageClassificationMappingCollection is collection of storage mapping details. +type StorageClassificationMappingCollection struct { + autorest.Response `json:"-"` + Value *[]StorageClassificationMapping `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageClassificationMappingCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client StorageClassificationMappingCollection) StorageClassificationMappingCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// StorageClassificationMappingInput is storage mapping input. +type StorageClassificationMappingInput struct { + Properties *StorageMappingInputProperties `json:"properties,omitempty"` +} + +// StorageClassificationMappingProperties is storage mapping properties. +type StorageClassificationMappingProperties struct { + TargetStorageClassificationID *string `json:"targetStorageClassificationId,omitempty"` +} + +// StorageClassificationProperties is storage object properties. +type StorageClassificationProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// StorageMappingInputProperties is storage mapping input properties. +type StorageMappingInputProperties struct { + TargetStorageClassificationID *string `json:"targetStorageClassificationId,omitempty"` +} + +// Subnet is subnets of the network. +type Subnet struct { + Name *string `json:"name,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + AddressList *[]string `json:"addressList,omitempty"` +} + +// SwitchProtectionInput is switch protection input. +type SwitchProtectionInput struct { + Properties *SwitchProtectionInputProperties `json:"properties,omitempty"` +} + +// SwitchProtectionInputProperties is switch protection input properties. +type SwitchProtectionInputProperties struct { + ReplicationProtectedItemName *string `json:"replicationProtectedItemName,omitempty"` + ProviderSpecificDetails *SwitchProtectionProviderSpecificInput `json:"providerSpecificDetails,omitempty"` +} + +// SwitchProtectionJobDetails is this class represents details for switch protection job. +type SwitchProtectionJobDetails struct { + AffectedObjectDetails *map[string]*string `json:"affectedObjectDetails,omitempty"` + NewReplicationProtectedItemID *string `json:"newReplicationProtectedItemId,omitempty"` +} + +// SwitchProtectionProviderSpecificInput is provider specific switch protection input. +type SwitchProtectionProviderSpecificInput struct { +} + +// TaskTypeDetails is task details based on specific task type. +type TaskTypeDetails struct { +} + +// TestFailoverCleanupInput is input definition for test failover cleanup. +type TestFailoverCleanupInput struct { + Properties *TestFailoverCleanupInputProperties `json:"properties,omitempty"` +} + +// TestFailoverCleanupInputProperties is input definition for test failover cleanup input properties. +type TestFailoverCleanupInputProperties struct { + Comments *string `json:"comments,omitempty"` +} + +// TestFailoverInput is input definition for planned failover. +type TestFailoverInput struct { + Properties *TestFailoverInputProperties `json:"properties,omitempty"` +} + +// TestFailoverInputProperties is input definition for planned failover input properties. +type TestFailoverInputProperties struct { + FailoverDirection *string `json:"failoverDirection,omitempty"` + NetworkType *string `json:"networkType,omitempty"` + NetworkID *string `json:"networkId,omitempty"` + SkipTestFailoverCleanup *string `json:"skipTestFailoverCleanup,omitempty"` + ProviderSpecificDetails *ProviderSpecificFailoverInput `json:"providerSpecificDetails,omitempty"` +} + +// TestFailoverJobDetails is this class represents the details for a test failover job. +type TestFailoverJobDetails struct { + AffectedObjectDetails *map[string]*string `json:"affectedObjectDetails,omitempty"` + TestFailoverStatus *string `json:"testFailoverStatus,omitempty"` + Comments *string `json:"comments,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + NetworkFriendlyName *string `json:"networkFriendlyName,omitempty"` + NetworkType *string `json:"networkType,omitempty"` + ProtectedItemDetails *[]TestFailoverReplicationProtectedItemDetails `json:"protectedItemDetails,omitempty"` +} + +// TestFailoverReplicationProtectedItemDetails is test failover details for a replication protected item. +type TestFailoverReplicationProtectedItemDetails struct { + Name *string `json:"name,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + TestVMName *string `json:"testVmName,omitempty"` + TestVMFriendlyName *string `json:"testVmFriendlyName,omitempty"` + NetworkConnectionStatus *string `json:"networkConnectionStatus,omitempty"` + NetworkFriendlyName *string `json:"networkFriendlyName,omitempty"` + Subnet *string `json:"subnet,omitempty"` +} + +// UnplannedFailoverInput is input definition for planned failover. +type UnplannedFailoverInput struct { + Properties *UnplannedFailoverInputProperties `json:"properties,omitempty"` +} + +// UnplannedFailoverInputProperties is input definition for planned failover input properties. +type UnplannedFailoverInputProperties struct { + FailoverDirection *string `json:"failoverDirection,omitempty"` + SourceSiteOperations *string `json:"sourceSiteOperations,omitempty"` + ProviderSpecificDetails *ProviderSpecificFailoverInput `json:"providerSpecificDetails,omitempty"` +} + +// UpdateMobilityServiceRequest is request to update the mobility service on a protected item. +type UpdateMobilityServiceRequest struct { + Properties *UpdateMobilityServiceRequestProperties `json:"properties,omitempty"` +} + +// UpdateMobilityServiceRequestProperties is the properties of an update mobility service request. +type UpdateMobilityServiceRequestProperties struct { + RunAsAccountID *string `json:"runAsAccountId,omitempty"` +} + +// UpdateNetworkMappingInput is update network mapping input. +type UpdateNetworkMappingInput struct { + Properties *UpdateNetworkMappingInputProperties `json:"properties,omitempty"` +} + +// UpdateNetworkMappingInputProperties is common input details for network mapping operation. +type UpdateNetworkMappingInputProperties struct { + RecoveryFabricName *string `json:"recoveryFabricName,omitempty"` + RecoveryNetworkID *string `json:"recoveryNetworkId,omitempty"` + FabricSpecificDetails *FabricSpecificUpdateNetworkMappingInput `json:"fabricSpecificDetails,omitempty"` +} + +// UpdatePolicyInput is update protection profile input. +type UpdatePolicyInput struct { + Properties *UpdatePolicyInputProperties `json:"properties,omitempty"` +} + +// UpdatePolicyInputProperties is policy update properties. +type UpdatePolicyInputProperties struct { + ReplicationProviderSettings *PolicyProviderSpecificInput `json:"replicationProviderSettings,omitempty"` +} + +// UpdateRecoveryPlanInput is update recovery plan input class. +type UpdateRecoveryPlanInput struct { + Properties *UpdateRecoveryPlanInputProperties `json:"properties,omitempty"` +} + +// UpdateRecoveryPlanInputProperties is recovery plan updation properties. +type UpdateRecoveryPlanInputProperties struct { + Groups *[]RecoveryPlanGroup `json:"groups,omitempty"` +} + +// UpdateReplicationProtectedItemInput is update replication protected item input. +type UpdateReplicationProtectedItemInput struct { + Properties *UpdateReplicationProtectedItemInputProperties `json:"properties,omitempty"` +} + +// UpdateReplicationProtectedItemInputProperties is update protected item input properties. +type UpdateReplicationProtectedItemInputProperties struct { + RecoveryAzureVMName *string `json:"recoveryAzureVMName,omitempty"` + RecoveryAzureVMSize *string `json:"recoveryAzureVMSize,omitempty"` + SelectedRecoveryAzureNetworkID *string `json:"selectedRecoveryAzureNetworkId,omitempty"` + EnableRDPOnTargetOption *string `json:"enableRDPOnTargetOption,omitempty"` + VMNics *[]VMNicInputDetails `json:"vmNics,omitempty"` + LicenseType LicenseType `json:"licenseType,omitempty"` + RecoveryAvailabilitySetID *string `json:"recoveryAvailabilitySetId,omitempty"` + ProviderSpecificDetails *UpdateReplicationProtectedItemProviderInput `json:"providerSpecificDetails,omitempty"` +} + +// UpdateReplicationProtectedItemProviderInput is update replication protected item provider specific input. +type UpdateReplicationProtectedItemProviderInput struct { +} + +// UpdateVCenterRequest is input required to update vCenter. +type UpdateVCenterRequest struct { + Properties *UpdateVCenterRequestProperties `json:"properties,omitempty"` +} + +// UpdateVCenterRequestProperties is the properties of an update vCenter request. +type UpdateVCenterRequestProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + Port *string `json:"port,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` +} + +// VCenter is vCenter definition. +type VCenter 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 *VCenterProperties `json:"properties,omitempty"` +} + +// VCenterCollection is collection of vCenter details. +type VCenterCollection struct { + autorest.Response `json:"-"` + Value *[]VCenter `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VCenterCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VCenterCollection) VCenterCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VCenterProperties is vCenter properties. +type VCenterProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + InternalID *string `json:"internalId,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + DiscoveryStatus *string `json:"discoveryStatus,omitempty"` + ProcessServerID *string `json:"processServerId,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + InfrastructureID *string `json:"infrastructureId,omitempty"` + Port *string `json:"port,omitempty"` + RunAsAccountID *string `json:"runAsAccountId,omitempty"` + FabricArmResourceName *string `json:"fabricArmResourceName,omitempty"` +} + +// VirtualMachineTaskDetails is this class represents the virtual machine task details. +type VirtualMachineTaskDetails struct { + SkippedReason *string `json:"skippedReason,omitempty"` + SkippedReasonString *string `json:"skippedReasonString,omitempty"` + JobTask *JobEntity `json:"jobTask,omitempty"` +} + +// VmmDetails is VMM fabric specific details. +type VmmDetails struct { +} + +// VmmToAzureCreateNetworkMappingInput is create network mappings input properties/behaviour specific to Vmm to Azure +// Network mapping. +type VmmToAzureCreateNetworkMappingInput struct { +} + +// VmmToAzureNetworkMappingSettings is e2A Network Mapping fabric specific settings. +type VmmToAzureNetworkMappingSettings struct { +} + +// VmmToAzureUpdateNetworkMappingInput is update network mappings input properties/behaviour specific to vmm to azure. +type VmmToAzureUpdateNetworkMappingInput struct { +} + +// VmmToVmmCreateNetworkMappingInput is create network mappings input properties/behaviour specific to vmm to vmm +// Network mapping. +type VmmToVmmCreateNetworkMappingInput struct { +} + +// VmmToVmmNetworkMappingSettings is e2E Network Mapping fabric specific settings. +type VmmToVmmNetworkMappingSettings struct { +} + +// VmmToVmmUpdateNetworkMappingInput is update network mappings input properties/behaviour specific to vmm to vmm. +type VmmToVmmUpdateNetworkMappingInput struct { +} + +// VMNicDetails is hyper V VM network details. +type VMNicDetails struct { + NicID *string `json:"nicId,omitempty"` + ReplicaNicID *string `json:"replicaNicId,omitempty"` + SourceNicArmID *string `json:"sourceNicArmId,omitempty"` + VMSubnetName *string `json:"vMSubnetName,omitempty"` + VMNetworkName *string `json:"vMNetworkName,omitempty"` + RecoveryVMNetworkID *string `json:"recoveryVMNetworkId,omitempty"` + RecoveryVMSubnetName *string `json:"recoveryVMSubnetName,omitempty"` + IPAddressType *string `json:"ipAddressType,omitempty"` + PrimaryNicStaticIPAddress *string `json:"primaryNicStaticIPAddress,omitempty"` + ReplicaNicStaticIPAddress *string `json:"replicaNicStaticIPAddress,omitempty"` + SelectionType *string `json:"selectionType,omitempty"` +} + +// VMNicInputDetails is hyper V VM network input details. +type VMNicInputDetails struct { + NicID *string `json:"nicId,omitempty"` + RecoveryVMSubnetName *string `json:"recoveryVMSubnetName,omitempty"` + ReplicaNicStaticIPAddress *string `json:"replicaNicStaticIPAddress,omitempty"` + SelectionType *string `json:"selectionType,omitempty"` +} + +// VMNicUpdatesTaskDetails is this class represents the vm NicUpdates task details. +type VMNicUpdatesTaskDetails struct { + VMID *string `json:"vmId,omitempty"` + NicID *string `json:"nicId,omitempty"` + Name *string `json:"name,omitempty"` +} + +// VMwareDetails is store the fabric details specific to the VMware fabric. +type VMwareDetails struct { + ProcessServers *[]ProcessServer `json:"processServers,omitempty"` + MasterTargetServers *[]MasterTargetServer `json:"masterTargetServers,omitempty"` + RunAsAccounts *[]RunAsAccount `json:"runAsAccounts,omitempty"` + ReplicationPairCount *string `json:"replicationPairCount,omitempty"` + ProcessServerCount *string `json:"processServerCount,omitempty"` + AgentCount *string `json:"agentCount,omitempty"` + ProtectedServers *string `json:"protectedServers,omitempty"` + SystemLoad *string `json:"systemLoad,omitempty"` + SystemLoadStatus *string `json:"systemLoadStatus,omitempty"` + CPULoad *string `json:"cpuLoad,omitempty"` + CPULoadStatus *string `json:"cpuLoadStatus,omitempty"` + TotalMemoryInBytes *int64 `json:"totalMemoryInBytes,omitempty"` + AvailableMemoryInBytes *int64 `json:"availableMemoryInBytes,omitempty"` + MemoryUsageStatus *string `json:"memoryUsageStatus,omitempty"` + TotalSpaceInBytes *int64 `json:"totalSpaceInBytes,omitempty"` + AvailableSpaceInBytes *int64 `json:"availableSpaceInBytes,omitempty"` + SpaceUsageStatus *string `json:"spaceUsageStatus,omitempty"` + WebLoad *string `json:"webLoad,omitempty"` + WebLoadStatus *string `json:"webLoadStatus,omitempty"` + DatabaseServerLoad *string `json:"databaseServerLoad,omitempty"` + DatabaseServerLoadStatus *string `json:"databaseServerLoadStatus,omitempty"` + CsServiceStatus *string `json:"csServiceStatus,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + HostName *string `json:"hostName,omitempty"` + LastHeartbeat *date.Time `json:"lastHeartbeat,omitempty"` + VersionStatus *string `json:"versionStatus,omitempty"` + SslCertExpiryDate *date.Time `json:"sslCertExpiryDate,omitempty"` + SslCertExpiryRemainingDays *int32 `json:"sslCertExpiryRemainingDays,omitempty"` + PsTemplateVersion *string `json:"psTemplateVersion,omitempty"` +} + +// VMwareVirtualMachineDetails is vMware provider specific settings +type VMwareVirtualMachineDetails struct { + AgentGeneratedID *string `json:"agentGeneratedId,omitempty"` + AgentInstalled *string `json:"agentInstalled,omitempty"` + OsType *string `json:"osType,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + PoweredOn *string `json:"poweredOn,omitempty"` + VCenterInfrastructureID *string `json:"vCenterInfrastructureId,omitempty"` + DiscoveryType *string `json:"discoveryType,omitempty"` + DiskDetails *[]InMageDiskDetails `json:"diskDetails,omitempty"` + ValidationErrors *[]HealthError `json:"validationErrors,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/operations.go new file mode 100644 index 000000000..50e58e1ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/operations.go @@ -0,0 +1,170 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Recoveryservicessiterecovery service. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string, resourceGroupName string, resourceName string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// List operation to return the list of available operations. +func (client OperationsClient) List() (result OperationsDiscoveryCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.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, "recoveryservicessiterecovery.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.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 OperationsDiscoveryCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.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 OperationsDiscoveryCollection) (result OperationsDiscoveryCollection, err error) { + req, err := lastResults.OperationsDiscoveryCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.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, "recoveryservicessiterecovery.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan OperationsDiscovery, <-chan error) { + resultChan := make(chan OperationsDiscovery) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/recoverypoints.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/recoverypoints.go new file mode 100644 index 000000000..b279e5c47 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/recoverypoints.go @@ -0,0 +1,247 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Recoveryservicessiterecovery service. +type RecoveryPointsClient struct { + ManagementClient +} + +// NewRecoveryPointsClient creates an instance of the RecoveryPointsClient client. +func NewRecoveryPointsClient(subscriptionID string, resourceGroupName string, resourceName string) RecoveryPointsClient { + return NewRecoveryPointsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewRecoveryPointsClientWithBaseURI creates an instance of the RecoveryPointsClient client. +func NewRecoveryPointsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) RecoveryPointsClient { + return RecoveryPointsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Get get the details of specified recovery point. +// +// fabricName is the fabric name. protectionContainerName is the protection container name. replicatedProtectedItemName +// is the replication protected item's name. recoveryPointName is the recovery point name. +func (client RecoveryPointsClient) Get(fabricName string, protectionContainerName string, replicatedProtectedItemName string, recoveryPointName string) (result RecoveryPoint, err error) { + req, err := client.GetPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, recoveryPointName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.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, "recoveryservicessiterecovery.RecoveryPointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecoveryPointsClient) GetPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, recoveryPointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "recoveryPointName": autorest.Encode("path", recoveryPointName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return 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 RecoveryPoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationProtectedItems lists the available recovery points for a replication protected item. +// +// fabricName is the fabric name. protectionContainerName is the protection container name. replicatedProtectedItemName +// is the replication protected item's name. +func (client RecoveryPointsClient) ListByReplicationProtectedItems(fabricName string, protectionContainerName string, replicatedProtectedItemName string) (result RecoveryPointCollection, err error) { + req, err := client.ListByReplicationProtectedItemsPreparer(fabricName, protectionContainerName, replicatedProtectedItemName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "ListByReplicationProtectedItems", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationProtectedItemsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "ListByReplicationProtectedItems", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationProtectedItemsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "ListByReplicationProtectedItems", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationProtectedItemsPreparer prepares the ListByReplicationProtectedItems request. +func (client RecoveryPointsClient) ListByReplicationProtectedItemsPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationProtectedItemsSender sends the ListByReplicationProtectedItems request. The method will close the +// http.Response Body if it receives an error. +func (client RecoveryPointsClient) ListByReplicationProtectedItemsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationProtectedItemsResponder handles the response to the ListByReplicationProtectedItems request. The method always +// closes the http.Response Body. +func (client RecoveryPointsClient) ListByReplicationProtectedItemsResponder(resp *http.Response) (result RecoveryPointCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationProtectedItemsNextResults retrieves the next set of results, if any. +func (client RecoveryPointsClient) ListByReplicationProtectedItemsNextResults(lastResults RecoveryPointCollection) (result RecoveryPointCollection, err error) { + req, err := lastResults.RecoveryPointCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "ListByReplicationProtectedItems", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationProtectedItemsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "ListByReplicationProtectedItems", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationProtectedItemsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.RecoveryPointsClient", "ListByReplicationProtectedItems", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationProtectedItemsComplete gets all elements from the list without paging. +func (client RecoveryPointsClient) ListByReplicationProtectedItemsComplete(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cancel <-chan struct{}) (<-chan RecoveryPoint, <-chan error) { + resultChan := make(chan RecoveryPoint) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationProtectedItems(fabricName, protectionContainerName, replicatedProtectedItemName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationProtectedItemsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationalertsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationalertsettings.go new file mode 100644 index 000000000..62c6cd0a6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationalertsettings.go @@ -0,0 +1,307 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationAlertSettingsClient is the client for the ReplicationAlertSettings methods of the +// Recoveryservicessiterecovery service. +type ReplicationAlertSettingsClient struct { + ManagementClient +} + +// NewReplicationAlertSettingsClient creates an instance of the ReplicationAlertSettingsClient client. +func NewReplicationAlertSettingsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationAlertSettingsClient { + return NewReplicationAlertSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationAlertSettingsClientWithBaseURI creates an instance of the ReplicationAlertSettingsClient client. +func NewReplicationAlertSettingsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationAlertSettingsClient { + return ReplicationAlertSettingsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create create or update an email notification(alert) configuration. +// +// alertSettingName is the name of the email notification(alert) configuration. request is the input to configure the +// email notification(alert). +func (client ReplicationAlertSettingsClient) Create(alertSettingName string, request ConfigureAlertRequest) (result Alert, err error) { + req, err := client.CreatePreparer(alertSettingName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ReplicationAlertSettingsClient) CreatePreparer(alertSettingName string, request ConfigureAlertRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alertSettingName": autorest.Encode("path", alertSettingName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}", pathParameters), + autorest.WithJSON(request), + 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 ReplicationAlertSettingsClient) 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 ReplicationAlertSettingsClient) CreateResponder(resp *http.Response) (result Alert, 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 specified email notification(alert) configuration. +// +// alertSettingName is the name of the email notification configuration. +func (client ReplicationAlertSettingsClient) Get(alertSettingName string) (result Alert, err error) { + req, err := client.GetPreparer(alertSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationAlertSettingsClient) GetPreparer(alertSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alertSettingName": autorest.Encode("path", alertSettingName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationAlertSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationAlertSettingsClient) GetResponder(resp *http.Response) (result Alert, 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 email notification(alert) configurations for the vault. . +func (client ReplicationAlertSettingsClient) List() (result AlertCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationAlertSettingsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationAlertSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationAlertSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationAlertSettingsClient) ListResponder(resp *http.Response) (result AlertCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationAlertSettingsClient) ListNextResults(lastResults AlertCollection) (result AlertCollection, err error) { + req, err := lastResults.AlertCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationAlertSettingsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationAlertSettingsClient) ListComplete(cancel <-chan struct{}) (<-chan Alert, <-chan error) { + resultChan := make(chan Alert) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationevents.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationevents.go new file mode 100644 index 000000000..976f445be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationevents.go @@ -0,0 +1,237 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationEventsClient is the client for the ReplicationEvents methods of the Recoveryservicessiterecovery service. +type ReplicationEventsClient struct { + ManagementClient +} + +// NewReplicationEventsClient creates an instance of the ReplicationEventsClient client. +func NewReplicationEventsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationEventsClient { + return NewReplicationEventsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationEventsClientWithBaseURI creates an instance of the ReplicationEventsClient client. +func NewReplicationEventsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationEventsClient { + return ReplicationEventsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Get the operation to get the details of an Azure Site recovery event. +// +// eventName is the name of the Azure Site Recovery event. +func (client ReplicationEventsClient) Get(eventName string) (result Event, err error) { + req, err := client.GetPreparer(eventName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationEventsClient) GetPreparer(eventName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventName": autorest.Encode("path", eventName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationEventsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationEventsClient) GetResponder(resp *http.Response) (result Event, 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 Azure Site Recovery events for the vault. +func (client ReplicationEventsClient) List() (result EventCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationEventsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationEvents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationEventsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationEventsClient) ListResponder(resp *http.Response) (result EventCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationEventsClient) ListNextResults(lastResults EventCollection) (result EventCollection, err error) { + req, err := lastResults.EventCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationEventsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationEventsClient) ListComplete(cancel <-chan struct{}) (<-chan Event, <-chan error) { + resultChan := make(chan Event) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationfabrics.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationfabrics.go new file mode 100644 index 000000000..1a83fd344 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationfabrics.go @@ -0,0 +1,741 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationFabricsClient is the client for the ReplicationFabrics methods of the Recoveryservicessiterecovery +// service. +type ReplicationFabricsClient struct { + ManagementClient +} + +// NewReplicationFabricsClient creates an instance of the ReplicationFabricsClient client. +func NewReplicationFabricsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationFabricsClient { + return NewReplicationFabricsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationFabricsClientWithBaseURI creates an instance of the ReplicationFabricsClient client. +func NewReplicationFabricsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationFabricsClient { + return ReplicationFabricsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// CheckConsistency the operation to perform a consistency check on the fabric. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// fabricName is fabric name. +func (client ReplicationFabricsClient) CheckConsistency(fabricName string, cancel <-chan struct{}) (<-chan Fabric, <-chan error) { + resultChan := make(chan Fabric, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Fabric + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CheckConsistencyPreparer(fabricName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "CheckConsistency", nil, "Failure preparing request") + return + } + + resp, err := client.CheckConsistencySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "CheckConsistency", resp, "Failure sending request") + return + } + + result, err = client.CheckConsistencyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "CheckConsistency", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CheckConsistencyPreparer prepares the CheckConsistency request. +func (client ReplicationFabricsClient) CheckConsistencyPreparer(fabricName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CheckConsistencySender sends the CheckConsistency request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationFabricsClient) CheckConsistencySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CheckConsistencyResponder handles the response to the CheckConsistency request. The method always +// closes the http.Response Body. +func (client ReplicationFabricsClient) CheckConsistencyResponder(resp *http.Response) (result Fabric, 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 +} + +// Create the operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site) This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is name of the ASR fabric. input is fabric creation input. +func (client ReplicationFabricsClient) Create(fabricName string, input FabricCreationInput, cancel <-chan struct{}) (<-chan Fabric, <-chan error) { + resultChan := make(chan Fabric, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Fabric + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationFabricsClient) CreatePreparer(fabricName string, input FabricCreationInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationFabricsClient) 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 ReplicationFabricsClient) CreateResponder(resp *http.Response) (result Fabric, 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 or remove an Azure Site Recovery fabric. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// fabricName is ASR fabric to delete +func (client ReplicationFabricsClient) Delete(fabricName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationFabricsClient) DeletePreparer(fabricName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove", 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 ReplicationFabricsClient) 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 ReplicationFabricsClient) 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 details of an Azure Site Recovery fabric. +// +// fabricName is fabric name. +func (client ReplicationFabricsClient) Get(fabricName string) (result Fabric, err error) { + req, err := client.GetPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationFabricsClient) GetPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationFabricsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationFabricsClient) GetResponder(resp *http.Response) (result Fabric, 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 the Azure Site Recovery fabrics in the vault. +func (client ReplicationFabricsClient) List() (result FabricCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationFabricsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationFabricsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationFabricsClient) ListResponder(resp *http.Response) (result FabricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationFabricsClient) ListNextResults(lastResults FabricCollection) (result FabricCollection, err error) { + req, err := lastResults.FabricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationFabricsClient) ListComplete(cancel <-chan struct{}) (<-chan Fabric, <-chan error) { + resultChan := make(chan Fabric) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Purge the operation to purge(force delete) an Azure Site Recovery fabric. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// fabricName is ASR fabric to purge. +func (client ReplicationFabricsClient) Purge(fabricName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PurgePreparer(fabricName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Purge", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Purge", resp, "Failure sending request") + return + } + + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "Purge", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PurgePreparer prepares the Purge request. +func (client ReplicationFabricsClient) PurgePreparer(fabricName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationFabricsClient) PurgeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client ReplicationFabricsClient) PurgeResponder(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 +} + +// ReassociateGateway the operation to move replications from a process server to another process 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. +// +// fabricName is the name of the fabric containing the process server. failoverProcessServerRequest is the input to the +// failover process server operation. +func (client ReplicationFabricsClient) ReassociateGateway(fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, cancel <-chan struct{}) (<-chan Fabric, <-chan error) { + resultChan := make(chan Fabric, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Fabric + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ReassociateGatewayPreparer(fabricName, failoverProcessServerRequest, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "ReassociateGateway", nil, "Failure preparing request") + return + } + + resp, err := client.ReassociateGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "ReassociateGateway", resp, "Failure sending request") + return + } + + result, err = client.ReassociateGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "ReassociateGateway", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReassociateGatewayPreparer prepares the ReassociateGateway request. +func (client ReplicationFabricsClient) ReassociateGatewayPreparer(fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway", pathParameters), + autorest.WithJSON(failoverProcessServerRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReassociateGatewaySender sends the ReassociateGateway request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationFabricsClient) ReassociateGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReassociateGatewayResponder handles the response to the ReassociateGateway request. The method always +// closes the http.Response Body. +func (client ReplicationFabricsClient) ReassociateGatewayResponder(resp *http.Response) (result Fabric, 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 +} + +// RenewCertificate renews the connection certificate for the ASR replication fabric. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is fabric name to renew certs for. renewCertificate is renew certificate input. +func (client ReplicationFabricsClient) RenewCertificate(fabricName string, renewCertificate RenewCertificateInput, cancel <-chan struct{}) (<-chan Fabric, <-chan error) { + resultChan := make(chan Fabric, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Fabric + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.RenewCertificatePreparer(fabricName, renewCertificate, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "RenewCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.RenewCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "RenewCertificate", resp, "Failure sending request") + return + } + + result, err = client.RenewCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationFabricsClient", "RenewCertificate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RenewCertificatePreparer prepares the RenewCertificate request. +func (client ReplicationFabricsClient) RenewCertificatePreparer(fabricName string, renewCertificate RenewCertificateInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate", pathParameters), + autorest.WithJSON(renewCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RenewCertificateSender sends the RenewCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationFabricsClient) RenewCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RenewCertificateResponder handles the response to the RenewCertificate request. The method always +// closes the http.Response Body. +func (client ReplicationFabricsClient) RenewCertificateResponder(resp *http.Response) (result Fabric, 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/recoveryservicessiterecovery/replicationjobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationjobs.go new file mode 100644 index 000000000..d1c955b44 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationjobs.go @@ -0,0 +1,577 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationJobsClient is the client for the ReplicationJobs methods of the Recoveryservicessiterecovery service. +type ReplicationJobsClient struct { + ManagementClient +} + +// NewReplicationJobsClient creates an instance of the ReplicationJobsClient client. +func NewReplicationJobsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationJobsClient { + return NewReplicationJobsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationJobsClientWithBaseURI creates an instance of the ReplicationJobsClient client. +func NewReplicationJobsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationJobsClient { + return ReplicationJobsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Cancel the operation to cancel an Azure Site Recovery job. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// jobName is job indentifier. +func (client ReplicationJobsClient) Cancel(jobName string, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Job + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CancelPreparer(jobName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Cancel", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CancelPreparer prepares the Cancel request. +func (client ReplicationJobsClient) CancelPreparer(jobName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationJobsClient) CancelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client ReplicationJobsClient) CancelResponder(resp *http.Response) (result Job, 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 +} + +// Export the operation to export the details of the Azure Site Recovery jobs of the vault. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// jobQueryParameter is job query filter. +func (client ReplicationJobsClient) Export(jobQueryParameter JobQueryParameter, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Job + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ExportPreparer(jobQueryParameter, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Export", nil, "Failure preparing request") + return + } + + resp, err := client.ExportSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Export", resp, "Failure sending request") + return + } + + result, err = client.ExportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Export", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExportPreparer prepares the Export request. +func (client ReplicationJobsClient) ExportPreparer(jobQueryParameter JobQueryParameter, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationJobs/export", pathParameters), + autorest.WithJSON(jobQueryParameter), + 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 ReplicationJobsClient) 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 ReplicationJobsClient) ExportResponder(resp *http.Response) (result Job, 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 get the details of an Azure Site Recovery job. +// +// jobName is job identifier +func (client ReplicationJobsClient) Get(jobName string) (result Job, err error) { + req, err := client.GetPreparer(jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationJobsClient) GetPreparer(jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationJobs/{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 ReplicationJobsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationJobsClient) 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 the list of Azure Site Recovery Jobs for the vault. +// +// filter is oData filter options. +func (client ReplicationJobsClient) List(filter string) (result JobCollection, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationJobsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-10" + 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/{resourceName}/replicationJobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationJobsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationJobsClient) ListResponder(resp *http.Response) (result JobCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationJobsClient) ListNextResults(lastResults JobCollection) (result JobCollection, err error) { + req, err := lastResults.JobCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationJobsClient) ListComplete(filter string, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List(filter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Restart the operation to restart an Azure Site Recovery job. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// jobName is job identifier. +func (client ReplicationJobsClient) Restart(jobName string, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Job + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.RestartPreparer(jobName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Restart", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestartPreparer prepares the Restart request. +func (client ReplicationJobsClient) RestartPreparer(jobName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/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 ReplicationJobsClient) 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 ReplicationJobsClient) RestartResponder(resp *http.Response) (result Job, 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 +} + +// Resume the operation to resume an Azure Site Recovery job This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// jobName is job identifier. resumeJobParams is resume rob comments. +func (client ReplicationJobsClient) Resume(jobName string, resumeJobParams ResumeJobParams, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Job + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ResumePreparer(jobName, resumeJobParams, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Resume", nil, "Failure preparing request") + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Resume", resp, "Failure sending request") + return + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationJobsClient", "Resume", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ResumePreparer prepares the Resume request. +func (client ReplicationJobsClient) ResumePreparer(jobName string, resumeJobParams ResumeJobParams, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume", pathParameters), + autorest.WithJSON(resumeJobParams), + 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 ReplicationJobsClient) 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 ReplicationJobsClient) ResumeResponder(resp *http.Response) (result Job, 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/recoveryservicessiterecovery/replicationlogicalnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationlogicalnetworks.go new file mode 100644 index 000000000..9868e505b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationlogicalnetworks.go @@ -0,0 +1,242 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationLogicalNetworksClient is the client for the ReplicationLogicalNetworks methods of the +// Recoveryservicessiterecovery service. +type ReplicationLogicalNetworksClient struct { + ManagementClient +} + +// NewReplicationLogicalNetworksClient creates an instance of the ReplicationLogicalNetworksClient client. +func NewReplicationLogicalNetworksClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationLogicalNetworksClient { + return NewReplicationLogicalNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationLogicalNetworksClientWithBaseURI creates an instance of the ReplicationLogicalNetworksClient client. +func NewReplicationLogicalNetworksClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationLogicalNetworksClient { + return ReplicationLogicalNetworksClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Get gets the details of a logical network. +// +// fabricName is server Id. logicalNetworkName is logical network name. +func (client ReplicationLogicalNetworksClient) Get(fabricName string, logicalNetworkName string) (result LogicalNetwork, err error) { + req, err := client.GetPreparer(fabricName, logicalNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationLogicalNetworksClient) GetPreparer(fabricName string, logicalNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "logicalNetworkName": autorest.Encode("path", logicalNetworkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationLogicalNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationLogicalNetworksClient) GetResponder(resp *http.Response) (result LogicalNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabrics lists all the logical networks of the Azure Site Recovery fabric +// +// fabricName is server Id. +func (client ReplicationLogicalNetworksClient) ListByReplicationFabrics(fabricName string) (result LogicalNetworkCollection, err error) { + req, err := client.ListByReplicationFabricsPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "ListByReplicationFabrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "ListByReplicationFabrics", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "ListByReplicationFabrics", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationFabricsPreparer prepares the ListByReplicationFabrics request. +func (client ReplicationLogicalNetworksClient) ListByReplicationFabricsPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationFabricsSender sends the ListByReplicationFabrics request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationLogicalNetworksClient) ListByReplicationFabricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationFabricsResponder handles the response to the ListByReplicationFabrics request. The method always +// closes the http.Response Body. +func (client ReplicationLogicalNetworksClient) ListByReplicationFabricsResponder(resp *http.Response) (result LogicalNetworkCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabricsNextResults retrieves the next set of results, if any. +func (client ReplicationLogicalNetworksClient) ListByReplicationFabricsNextResults(lastResults LogicalNetworkCollection) (result LogicalNetworkCollection, err error) { + req, err := lastResults.LogicalNetworkCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "ListByReplicationFabrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "ListByReplicationFabrics", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationLogicalNetworksClient", "ListByReplicationFabrics", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationFabricsComplete gets all elements from the list without paging. +func (client ReplicationLogicalNetworksClient) ListByReplicationFabricsComplete(fabricName string, cancel <-chan struct{}) (<-chan LogicalNetwork, <-chan error) { + resultChan := make(chan LogicalNetwork) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationFabrics(fabricName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationFabricsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworkmappings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworkmappings.go new file mode 100644 index 000000000..d1c87d7a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworkmappings.go @@ -0,0 +1,636 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationNetworkMappingsClient is the client for the ReplicationNetworkMappings methods of the +// Recoveryservicessiterecovery service. +type ReplicationNetworkMappingsClient struct { + ManagementClient +} + +// NewReplicationNetworkMappingsClient creates an instance of the ReplicationNetworkMappingsClient client. +func NewReplicationNetworkMappingsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationNetworkMappingsClient { + return NewReplicationNetworkMappingsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationNetworkMappingsClientWithBaseURI creates an instance of the ReplicationNetworkMappingsClient client. +func NewReplicationNetworkMappingsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationNetworkMappingsClient { + return ReplicationNetworkMappingsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create the operation to create an ASR network mapping. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// fabricName is primary fabric name. networkName is primary network name. networkMappingName is network mapping name. +// input is create network mapping input. +func (client ReplicationNetworkMappingsClient) Create(fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, cancel <-chan struct{}) (<-chan NetworkMapping, <-chan error) { + resultChan := make(chan NetworkMapping, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result NetworkMapping + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, networkName, networkMappingName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationNetworkMappingsClient) CreatePreparer(fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "networkMappingName": autorest.Encode("path", networkMappingName), + "networkName": autorest.Encode("path", networkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationNetworkMappingsClient) 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 ReplicationNetworkMappingsClient) CreateResponder(resp *http.Response) (result NetworkMapping, 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 network mapping. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// fabricName is primary fabric name. networkName is primary network name. networkMappingName is ARM Resource Name for +// network mapping. +func (client ReplicationNetworkMappingsClient) Delete(fabricName string, networkName string, networkMappingName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, networkName, networkMappingName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationNetworkMappingsClient) DeletePreparer(fabricName string, networkName string, networkMappingName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "networkMappingName": autorest.Encode("path", networkMappingName), + "networkName": autorest.Encode("path", networkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", 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 ReplicationNetworkMappingsClient) 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 ReplicationNetworkMappingsClient) 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 details of an ASR network mapping +// +// fabricName is primary fabric name. networkName is primary network name. networkMappingName is network mapping name. +func (client ReplicationNetworkMappingsClient) Get(fabricName string, networkName string, networkMappingName string) (result NetworkMapping, err error) { + req, err := client.GetPreparer(fabricName, networkName, networkMappingName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationNetworkMappingsClient) GetPreparer(fabricName string, networkName string, networkMappingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "networkMappingName": autorest.Encode("path", networkMappingName), + "networkName": autorest.Encode("path", networkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationNetworkMappingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationNetworkMappingsClient) GetResponder(resp *http.Response) (result NetworkMapping, 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 ASR network mappings in the vault. +func (client ReplicationNetworkMappingsClient) List() (result NetworkMappingCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationNetworkMappingsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationNetworkMappingsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationNetworkMappingsClient) ListResponder(resp *http.Response) (result NetworkMappingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationNetworkMappingsClient) ListNextResults(lastResults NetworkMappingCollection) (result NetworkMappingCollection, err error) { + req, err := lastResults.NetworkMappingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationNetworkMappingsClient) ListComplete(cancel <-chan struct{}) (<-chan NetworkMapping, <-chan error) { + resultChan := make(chan NetworkMapping) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationNetworks lists all ASR network mappings for the specified network. +// +// fabricName is primary fabric name. networkName is primary network name. +func (client ReplicationNetworkMappingsClient) ListByReplicationNetworks(fabricName string, networkName string) (result NetworkMappingCollection, err error) { + req, err := client.ListByReplicationNetworksPreparer(fabricName, networkName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "ListByReplicationNetworks", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationNetworksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "ListByReplicationNetworks", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationNetworksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "ListByReplicationNetworks", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationNetworksPreparer prepares the ListByReplicationNetworks request. +func (client ReplicationNetworkMappingsClient) ListByReplicationNetworksPreparer(fabricName string, networkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "networkName": autorest.Encode("path", networkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationNetworksSender sends the ListByReplicationNetworks request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationNetworkMappingsClient) ListByReplicationNetworksSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationNetworksResponder handles the response to the ListByReplicationNetworks request. The method always +// closes the http.Response Body. +func (client ReplicationNetworkMappingsClient) ListByReplicationNetworksResponder(resp *http.Response) (result NetworkMappingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationNetworksNextResults retrieves the next set of results, if any. +func (client ReplicationNetworkMappingsClient) ListByReplicationNetworksNextResults(lastResults NetworkMappingCollection) (result NetworkMappingCollection, err error) { + req, err := lastResults.NetworkMappingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "ListByReplicationNetworks", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationNetworksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "ListByReplicationNetworks", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationNetworksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "ListByReplicationNetworks", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationNetworksComplete gets all elements from the list without paging. +func (client ReplicationNetworkMappingsClient) ListByReplicationNetworksComplete(fabricName string, networkName string, cancel <-chan struct{}) (<-chan NetworkMapping, <-chan error) { + resultChan := make(chan NetworkMapping) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationNetworks(fabricName, networkName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationNetworksNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Update the operation to update an ASR network mapping. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// fabricName is primary fabric name. networkName is primary network name. networkMappingName is network mapping name. +// input is update network mapping input. +func (client ReplicationNetworkMappingsClient) Update(fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, cancel <-chan struct{}) (<-chan NetworkMapping, <-chan error) { + resultChan := make(chan NetworkMapping, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result NetworkMapping + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(fabricName, networkName, networkMappingName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworkMappingsClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ReplicationNetworkMappingsClient) UpdatePreparer(fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "networkMappingName": autorest.Encode("path", networkMappingName), + "networkName": autorest.Encode("path", networkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationNetworkMappingsClient) 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 ReplicationNetworkMappingsClient) UpdateResponder(resp *http.Response) (result NetworkMapping, 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/recoveryservicessiterecovery/replicationnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworks.go new file mode 100644 index 000000000..c98903712 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationnetworks.go @@ -0,0 +1,374 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationNetworksClient is the client for the ReplicationNetworks methods of the Recoveryservicessiterecovery +// service. +type ReplicationNetworksClient struct { + ManagementClient +} + +// NewReplicationNetworksClient creates an instance of the ReplicationNetworksClient client. +func NewReplicationNetworksClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationNetworksClient { + return NewReplicationNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationNetworksClientWithBaseURI creates an instance of the ReplicationNetworksClient client. +func NewReplicationNetworksClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationNetworksClient { + return ReplicationNetworksClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Get gets the details of a network. +// +// fabricName is server Id. networkName is primary network name. +func (client ReplicationNetworksClient) Get(fabricName string, networkName string) (result Network, err error) { + req, err := client.GetPreparer(fabricName, networkName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationNetworksClient) GetPreparer(fabricName string, networkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "networkName": autorest.Encode("path", networkName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationNetworksClient) GetResponder(resp *http.Response) (result Network, 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 networks available in a vault +func (client ReplicationNetworksClient) List() (result NetworkCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationNetworksClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationNetworksClient) ListResponder(resp *http.Response) (result NetworkCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationNetworksClient) ListNextResults(lastResults NetworkCollection) (result NetworkCollection, err error) { + req, err := lastResults.NetworkCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationNetworksClient) ListComplete(cancel <-chan struct{}) (<-chan Network, <-chan error) { + resultChan := make(chan Network) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationFabrics lists the networks available for a fabric. +// +// fabricName is fabric name +func (client ReplicationNetworksClient) ListByReplicationFabrics(fabricName string) (result NetworkCollection, err error) { + req, err := client.ListByReplicationFabricsPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "ListByReplicationFabrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "ListByReplicationFabrics", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "ListByReplicationFabrics", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationFabricsPreparer prepares the ListByReplicationFabrics request. +func (client ReplicationNetworksClient) ListByReplicationFabricsPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationFabricsSender sends the ListByReplicationFabrics request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationNetworksClient) ListByReplicationFabricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationFabricsResponder handles the response to the ListByReplicationFabrics request. The method always +// closes the http.Response Body. +func (client ReplicationNetworksClient) ListByReplicationFabricsResponder(resp *http.Response) (result NetworkCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabricsNextResults retrieves the next set of results, if any. +func (client ReplicationNetworksClient) ListByReplicationFabricsNextResults(lastResults NetworkCollection) (result NetworkCollection, err error) { + req, err := lastResults.NetworkCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "ListByReplicationFabrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "ListByReplicationFabrics", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationNetworksClient", "ListByReplicationFabrics", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationFabricsComplete gets all elements from the list without paging. +func (client ReplicationNetworksClient) ListByReplicationFabricsComplete(fabricName string, cancel <-chan struct{}) (<-chan Network, <-chan error) { + resultChan := make(chan Network) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationFabrics(fabricName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationFabricsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationpolicies.go new file mode 100644 index 000000000..65c33e160 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationpolicies.go @@ -0,0 +1,487 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationPoliciesClient is the client for the ReplicationPolicies methods of the Recoveryservicessiterecovery +// service. +type ReplicationPoliciesClient struct { + ManagementClient +} + +// NewReplicationPoliciesClient creates an instance of the ReplicationPoliciesClient client. +func NewReplicationPoliciesClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationPoliciesClient { + return NewReplicationPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationPoliciesClientWithBaseURI creates an instance of the ReplicationPoliciesClient client. +func NewReplicationPoliciesClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationPoliciesClient { + return ReplicationPoliciesClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create the operation to create a replication policy This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// policyName is replication policy name input is create policy input +func (client ReplicationPoliciesClient) Create(policyName string, input CreatePolicyInput, cancel <-chan struct{}) (<-chan Policy, <-chan error) { + resultChan := make(chan Policy, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Policy + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(policyName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationPoliciesClient) CreatePreparer(policyName string, input CreatePolicyInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationPoliciesClient) 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 ReplicationPoliciesClient) CreateResponder(resp *http.Response) (result Policy, 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 replication policy. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// policyName is replication policy name. +func (client ReplicationPoliciesClient) Delete(policyName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(policyName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationPoliciesClient) DeletePreparer(policyName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", 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 ReplicationPoliciesClient) 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 ReplicationPoliciesClient) 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 details of a replication policy. +// +// policyName is replication policy name. +func (client ReplicationPoliciesClient) Get(policyName string) (result Policy, err error) { + req, err := client.GetPreparer(policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationPoliciesClient) GetPreparer(policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{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 ReplicationPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationPoliciesClient) 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 lists the replication policies for a vault. +func (client ReplicationPoliciesClient) List() (result PolicyCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationPoliciesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationPoliciesClient) ListResponder(resp *http.Response) (result PolicyCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationPoliciesClient) ListNextResults(lastResults PolicyCollection) (result PolicyCollection, err error) { + req, err := lastResults.PolicyCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationPoliciesClient) ListComplete(cancel <-chan struct{}) (<-chan Policy, <-chan error) { + resultChan := make(chan Policy) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Update the operation to update a replication policy. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// policyName is protection profile Id. input is update Protection Profile Input +func (client ReplicationPoliciesClient) Update(policyName string, input UpdatePolicyInput, cancel <-chan struct{}) (<-chan Policy, <-chan error) { + resultChan := make(chan Policy, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Policy + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(policyName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationPoliciesClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ReplicationPoliciesClient) UpdatePreparer(policyName string, input UpdatePolicyInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationPoliciesClient) 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 ReplicationPoliciesClient) UpdateResponder(resp *http.Response) (result Policy, 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/recoveryservicessiterecovery/replicationprotectableitems.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectableitems.go new file mode 100644 index 000000000..4542935bb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectableitems.go @@ -0,0 +1,245 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationProtectableItemsClient is the client for the ReplicationProtectableItems methods of the +// Recoveryservicessiterecovery service. +type ReplicationProtectableItemsClient struct { + ManagementClient +} + +// NewReplicationProtectableItemsClient creates an instance of the ReplicationProtectableItemsClient client. +func NewReplicationProtectableItemsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectableItemsClient { + return NewReplicationProtectableItemsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationProtectableItemsClientWithBaseURI creates an instance of the ReplicationProtectableItemsClient client. +func NewReplicationProtectableItemsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectableItemsClient { + return ReplicationProtectableItemsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Get the operation to get the details of a protectable item. +// +// fabricName is fabric name. protectionContainerName is protection container name. protectableItemName is protectable +// item name. +func (client ReplicationProtectableItemsClient) Get(fabricName string, protectionContainerName string, protectableItemName string) (result ProtectableItem, err error) { + req, err := client.GetPreparer(fabricName, protectionContainerName, protectableItemName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationProtectableItemsClient) GetPreparer(fabricName string, protectionContainerName string, protectableItemName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectableItemName": autorest.Encode("path", protectableItemName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectableItemsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationProtectableItemsClient) GetResponder(resp *http.Response) (result ProtectableItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationProtectionContainers lists the protectable items in a protection container. +// +// fabricName is fabric name. protectionContainerName is protection container name. +func (client ReplicationProtectableItemsClient) ListByReplicationProtectionContainers(fabricName string, protectionContainerName string) (result ProtectableItemCollection, err error) { + req, err := client.ListByReplicationProtectionContainersPreparer(fabricName, protectionContainerName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationProtectionContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationProtectionContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationProtectionContainersPreparer prepares the ListByReplicationProtectionContainers request. +func (client ReplicationProtectableItemsClient) ListByReplicationProtectionContainersPreparer(fabricName string, protectionContainerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationProtectionContainersSender sends the ListByReplicationProtectionContainers request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectableItemsClient) ListByReplicationProtectionContainersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationProtectionContainersResponder handles the response to the ListByReplicationProtectionContainers request. The method always +// closes the http.Response Body. +func (client ReplicationProtectableItemsClient) ListByReplicationProtectionContainersResponder(resp *http.Response) (result ProtectableItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationProtectionContainersNextResults retrieves the next set of results, if any. +func (client ReplicationProtectableItemsClient) ListByReplicationProtectionContainersNextResults(lastResults ProtectableItemCollection) (result ProtectableItemCollection, err error) { + req, err := lastResults.ProtectableItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationProtectionContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationProtectionContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationProtectionContainersComplete gets all elements from the list without paging. +func (client ReplicationProtectableItemsClient) ListByReplicationProtectionContainersComplete(fabricName string, protectionContainerName string, cancel <-chan struct{}) (<-chan ProtectableItem, <-chan error) { + resultChan := make(chan ProtectableItem) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationProtectionContainers(fabricName, protectionContainerName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationProtectionContainersNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotecteditems.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotecteditems.go new file mode 100644 index 000000000..178768b99 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotecteditems.go @@ -0,0 +1,1536 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ReplicationProtectedItemsClient is the client for the ReplicationProtectedItems methods of the +// Recoveryservicessiterecovery service. +type ReplicationProtectedItemsClient struct { + ManagementClient +} + +// NewReplicationProtectedItemsClient creates an instance of the ReplicationProtectedItemsClient client. +func NewReplicationProtectedItemsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectedItemsClient { + return NewReplicationProtectedItemsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationProtectedItemsClientWithBaseURI creates an instance of the ReplicationProtectedItemsClient client. +func NewReplicationProtectedItemsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectedItemsClient { + return ReplicationProtectedItemsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// ApplyRecoveryPoint the operation to change the recovery point of a failed over replication protected item. This +// method may poll for completion. Polling can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// fabricName is the ARM fabric name. protectionContainerName is the protection container name. +// replicatedProtectedItemName is the replicated protected item's name. applyRecoveryPointInput is the +// ApplyRecoveryPointInput. +func (client ReplicationProtectedItemsClient) ApplyRecoveryPoint(fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ApplyRecoveryPointPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, applyRecoveryPointInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ApplyRecoveryPoint", nil, "Failure preparing request") + return + } + + resp, err := client.ApplyRecoveryPointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ApplyRecoveryPoint", resp, "Failure sending request") + return + } + + result, err = client.ApplyRecoveryPointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ApplyRecoveryPoint", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ApplyRecoveryPointPreparer prepares the ApplyRecoveryPoint request. +func (client ReplicationProtectedItemsClient) ApplyRecoveryPointPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint", pathParameters), + autorest.WithJSON(applyRecoveryPointInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ApplyRecoveryPointSender sends the ApplyRecoveryPoint request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) ApplyRecoveryPointSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ApplyRecoveryPointResponder handles the response to the ApplyRecoveryPoint request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) ApplyRecoveryPointResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// Create the operation to create an ASR replication protected item (Enable replication). This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is name of the fabric. protectionContainerName is protection container name. replicatedProtectedItemName +// is a name for the replication protected item. input is enable Protection Input. +func (client ReplicationProtectedItemsClient) Create(fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, protectionContainerName, replicatedProtectedItemName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationProtectedItemsClient) CreatePreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationProtectedItemsClient) 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 ReplicationProtectedItemsClient) CreateResponder(resp *http.Response) (result ReplicationProtectedItem, 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 disable replication on a replication protected item. This will also remove the item. This +// method may poll for completion. Polling can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// fabricName is fabric name. protectionContainerName is protection container name. replicatedProtectedItemName is +// replication protected item name. disableProtectionInput is disable protection input. +func (client ReplicationProtectedItemsClient) Delete(fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, protectionContainerName, replicatedProtectedItemName, disableProtectionInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationProtectedItemsClient) DeletePreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove", pathParameters), + autorest.WithJSON(disableProtectionInput), + 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 ReplicationProtectedItemsClient) 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 ReplicationProtectedItemsClient) 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 +} + +// FailoverCommit operation to commit the failover of the replication protected item. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. +func (client ReplicationProtectedItemsClient) FailoverCommit(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.FailoverCommitPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "FailoverCommit", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverCommitSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "FailoverCommit", resp, "Failure sending request") + return + } + + result, err = client.FailoverCommitResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "FailoverCommit", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// FailoverCommitPreparer prepares the FailoverCommit request. +func (client ReplicationProtectedItemsClient) FailoverCommitPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// FailoverCommitSender sends the FailoverCommit request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) FailoverCommitSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// FailoverCommitResponder handles the response to the FailoverCommit request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) FailoverCommitResponder(resp *http.Response) (result ReplicationProtectedItem, 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 the details of an ASR replication protected item. +// +// fabricName is fabric unique name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. +func (client ReplicationProtectedItemsClient) Get(fabricName string, protectionContainerName string, replicatedProtectedItemName string) (result ReplicationProtectedItem, err error) { + req, err := client.GetPreparer(fabricName, protectionContainerName, replicatedProtectedItemName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationProtectedItemsClient) GetPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) GetResponder(resp *http.Response) (result ReplicationProtectedItem, 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 ASR replication protected items in the vault. +// +// skipToken is the pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null filter is oData filter +// options. +func (client ReplicationProtectedItemsClient) List(skipToken string, filter string) (result ReplicationProtectedItemCollection, err error) { + req, err := client.ListPreparer(skipToken, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationProtectedItemsClient) ListPreparer(skipToken string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["skipToken"] = autorest.Encode("query", skipToken) + } + 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/{resourceName}/replicationProtectedItems", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) ListResponder(resp *http.Response) (result ReplicationProtectedItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationProtectedItemsClient) ListNextResults(lastResults ReplicationProtectedItemCollection) (result ReplicationProtectedItemCollection, err error) { + req, err := lastResults.ReplicationProtectedItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationProtectedItemsClient) ListComplete(skipToken string, filter string, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List(skipToken, filter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationProtectionContainers gets the list of ASR replication protected items in the protection container. +// +// fabricName is fabric name. protectionContainerName is protection container name. +func (client ReplicationProtectedItemsClient) ListByReplicationProtectionContainers(fabricName string, protectionContainerName string) (result ReplicationProtectedItemCollection, err error) { + req, err := client.ListByReplicationProtectionContainersPreparer(fabricName, protectionContainerName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationProtectionContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ListByReplicationProtectionContainers", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationProtectionContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ListByReplicationProtectionContainers", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationProtectionContainersPreparer prepares the ListByReplicationProtectionContainers request. +func (client ReplicationProtectedItemsClient) ListByReplicationProtectionContainersPreparer(fabricName string, protectionContainerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationProtectionContainersSender sends the ListByReplicationProtectionContainers request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) ListByReplicationProtectionContainersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationProtectionContainersResponder handles the response to the ListByReplicationProtectionContainers request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) ListByReplicationProtectionContainersResponder(resp *http.Response) (result ReplicationProtectedItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationProtectionContainersNextResults retrieves the next set of results, if any. +func (client ReplicationProtectedItemsClient) ListByReplicationProtectionContainersNextResults(lastResults ReplicationProtectedItemCollection) (result ReplicationProtectedItemCollection, err error) { + req, err := lastResults.ReplicationProtectedItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationProtectionContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ListByReplicationProtectionContainers", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationProtectionContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "ListByReplicationProtectionContainers", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationProtectionContainersComplete gets all elements from the list without paging. +func (client ReplicationProtectedItemsClient) ListByReplicationProtectionContainersComplete(fabricName string, protectionContainerName string, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationProtectionContainers(fabricName, protectionContainerName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationProtectionContainersNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// PlannedFailover operation to initiate a planned failover of the replication protected item. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. failoverInput is disable protection input. +func (client ReplicationProtectedItemsClient) PlannedFailover(fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PlannedFailoverPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "PlannedFailover", nil, "Failure preparing request") + return + } + + resp, err := client.PlannedFailoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "PlannedFailover", resp, "Failure sending request") + return + } + + result, err = client.PlannedFailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "PlannedFailover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PlannedFailoverPreparer prepares the PlannedFailover request. +func (client ReplicationProtectedItemsClient) PlannedFailoverPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover", pathParameters), + autorest.WithJSON(failoverInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PlannedFailoverSender sends the PlannedFailover request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) PlannedFailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PlannedFailoverResponder handles the response to the PlannedFailover request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) PlannedFailoverResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// Purge the operation to delete or purge a replication protected item. This operation will force delete the +// replication protected item. Use the remove operation on replication protected item to perform a clean disable +// replication for the item. This method may poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// fabricName is fabric name. protectionContainerName is protection container name. replicatedProtectedItemName is +// replication protected item name. +func (client ReplicationProtectedItemsClient) Purge(fabricName string, protectionContainerName string, replicatedProtectedItemName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PurgePreparer(fabricName, protectionContainerName, replicatedProtectedItemName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Purge", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Purge", resp, "Failure sending request") + return + } + + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Purge", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PurgePreparer prepares the Purge request. +func (client ReplicationProtectedItemsClient) PurgePreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) PurgeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) PurgeResponder(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 +} + +// RepairReplication the operation to start resynchronize/repair replication for a replication protected item requiring +// resynchronization. This method may poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// fabricName is the name of the fabric. protectionContainerName is the name of the container. +// replicatedProtectedItemName is the name of the replication protected item. +func (client ReplicationProtectedItemsClient) RepairReplication(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.RepairReplicationPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "RepairReplication", nil, "Failure preparing request") + return + } + + resp, err := client.RepairReplicationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "RepairReplication", resp, "Failure sending request") + return + } + + result, err = client.RepairReplicationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "RepairReplication", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RepairReplicationPreparer prepares the RepairReplication request. +func (client ReplicationProtectedItemsClient) RepairReplicationPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RepairReplicationSender sends the RepairReplication request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) RepairReplicationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RepairReplicationResponder handles the response to the RepairReplication request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) RepairReplicationResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// Reprotect operation to reprotect or reverse replicate a failed over replication protected item. This method may poll +// for completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. rrInput is disable protection input. +func (client ReplicationProtectedItemsClient) Reprotect(fabricName string, protectionContainerName string, replicatedProtectedItemName string, rrInput ReverseReplicationInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ReprotectPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, rrInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Reprotect", nil, "Failure preparing request") + return + } + + resp, err := client.ReprotectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Reprotect", resp, "Failure sending request") + return + } + + result, err = client.ReprotectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Reprotect", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReprotectPreparer prepares the Reprotect request. +func (client ReplicationProtectedItemsClient) ReprotectPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, rrInput ReverseReplicationInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect", pathParameters), + autorest.WithJSON(rrInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReprotectSender sends the Reprotect request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) ReprotectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReprotectResponder handles the response to the Reprotect request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) ReprotectResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// TestFailover operation to perform a test failover of the replication protected item. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. failoverInput is test failover input. +func (client ReplicationProtectedItemsClient) TestFailover(fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput TestFailoverInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestFailoverPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailover", nil, "Failure preparing request") + return + } + + resp, err := client.TestFailoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailover", resp, "Failure sending request") + return + } + + result, err = client.TestFailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestFailoverPreparer prepares the TestFailover request. +func (client ReplicationProtectedItemsClient) TestFailoverPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput TestFailoverInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover", pathParameters), + autorest.WithJSON(failoverInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestFailoverSender sends the TestFailover request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) TestFailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestFailoverResponder handles the response to the TestFailover request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) TestFailoverResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// TestFailoverCleanup operation to clean up the test failover of a replication protected item. This method may poll +// for completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. cleanupInput is test failover cleanup input. +func (client ReplicationProtectedItemsClient) TestFailoverCleanup(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: cleanupInput, + Constraints: []validation.Constraint{{Target: "cleanupInput.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailoverCleanup") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestFailoverCleanupPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, cleanupInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailoverCleanup", nil, "Failure preparing request") + return + } + + resp, err := client.TestFailoverCleanupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailoverCleanup", resp, "Failure sending request") + return + } + + result, err = client.TestFailoverCleanupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "TestFailoverCleanup", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestFailoverCleanupPreparer prepares the TestFailoverCleanup request. +func (client ReplicationProtectedItemsClient) TestFailoverCleanupPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup", pathParameters), + autorest.WithJSON(cleanupInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestFailoverCleanupSender sends the TestFailoverCleanup request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) TestFailoverCleanupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestFailoverCleanupResponder handles the response to the TestFailoverCleanup request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) TestFailoverCleanupResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// UnplannedFailover operation to initiate a failover of the replication protected item. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. replicatedProtectedItemName +// is replication protected item name. failoverInput is disable protection input. +func (client ReplicationProtectedItemsClient) UnplannedFailover(fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UnplannedFailoverPreparer(fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "UnplannedFailover", nil, "Failure preparing request") + return + } + + resp, err := client.UnplannedFailoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "UnplannedFailover", resp, "Failure sending request") + return + } + + result, err = client.UnplannedFailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "UnplannedFailover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UnplannedFailoverPreparer prepares the UnplannedFailover request. +func (client ReplicationProtectedItemsClient) UnplannedFailoverPreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover", pathParameters), + autorest.WithJSON(failoverInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UnplannedFailoverSender sends the UnplannedFailover request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) UnplannedFailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UnplannedFailoverResponder handles the response to the UnplannedFailover request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) UnplannedFailoverResponder(resp *http.Response) (result ReplicationProtectedItem, 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 the operation to update the recovery settings of an ASR replication protected item. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is fabric name. protectionContainerName is protection container name. replicatedProtectedItemName is +// replication protected item name. updateProtectionInput is update protection input. +func (client ReplicationProtectedItemsClient) Update(fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(fabricName, protectionContainerName, replicatedProtectedItemName, updateProtectionInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ReplicationProtectedItemsClient) UpdatePreparer(fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicatedProtectedItemName": autorest.Encode("path", replicatedProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", pathParameters), + autorest.WithJSON(updateProtectionInput), + 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 ReplicationProtectedItemsClient) 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 ReplicationProtectedItemsClient) UpdateResponder(resp *http.Response) (result ReplicationProtectedItem, 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 +} + +// UpdateMobilityService the operation to update(push update) the installed mobility service software on a replication +// protected item to the latest available version. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// fabricName is the name of the fabric containing the protected item. protectionContainerName is the name of the +// container containing the protected item. replicationProtectedItemName is the name of the protected item on which the +// agent is to be updated. updateMobilityServiceRequest is request to update the mobility service on the protected +// item. +func (client ReplicationProtectedItemsClient) UpdateMobilityService(fabricName string, protectionContainerName string, replicationProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, cancel <-chan struct{}) (<-chan ReplicationProtectedItem, <-chan error) { + resultChan := make(chan ReplicationProtectedItem, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ReplicationProtectedItem + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdateMobilityServicePreparer(fabricName, protectionContainerName, replicationProtectedItemName, updateMobilityServiceRequest, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "UpdateMobilityService", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateMobilityServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "UpdateMobilityService", resp, "Failure sending request") + return + } + + result, err = client.UpdateMobilityServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectedItemsClient", "UpdateMobilityService", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateMobilityServicePreparer prepares the UpdateMobilityService request. +func (client ReplicationProtectedItemsClient) UpdateMobilityServicePreparer(fabricName string, protectionContainerName string, replicationProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "replicationProtectedItemName": autorest.Encode("path", replicationProtectedItemName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicationProtectedItemName}/updateMobilityService", pathParameters), + autorest.WithJSON(updateMobilityServiceRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateMobilityServiceSender sends the UpdateMobilityService request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectedItemsClient) UpdateMobilityServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateMobilityServiceResponder handles the response to the UpdateMobilityService request. The method always +// closes the http.Response Body. +func (client ReplicationProtectedItemsClient) UpdateMobilityServiceResponder(resp *http.Response) (result ReplicationProtectedItem, 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/recoveryservicessiterecovery/replicationprotectioncontainermappings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectioncontainermappings.go new file mode 100644 index 000000000..39dcbab45 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectioncontainermappings.go @@ -0,0 +1,639 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationProtectionContainerMappingsClient is the client for the ReplicationProtectionContainerMappings methods of +// the Recoveryservicessiterecovery service. +type ReplicationProtectionContainerMappingsClient struct { + ManagementClient +} + +// NewReplicationProtectionContainerMappingsClient creates an instance of the +// ReplicationProtectionContainerMappingsClient client. +func NewReplicationProtectionContainerMappingsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectionContainerMappingsClient { + return NewReplicationProtectionContainerMappingsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationProtectionContainerMappingsClientWithBaseURI creates an instance of the +// ReplicationProtectionContainerMappingsClient client. +func NewReplicationProtectionContainerMappingsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectionContainerMappingsClient { + return ReplicationProtectionContainerMappingsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create the operation to create a protection container mapping. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// fabricName is fabric name. protectionContainerName is protection container name. mappingName is protection container +// mapping name. creationInput is mapping creation input. +func (client ReplicationProtectionContainerMappingsClient) Create(fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, cancel <-chan struct{}) (<-chan ProtectionContainerMapping, <-chan error) { + resultChan := make(chan ProtectionContainerMapping, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ProtectionContainerMapping + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, protectionContainerName, mappingName, creationInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationProtectionContainerMappingsClient) CreatePreparer(fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "mappingName": autorest.Encode("path", mappingName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", pathParameters), + autorest.WithJSON(creationInput), + 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 ReplicationProtectionContainerMappingsClient) 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 ReplicationProtectionContainerMappingsClient) CreateResponder(resp *http.Response) (result ProtectionContainerMapping, 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 or remove a protection container mapping. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// fabricName is fabric name. protectionContainerName is protection container name. mappingName is protection container +// mapping name. removalInput is removal input. +func (client ReplicationProtectionContainerMappingsClient) Delete(fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, protectionContainerName, mappingName, removalInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationProtectionContainerMappingsClient) DeletePreparer(fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "mappingName": autorest.Encode("path", mappingName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove", pathParameters), + autorest.WithJSON(removalInput), + 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 ReplicationProtectionContainerMappingsClient) 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 ReplicationProtectionContainerMappingsClient) 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 details of a protection container mapping. +// +// fabricName is fabric name. protectionContainerName is protection container name. mappingName is protection Container +// mapping name. +func (client ReplicationProtectionContainerMappingsClient) Get(fabricName string, protectionContainerName string, mappingName string) (result ProtectionContainerMapping, err error) { + req, err := client.GetPreparer(fabricName, protectionContainerName, mappingName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationProtectionContainerMappingsClient) GetPreparer(fabricName string, protectionContainerName string, mappingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "mappingName": autorest.Encode("path", mappingName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{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 ReplicationProtectionContainerMappingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainerMappingsClient) GetResponder(resp *http.Response) (result ProtectionContainerMapping, 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 protection container mappings in the vault. +func (client ReplicationProtectionContainerMappingsClient) List() (result ProtectionContainerMappingCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationProtectionContainerMappingsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainerMappingsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainerMappingsClient) ListResponder(resp *http.Response) (result ProtectionContainerMappingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationProtectionContainerMappingsClient) ListNextResults(lastResults ProtectionContainerMappingCollection) (result ProtectionContainerMappingCollection, err error) { + req, err := lastResults.ProtectionContainerMappingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationProtectionContainerMappingsClient) ListComplete(cancel <-chan struct{}) (<-chan ProtectionContainerMapping, <-chan error) { + resultChan := make(chan ProtectionContainerMapping) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationProtectionContainers lists the protection container mappings for a protection container. +// +// fabricName is fabric name. protectionContainerName is protection container name. +func (client ReplicationProtectionContainerMappingsClient) ListByReplicationProtectionContainers(fabricName string, protectionContainerName string) (result ProtectionContainerMappingCollection, err error) { + req, err := client.ListByReplicationProtectionContainersPreparer(fabricName, protectionContainerName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationProtectionContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "ListByReplicationProtectionContainers", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationProtectionContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "ListByReplicationProtectionContainers", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationProtectionContainersPreparer prepares the ListByReplicationProtectionContainers request. +func (client ReplicationProtectionContainerMappingsClient) ListByReplicationProtectionContainersPreparer(fabricName string, protectionContainerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationProtectionContainersSender sends the ListByReplicationProtectionContainers request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainerMappingsClient) ListByReplicationProtectionContainersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationProtectionContainersResponder handles the response to the ListByReplicationProtectionContainers request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainerMappingsClient) ListByReplicationProtectionContainersResponder(resp *http.Response) (result ProtectionContainerMappingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationProtectionContainersNextResults retrieves the next set of results, if any. +func (client ReplicationProtectionContainerMappingsClient) ListByReplicationProtectionContainersNextResults(lastResults ProtectionContainerMappingCollection) (result ProtectionContainerMappingCollection, err error) { + req, err := lastResults.ProtectionContainerMappingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationProtectionContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "ListByReplicationProtectionContainers", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationProtectionContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "ListByReplicationProtectionContainers", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationProtectionContainersComplete gets all elements from the list without paging. +func (client ReplicationProtectionContainerMappingsClient) ListByReplicationProtectionContainersComplete(fabricName string, protectionContainerName string, cancel <-chan struct{}) (<-chan ProtectionContainerMapping, <-chan error) { + resultChan := make(chan ProtectionContainerMapping) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationProtectionContainers(fabricName, protectionContainerName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationProtectionContainersNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Purge the operation to purge(force delete) a protection container mapping This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// fabricName is fabric name. protectionContainerName is protection container name. mappingName is protection container +// mapping name. +func (client ReplicationProtectionContainerMappingsClient) Purge(fabricName string, protectionContainerName string, mappingName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PurgePreparer(fabricName, protectionContainerName, mappingName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Purge", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Purge", resp, "Failure sending request") + return + } + + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainerMappingsClient", "Purge", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PurgePreparer prepares the Purge request. +func (client ReplicationProtectionContainerMappingsClient) PurgePreparer(fabricName string, protectionContainerName string, mappingName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "mappingName": autorest.Encode("path", mappingName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainerMappingsClient) PurgeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainerMappingsClient) PurgeResponder(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/recoveryservicessiterecovery/replicationprotectioncontainers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectioncontainers.go new file mode 100644 index 000000000..2d52e9ef3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationprotectioncontainers.go @@ -0,0 +1,717 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationProtectionContainersClient is the client for the ReplicationProtectionContainers methods of the +// Recoveryservicessiterecovery service. +type ReplicationProtectionContainersClient struct { + ManagementClient +} + +// NewReplicationProtectionContainersClient creates an instance of the ReplicationProtectionContainersClient client. +func NewReplicationProtectionContainersClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectionContainersClient { + return NewReplicationProtectionContainersClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationProtectionContainersClientWithBaseURI creates an instance of the ReplicationProtectionContainersClient +// client. +func NewReplicationProtectionContainersClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationProtectionContainersClient { + return ReplicationProtectionContainersClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create operation to create a protection 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. +// +// fabricName is unique fabric ARM name. protectionContainerName is unique protection container ARM name. creationInput +// is creation input. +func (client ReplicationProtectionContainersClient) Create(fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, cancel <-chan struct{}) (<-chan ProtectionContainer, <-chan error) { + resultChan := make(chan ProtectionContainer, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ProtectionContainer + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, protectionContainerName, creationInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationProtectionContainersClient) CreatePreparer(fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", pathParameters), + autorest.WithJSON(creationInput), + 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 ReplicationProtectionContainersClient) 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 ReplicationProtectionContainersClient) CreateResponder(resp *http.Response) (result ProtectionContainer, 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 operation to remove a protection 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. +// +// fabricName is unique fabric ARM name. protectionContainerName is unique protection container ARM name. +func (client ReplicationProtectionContainersClient) Delete(fabricName string, protectionContainerName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, protectionContainerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationProtectionContainersClient) DeletePreparer(fabricName string, protectionContainerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove", 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 ReplicationProtectionContainersClient) 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 ReplicationProtectionContainersClient) 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 +} + +// DiscoverProtectableItem the operation to a add a protectable item to a protection container(Add physical 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. +// +// fabricName is the name of the fabric. protectionContainerName is the name of the protection container. +// discoverProtectableItemRequest is the request object to add a protectable item. +func (client ReplicationProtectionContainersClient) DiscoverProtectableItem(fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, cancel <-chan struct{}) (<-chan ProtectionContainer, <-chan error) { + resultChan := make(chan ProtectionContainer, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ProtectionContainer + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DiscoverProtectableItemPreparer(fabricName, protectionContainerName, discoverProtectableItemRequest, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "DiscoverProtectableItem", nil, "Failure preparing request") + return + } + + resp, err := client.DiscoverProtectableItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "DiscoverProtectableItem", resp, "Failure sending request") + return + } + + result, err = client.DiscoverProtectableItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "DiscoverProtectableItem", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DiscoverProtectableItemPreparer prepares the DiscoverProtectableItem request. +func (client ReplicationProtectionContainersClient) DiscoverProtectableItemPreparer(fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem", pathParameters), + autorest.WithJSON(discoverProtectableItemRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DiscoverProtectableItemSender sends the DiscoverProtectableItem request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainersClient) DiscoverProtectableItemSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DiscoverProtectableItemResponder handles the response to the DiscoverProtectableItem request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainersClient) DiscoverProtectableItemResponder(resp *http.Response) (result ProtectionContainer, 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 the details of a protection container. +// +// fabricName is fabric name. protectionContainerName is protection container name. +func (client ReplicationProtectionContainersClient) Get(fabricName string, protectionContainerName string) (result ProtectionContainer, err error) { + req, err := client.GetPreparer(fabricName, protectionContainerName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationProtectionContainersClient) GetPreparer(fabricName string, protectionContainerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainersClient) GetResponder(resp *http.Response) (result ProtectionContainer, 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 protection containers in a vault. +func (client ReplicationProtectionContainersClient) List() (result ProtectionContainerCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationProtectionContainersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainersClient) ListResponder(resp *http.Response) (result ProtectionContainerCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationProtectionContainersClient) ListNextResults(lastResults ProtectionContainerCollection) (result ProtectionContainerCollection, err error) { + req, err := lastResults.ProtectionContainerCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationProtectionContainersClient) ListComplete(cancel <-chan struct{}) (<-chan ProtectionContainer, <-chan error) { + resultChan := make(chan ProtectionContainer) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationFabrics lists the protection containers in the specified fabric. +// +// fabricName is fabric name. +func (client ReplicationProtectionContainersClient) ListByReplicationFabrics(fabricName string) (result ProtectionContainerCollection, err error) { + req, err := client.ListByReplicationFabricsPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "ListByReplicationFabrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "ListByReplicationFabrics", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "ListByReplicationFabrics", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationFabricsPreparer prepares the ListByReplicationFabrics request. +func (client ReplicationProtectionContainersClient) ListByReplicationFabricsPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationFabricsSender sends the ListByReplicationFabrics request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainersClient) ListByReplicationFabricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationFabricsResponder handles the response to the ListByReplicationFabrics request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainersClient) ListByReplicationFabricsResponder(resp *http.Response) (result ProtectionContainerCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabricsNextResults retrieves the next set of results, if any. +func (client ReplicationProtectionContainersClient) ListByReplicationFabricsNextResults(lastResults ProtectionContainerCollection) (result ProtectionContainerCollection, err error) { + req, err := lastResults.ProtectionContainerCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "ListByReplicationFabrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "ListByReplicationFabrics", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "ListByReplicationFabrics", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationFabricsComplete gets all elements from the list without paging. +func (client ReplicationProtectionContainersClient) ListByReplicationFabricsComplete(fabricName string, cancel <-chan struct{}) (<-chan ProtectionContainer, <-chan error) { + resultChan := make(chan ProtectionContainer) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationFabrics(fabricName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationFabricsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// SwitchProtection operation to switch protection from one container to another or one replication provider to +// another. This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The +// channel will be used to cancel polling and any outstanding HTTP requests. +// +// fabricName is unique fabric name. protectionContainerName is protection container name. switchInput is switch +// protection input. +func (client ReplicationProtectionContainersClient) SwitchProtection(fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, cancel <-chan struct{}) (<-chan ProtectionContainer, <-chan error) { + resultChan := make(chan ProtectionContainer, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ProtectionContainer + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.SwitchProtectionPreparer(fabricName, protectionContainerName, switchInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "SwitchProtection", nil, "Failure preparing request") + return + } + + resp, err := client.SwitchProtectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "SwitchProtection", resp, "Failure sending request") + return + } + + result, err = client.SwitchProtectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationProtectionContainersClient", "SwitchProtection", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SwitchProtectionPreparer prepares the SwitchProtection request. +func (client ReplicationProtectionContainersClient) SwitchProtectionPreparer(fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "protectionContainerName": autorest.Encode("path", protectionContainerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection", pathParameters), + autorest.WithJSON(switchInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SwitchProtectionSender sends the SwitchProtection request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationProtectionContainersClient) SwitchProtectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SwitchProtectionResponder handles the response to the SwitchProtection request. The method always +// closes the http.Response Body. +func (client ReplicationProtectionContainersClient) SwitchProtectionResponder(resp *http.Response) (result ProtectionContainer, 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/recoveryservicessiterecovery/replicationrecoveryplans.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationrecoveryplans.go new file mode 100644 index 000000000..c7cc11506 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationrecoveryplans.go @@ -0,0 +1,1044 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ReplicationRecoveryPlansClient is the client for the ReplicationRecoveryPlans methods of the +// Recoveryservicessiterecovery service. +type ReplicationRecoveryPlansClient struct { + ManagementClient +} + +// NewReplicationRecoveryPlansClient creates an instance of the ReplicationRecoveryPlansClient client. +func NewReplicationRecoveryPlansClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationRecoveryPlansClient { + return NewReplicationRecoveryPlansClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationRecoveryPlansClientWithBaseURI creates an instance of the ReplicationRecoveryPlansClient client. +func NewReplicationRecoveryPlansClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationRecoveryPlansClient { + return ReplicationRecoveryPlansClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create the operation to create a recovery 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. +// +// recoveryPlanName is recovery plan name. input is recovery Plan creation input. +func (client ReplicationRecoveryPlansClient) Create(recoveryPlanName string, input CreateRecoveryPlanInput, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: input, + Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "input.Properties.PrimaryFabricID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "input.Properties.RecoveryFabricID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "input.Properties.Groups", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(recoveryPlanName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationRecoveryPlansClient) CreatePreparer(recoveryPlanName string, input CreateRecoveryPlanInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationRecoveryPlansClient) 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 ReplicationRecoveryPlansClient) CreateResponder(resp *http.Response) (result RecoveryPlan, 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 a recovery 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. +// +// recoveryPlanName is recovery plan name. +func (client ReplicationRecoveryPlansClient) Delete(recoveryPlanName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(recoveryPlanName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationRecoveryPlansClient) DeletePreparer(recoveryPlanName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", 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 ReplicationRecoveryPlansClient) 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 ReplicationRecoveryPlansClient) 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 +} + +// FailoverCommit the operation to commit the fail over of a recovery 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. +// +// recoveryPlanName is recovery plan name. +func (client ReplicationRecoveryPlansClient) FailoverCommit(recoveryPlanName string, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.FailoverCommitPreparer(recoveryPlanName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "FailoverCommit", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverCommitSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "FailoverCommit", resp, "Failure sending request") + return + } + + result, err = client.FailoverCommitResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "FailoverCommit", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// FailoverCommitPreparer prepares the FailoverCommit request. +func (client ReplicationRecoveryPlansClient) FailoverCommitPreparer(recoveryPlanName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// FailoverCommitSender sends the FailoverCommit request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) FailoverCommitSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// FailoverCommitResponder handles the response to the FailoverCommit request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) FailoverCommitResponder(resp *http.Response) (result RecoveryPlan, 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 the details of the recovery plan. +// +// recoveryPlanName is name of the recovery plan. +func (client ReplicationRecoveryPlansClient) Get(recoveryPlanName string) (result RecoveryPlan, err error) { + req, err := client.GetPreparer(recoveryPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationRecoveryPlansClient) GetPreparer(recoveryPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) GetResponder(resp *http.Response) (result RecoveryPlan, 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 recovery plans in the vault. +func (client ReplicationRecoveryPlansClient) List() (result RecoveryPlanCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationRecoveryPlansClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) ListResponder(resp *http.Response) (result RecoveryPlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationRecoveryPlansClient) ListNextResults(lastResults RecoveryPlanCollection) (result RecoveryPlanCollection, err error) { + req, err := lastResults.RecoveryPlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationRecoveryPlansClient) ListComplete(cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// PlannedFailover the operation to start the planned failover of a recovery 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. +// +// recoveryPlanName is recovery plan name. input is failover input. +func (client ReplicationRecoveryPlansClient) PlannedFailover(recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: input, + Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "PlannedFailover") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PlannedFailoverPreparer(recoveryPlanName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "PlannedFailover", nil, "Failure preparing request") + return + } + + resp, err := client.PlannedFailoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "PlannedFailover", resp, "Failure sending request") + return + } + + result, err = client.PlannedFailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "PlannedFailover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PlannedFailoverPreparer prepares the PlannedFailover request. +func (client ReplicationRecoveryPlansClient) PlannedFailoverPreparer(recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PlannedFailoverSender sends the PlannedFailover request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) PlannedFailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PlannedFailoverResponder handles the response to the PlannedFailover request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) PlannedFailoverResponder(resp *http.Response) (result RecoveryPlan, 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 +} + +// Reprotect the operation to reprotect(reverse replicate) a recovery 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. +// +// recoveryPlanName is recovery plan name. +func (client ReplicationRecoveryPlansClient) Reprotect(recoveryPlanName string, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ReprotectPreparer(recoveryPlanName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Reprotect", nil, "Failure preparing request") + return + } + + resp, err := client.ReprotectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Reprotect", resp, "Failure sending request") + return + } + + result, err = client.ReprotectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Reprotect", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReprotectPreparer prepares the Reprotect request. +func (client ReplicationRecoveryPlansClient) ReprotectPreparer(recoveryPlanName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReprotectSender sends the Reprotect request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) ReprotectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReprotectResponder handles the response to the Reprotect request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) ReprotectResponder(resp *http.Response) (result RecoveryPlan, 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 +} + +// TestFailover the operation to start the test failover of a recovery 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. +// +// recoveryPlanName is recovery plan name. input is failover input. +func (client ReplicationRecoveryPlansClient) TestFailover(recoveryPlanName string, input RecoveryPlanTestFailoverInput, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: input, + Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "input.Properties.NetworkType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailover") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestFailoverPreparer(recoveryPlanName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailover", nil, "Failure preparing request") + return + } + + resp, err := client.TestFailoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailover", resp, "Failure sending request") + return + } + + result, err = client.TestFailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestFailoverPreparer prepares the TestFailover request. +func (client ReplicationRecoveryPlansClient) TestFailoverPreparer(recoveryPlanName string, input RecoveryPlanTestFailoverInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestFailoverSender sends the TestFailover request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) TestFailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestFailoverResponder handles the response to the TestFailover request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) TestFailoverResponder(resp *http.Response) (result RecoveryPlan, 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 +} + +// TestFailoverCleanup the operation to cleanup test failover of a recovery 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. +// +// recoveryPlanName is recovery plan name. input is test failover cleanup input. +func (client ReplicationRecoveryPlansClient) TestFailoverCleanup(recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: input, + Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestFailoverCleanupPreparer(recoveryPlanName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup", nil, "Failure preparing request") + return + } + + resp, err := client.TestFailoverCleanupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup", resp, "Failure sending request") + return + } + + result, err = client.TestFailoverCleanupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestFailoverCleanupPreparer prepares the TestFailoverCleanup request. +func (client ReplicationRecoveryPlansClient) TestFailoverCleanupPreparer(recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestFailoverCleanupSender sends the TestFailoverCleanup request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) TestFailoverCleanupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestFailoverCleanupResponder handles the response to the TestFailoverCleanup request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) TestFailoverCleanupResponder(resp *http.Response) (result RecoveryPlan, 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 +} + +// UnplannedFailover the operation to start the failover of a recovery 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. +// +// recoveryPlanName is recovery plan name. input is failover input. +func (client ReplicationRecoveryPlansClient) UnplannedFailover(recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: input, + Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UnplannedFailoverPreparer(recoveryPlanName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover", nil, "Failure preparing request") + return + } + + resp, err := client.UnplannedFailoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover", resp, "Failure sending request") + return + } + + result, err = client.UnplannedFailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UnplannedFailoverPreparer prepares the UnplannedFailover request. +func (client ReplicationRecoveryPlansClient) UnplannedFailoverPreparer(recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UnplannedFailoverSender sends the UnplannedFailover request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryPlansClient) UnplannedFailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UnplannedFailoverResponder handles the response to the UnplannedFailover request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryPlansClient) UnplannedFailoverResponder(resp *http.Response) (result RecoveryPlan, 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 the operation to update a recovery 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. +// +// recoveryPlanName is recovery plan name. input is update recovery plan input +func (client ReplicationRecoveryPlansClient) Update(recoveryPlanName string, input UpdateRecoveryPlanInput, cancel <-chan struct{}) (<-chan RecoveryPlan, <-chan error) { + resultChan := make(chan RecoveryPlan, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RecoveryPlan + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(recoveryPlanName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryPlansClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ReplicationRecoveryPlansClient) UpdatePreparer(recoveryPlanName string, input UpdateRecoveryPlanInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recoveryPlanName": autorest.Encode("path", recoveryPlanName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters), + autorest.WithJSON(input), + 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 ReplicationRecoveryPlansClient) 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 ReplicationRecoveryPlansClient) UpdateResponder(resp *http.Response) (result RecoveryPlan, 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/recoveryservicessiterecovery/replicationrecoveryservicesproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationrecoveryservicesproviders.go new file mode 100644 index 000000000..c6c73402d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationrecoveryservicesproviders.go @@ -0,0 +1,626 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationRecoveryServicesProvidersClient is the client for the ReplicationRecoveryServicesProviders methods of the +// Recoveryservicessiterecovery service. +type ReplicationRecoveryServicesProvidersClient struct { + ManagementClient +} + +// NewReplicationRecoveryServicesProvidersClient creates an instance of the ReplicationRecoveryServicesProvidersClient +// client. +func NewReplicationRecoveryServicesProvidersClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationRecoveryServicesProvidersClient { + return NewReplicationRecoveryServicesProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationRecoveryServicesProvidersClientWithBaseURI creates an instance of the +// ReplicationRecoveryServicesProvidersClient client. +func NewReplicationRecoveryServicesProvidersClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationRecoveryServicesProvidersClient { + return ReplicationRecoveryServicesProvidersClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Delete the operation to removes/delete(unregister) a recovery services provider from the vault This method may poll +// for completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is fabric name. providerName is recovery services provider name. +func (client ReplicationRecoveryServicesProvidersClient) Delete(fabricName string, providerName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, providerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationRecoveryServicesProvidersClient) DeletePreparer(fabricName string, providerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "providerName": autorest.Encode("path", providerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove", 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 ReplicationRecoveryServicesProvidersClient) 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 ReplicationRecoveryServicesProvidersClient) 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 details of registered recovery services provider. +// +// fabricName is fabric name. providerName is recovery services provider name +func (client ReplicationRecoveryServicesProvidersClient) Get(fabricName string, providerName string) (result RecoveryServicesProvider, err error) { + req, err := client.GetPreparer(fabricName, providerName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationRecoveryServicesProvidersClient) GetPreparer(fabricName string, providerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "providerName": autorest.Encode("path", providerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryServicesProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryServicesProvidersClient) GetResponder(resp *http.Response) (result RecoveryServicesProvider, 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 registered recovery services providers in the vault +func (client ReplicationRecoveryServicesProvidersClient) List() (result RecoveryServicesProviderCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationRecoveryServicesProvidersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryServicesProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryServicesProvidersClient) ListResponder(resp *http.Response) (result RecoveryServicesProviderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationRecoveryServicesProvidersClient) ListNextResults(lastResults RecoveryServicesProviderCollection) (result RecoveryServicesProviderCollection, err error) { + req, err := lastResults.RecoveryServicesProviderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationRecoveryServicesProvidersClient) ListComplete(cancel <-chan struct{}) (<-chan RecoveryServicesProvider, <-chan error) { + resultChan := make(chan RecoveryServicesProvider) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationFabrics lists the registered recovery services providers for the specified fabric. +// +// fabricName is fabric name +func (client ReplicationRecoveryServicesProvidersClient) ListByReplicationFabrics(fabricName string) (result RecoveryServicesProviderCollection, err error) { + req, err := client.ListByReplicationFabricsPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "ListByReplicationFabrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "ListByReplicationFabrics", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "ListByReplicationFabrics", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationFabricsPreparer prepares the ListByReplicationFabrics request. +func (client ReplicationRecoveryServicesProvidersClient) ListByReplicationFabricsPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationFabricsSender sends the ListByReplicationFabrics request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryServicesProvidersClient) ListByReplicationFabricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationFabricsResponder handles the response to the ListByReplicationFabrics request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryServicesProvidersClient) ListByReplicationFabricsResponder(resp *http.Response) (result RecoveryServicesProviderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabricsNextResults retrieves the next set of results, if any. +func (client ReplicationRecoveryServicesProvidersClient) ListByReplicationFabricsNextResults(lastResults RecoveryServicesProviderCollection) (result RecoveryServicesProviderCollection, err error) { + req, err := lastResults.RecoveryServicesProviderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "ListByReplicationFabrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "ListByReplicationFabrics", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "ListByReplicationFabrics", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationFabricsComplete gets all elements from the list without paging. +func (client ReplicationRecoveryServicesProvidersClient) ListByReplicationFabricsComplete(fabricName string, cancel <-chan struct{}) (<-chan RecoveryServicesProvider, <-chan error) { + resultChan := make(chan RecoveryServicesProvider) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationFabrics(fabricName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationFabricsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Purge the operation to purge(force delete) a recovery services provider from the vault. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is fabric name. providerName is recovery services provider name. +func (client ReplicationRecoveryServicesProvidersClient) Purge(fabricName string, providerName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.PurgePreparer(fabricName, providerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Purge", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Purge", resp, "Failure sending request") + return + } + + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "Purge", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PurgePreparer prepares the Purge request. +func (client ReplicationRecoveryServicesProvidersClient) PurgePreparer(fabricName string, providerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "providerName": autorest.Encode("path", providerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryServicesProvidersClient) PurgeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryServicesProvidersClient) PurgeResponder(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 +} + +// RefreshProvider the operation to refresh the information from the recovery services 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. +// +// fabricName is fabric name. providerName is recovery services provider name. +func (client ReplicationRecoveryServicesProvidersClient) RefreshProvider(fabricName string, providerName string, cancel <-chan struct{}) (<-chan RecoveryServicesProvider, <-chan error) { + resultChan := make(chan RecoveryServicesProvider, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RecoveryServicesProvider + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.RefreshProviderPreparer(fabricName, providerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "RefreshProvider", nil, "Failure preparing request") + return + } + + resp, err := client.RefreshProviderSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "RefreshProvider", resp, "Failure sending request") + return + } + + result, err = client.RefreshProviderResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationRecoveryServicesProvidersClient", "RefreshProvider", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RefreshProviderPreparer prepares the RefreshProvider request. +func (client ReplicationRecoveryServicesProvidersClient) RefreshProviderPreparer(fabricName string, providerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "providerName": autorest.Encode("path", providerName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RefreshProviderSender sends the RefreshProvider request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationRecoveryServicesProvidersClient) RefreshProviderSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RefreshProviderResponder handles the response to the RefreshProvider request. The method always +// closes the http.Response Body. +func (client ReplicationRecoveryServicesProvidersClient) RefreshProviderResponder(resp *http.Response) (result RecoveryServicesProvider, 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/recoveryservicessiterecovery/replicationstorageclassificationmappings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassificationmappings.go new file mode 100644 index 000000000..5a0224947 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassificationmappings.go @@ -0,0 +1,552 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationStorageClassificationMappingsClient is the client for the ReplicationStorageClassificationMappings +// methods of the Recoveryservicessiterecovery service. +type ReplicationStorageClassificationMappingsClient struct { + ManagementClient +} + +// NewReplicationStorageClassificationMappingsClient creates an instance of the +// ReplicationStorageClassificationMappingsClient client. +func NewReplicationStorageClassificationMappingsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationStorageClassificationMappingsClient { + return NewReplicationStorageClassificationMappingsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationStorageClassificationMappingsClientWithBaseURI creates an instance of the +// ReplicationStorageClassificationMappingsClient client. +func NewReplicationStorageClassificationMappingsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationStorageClassificationMappingsClient { + return ReplicationStorageClassificationMappingsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create the operation to create a storage classification mapping. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// fabricName is fabric name. storageClassificationName is storage classification name. +// storageClassificationMappingName is storage classification mapping name. pairingInput is pairing input. +func (client ReplicationStorageClassificationMappingsClient) Create(fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, cancel <-chan struct{}) (<-chan StorageClassificationMapping, <-chan error) { + resultChan := make(chan StorageClassificationMapping, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result StorageClassificationMapping + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, storageClassificationName, storageClassificationMappingName, pairingInput, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationStorageClassificationMappingsClient) CreatePreparer(fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "storageClassificationMappingName": autorest.Encode("path", storageClassificationMappingName), + "storageClassificationName": autorest.Encode("path", storageClassificationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", pathParameters), + autorest.WithJSON(pairingInput), + 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 ReplicationStorageClassificationMappingsClient) 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 ReplicationStorageClassificationMappingsClient) CreateResponder(resp *http.Response) (result StorageClassificationMapping, 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 storage classification mapping. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// fabricName is fabric name. storageClassificationName is storage classification name. +// storageClassificationMappingName is storage classification mapping name. +func (client ReplicationStorageClassificationMappingsClient) Delete(fabricName string, storageClassificationName string, storageClassificationMappingName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, storageClassificationName, storageClassificationMappingName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationStorageClassificationMappingsClient) DeletePreparer(fabricName string, storageClassificationName string, storageClassificationMappingName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "storageClassificationMappingName": autorest.Encode("path", storageClassificationMappingName), + "storageClassificationName": autorest.Encode("path", storageClassificationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", 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 ReplicationStorageClassificationMappingsClient) 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 ReplicationStorageClassificationMappingsClient) 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 details of the specified storage classification mapping. +// +// fabricName is fabric name. storageClassificationName is storage classification name. +// storageClassificationMappingName is storage classification mapping name. +func (client ReplicationStorageClassificationMappingsClient) Get(fabricName string, storageClassificationName string, storageClassificationMappingName string) (result StorageClassificationMapping, err error) { + req, err := client.GetPreparer(fabricName, storageClassificationName, storageClassificationMappingName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationStorageClassificationMappingsClient) GetPreparer(fabricName string, storageClassificationName string, storageClassificationMappingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "storageClassificationMappingName": autorest.Encode("path", storageClassificationMappingName), + "storageClassificationName": autorest.Encode("path", storageClassificationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationStorageClassificationMappingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationStorageClassificationMappingsClient) GetResponder(resp *http.Response) (result StorageClassificationMapping, 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 storage classification mappings in the vault. +func (client ReplicationStorageClassificationMappingsClient) List() (result StorageClassificationMappingCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationStorageClassificationMappingsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationStorageClassificationMappingsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationStorageClassificationMappingsClient) ListResponder(resp *http.Response) (result StorageClassificationMappingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationStorageClassificationMappingsClient) ListNextResults(lastResults StorageClassificationMappingCollection) (result StorageClassificationMappingCollection, err error) { + req, err := lastResults.StorageClassificationMappingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationStorageClassificationMappingsClient) ListComplete(cancel <-chan struct{}) (<-chan StorageClassificationMapping, <-chan error) { + resultChan := make(chan StorageClassificationMapping) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationStorageClassifications lists the storage classification mappings for the fabric. +// +// fabricName is fabric name. storageClassificationName is storage classfication name. +func (client ReplicationStorageClassificationMappingsClient) ListByReplicationStorageClassifications(fabricName string, storageClassificationName string) (result StorageClassificationMappingCollection, err error) { + req, err := client.ListByReplicationStorageClassificationsPreparer(fabricName, storageClassificationName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "ListByReplicationStorageClassifications", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationStorageClassificationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "ListByReplicationStorageClassifications", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationStorageClassificationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "ListByReplicationStorageClassifications", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationStorageClassificationsPreparer prepares the ListByReplicationStorageClassifications request. +func (client ReplicationStorageClassificationMappingsClient) ListByReplicationStorageClassificationsPreparer(fabricName string, storageClassificationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "storageClassificationName": autorest.Encode("path", storageClassificationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationStorageClassificationsSender sends the ListByReplicationStorageClassifications request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationStorageClassificationMappingsClient) ListByReplicationStorageClassificationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationStorageClassificationsResponder handles the response to the ListByReplicationStorageClassifications request. The method always +// closes the http.Response Body. +func (client ReplicationStorageClassificationMappingsClient) ListByReplicationStorageClassificationsResponder(resp *http.Response) (result StorageClassificationMappingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationStorageClassificationsNextResults retrieves the next set of results, if any. +func (client ReplicationStorageClassificationMappingsClient) ListByReplicationStorageClassificationsNextResults(lastResults StorageClassificationMappingCollection) (result StorageClassificationMappingCollection, err error) { + req, err := lastResults.StorageClassificationMappingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "ListByReplicationStorageClassifications", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationStorageClassificationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "ListByReplicationStorageClassifications", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationStorageClassificationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationMappingsClient", "ListByReplicationStorageClassifications", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationStorageClassificationsComplete gets all elements from the list without paging. +func (client ReplicationStorageClassificationMappingsClient) ListByReplicationStorageClassificationsComplete(fabricName string, storageClassificationName string, cancel <-chan struct{}) (<-chan StorageClassificationMapping, <-chan error) { + resultChan := make(chan StorageClassificationMapping) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationStorageClassifications(fabricName, storageClassificationName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationStorageClassificationsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassifications.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassifications.go new file mode 100644 index 000000000..58a8340cb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationstorageclassifications.go @@ -0,0 +1,376 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationStorageClassificationsClient is the client for the ReplicationStorageClassifications methods of the +// Recoveryservicessiterecovery service. +type ReplicationStorageClassificationsClient struct { + ManagementClient +} + +// NewReplicationStorageClassificationsClient creates an instance of the ReplicationStorageClassificationsClient +// client. +func NewReplicationStorageClassificationsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationStorageClassificationsClient { + return NewReplicationStorageClassificationsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationStorageClassificationsClientWithBaseURI creates an instance of the +// ReplicationStorageClassificationsClient client. +func NewReplicationStorageClassificationsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationStorageClassificationsClient { + return ReplicationStorageClassificationsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Get gets the details of the specified storage classification. +// +// fabricName is fabric name. storageClassificationName is storage classification name. +func (client ReplicationStorageClassificationsClient) Get(fabricName string, storageClassificationName string) (result StorageClassification, err error) { + req, err := client.GetPreparer(fabricName, storageClassificationName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationStorageClassificationsClient) GetPreparer(fabricName string, storageClassificationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "storageClassificationName": autorest.Encode("path", storageClassificationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationStorageClassificationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationStorageClassificationsClient) GetResponder(resp *http.Response) (result StorageClassification, 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 storage classifications in the vault. +func (client ReplicationStorageClassificationsClient) List() (result StorageClassificationCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationStorageClassificationsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationStorageClassificationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationStorageClassificationsClient) ListResponder(resp *http.Response) (result StorageClassificationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationStorageClassificationsClient) ListNextResults(lastResults StorageClassificationCollection) (result StorageClassificationCollection, err error) { + req, err := lastResults.StorageClassificationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationStorageClassificationsClient) ListComplete(cancel <-chan struct{}) (<-chan StorageClassification, <-chan error) { + resultChan := make(chan StorageClassification) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationFabrics lists the storage classifications available in the specified fabric. +// +// fabricName is site name of interest. +func (client ReplicationStorageClassificationsClient) ListByReplicationFabrics(fabricName string) (result StorageClassificationCollection, err error) { + req, err := client.ListByReplicationFabricsPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "ListByReplicationFabrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "ListByReplicationFabrics", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "ListByReplicationFabrics", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationFabricsPreparer prepares the ListByReplicationFabrics request. +func (client ReplicationStorageClassificationsClient) ListByReplicationFabricsPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationFabricsSender sends the ListByReplicationFabrics request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationStorageClassificationsClient) ListByReplicationFabricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationFabricsResponder handles the response to the ListByReplicationFabrics request. The method always +// closes the http.Response Body. +func (client ReplicationStorageClassificationsClient) ListByReplicationFabricsResponder(resp *http.Response) (result StorageClassificationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabricsNextResults retrieves the next set of results, if any. +func (client ReplicationStorageClassificationsClient) ListByReplicationFabricsNextResults(lastResults StorageClassificationCollection) (result StorageClassificationCollection, err error) { + req, err := lastResults.StorageClassificationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "ListByReplicationFabrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "ListByReplicationFabrics", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationStorageClassificationsClient", "ListByReplicationFabrics", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationFabricsComplete gets all elements from the list without paging. +func (client ReplicationStorageClassificationsClient) ListByReplicationFabricsComplete(fabricName string, cancel <-chan struct{}) (<-chan StorageClassification, <-chan error) { + resultChan := make(chan StorageClassification) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationFabrics(fabricName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationFabricsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationvcenters.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationvcenters.go new file mode 100644 index 000000000..5c73f978c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/replicationvcenters.go @@ -0,0 +1,628 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReplicationvCentersClient is the client for the ReplicationvCenters methods of the Recoveryservicessiterecovery +// service. +type ReplicationvCentersClient struct { + ManagementClient +} + +// NewReplicationvCentersClient creates an instance of the ReplicationvCentersClient client. +func NewReplicationvCentersClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationvCentersClient { + return NewReplicationvCentersClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName) +} + +// NewReplicationvCentersClientWithBaseURI creates an instance of the ReplicationvCentersClient client. +func NewReplicationvCentersClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationvCentersClient { + return ReplicationvCentersClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)} +} + +// Create the operation to create a vCenter 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. +// +// fabricName is fabric name. vCenterName is vCenter name. addVCenterRequest is the input to the add vCenter operation. +func (client ReplicationvCentersClient) Create(fabricName string, vCenterName string, addVCenterRequest AddVCenterRequest, cancel <-chan struct{}) (<-chan VCenter, <-chan error) { + resultChan := make(chan VCenter, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VCenter + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(fabricName, vCenterName, addVCenterRequest, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ReplicationvCentersClient) CreatePreparer(fabricName string, vCenterName string, addVCenterRequest AddVCenterRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vCenterName": autorest.Encode("path", vCenterName), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vCenterName}", pathParameters), + autorest.WithJSON(addVCenterRequest), + 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 ReplicationvCentersClient) 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 ReplicationvCentersClient) CreateResponder(resp *http.Response) (result VCenter, 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 remove(unregister) a registered vCenter server from the vault. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// fabricName is fabric name. vCenterName is vCenter name. +func (client ReplicationvCentersClient) Delete(fabricName string, vCenterName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(fabricName, vCenterName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationvCentersClient) DeletePreparer(fabricName string, vCenterName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vCenterName": autorest.Encode("path", vCenterName), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vCenterName}", 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 ReplicationvCentersClient) 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 ReplicationvCentersClient) 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 details of a registered vCenter server(Add vCenter server.) +// +// fabricName is fabric name. vCenterName is vCenter name. +func (client ReplicationvCentersClient) Get(fabricName string, vCenterName string) (result VCenter, err error) { + req, err := client.GetPreparer(fabricName, vCenterName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationvCentersClient) GetPreparer(fabricName string, vCenterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vCenterName": autorest.Encode("path", vCenterName), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vCenterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationvCentersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ReplicationvCentersClient) GetResponder(resp *http.Response) (result VCenter, 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 vCenter servers registered in the vault. +func (client ReplicationvCentersClient) List() (result VCenterCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationvCentersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationvCenters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationvCentersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ReplicationvCentersClient) ListResponder(resp *http.Response) (result VCenterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ReplicationvCentersClient) ListNextResults(lastResults VCenterCollection) (result VCenterCollection, err error) { + req, err := lastResults.VCenterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client ReplicationvCentersClient) ListComplete(cancel <-chan struct{}) (<-chan VCenter, <-chan error) { + resultChan := make(chan VCenter) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByReplicationFabrics lists the vCenter servers registered in a fabric. +// +// fabricName is fabric name. +func (client ReplicationvCentersClient) ListByReplicationFabrics(fabricName string) (result VCenterCollection, err error) { + req, err := client.ListByReplicationFabricsPreparer(fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "ListByReplicationFabrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "ListByReplicationFabrics", resp, "Failure sending request") + return + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "ListByReplicationFabrics", resp, "Failure responding to request") + } + + return +} + +// ListByReplicationFabricsPreparer prepares the ListByReplicationFabrics request. +func (client ReplicationvCentersClient) ListByReplicationFabricsPreparer(fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByReplicationFabricsSender sends the ListByReplicationFabrics request. The method will close the +// http.Response Body if it receives an error. +func (client ReplicationvCentersClient) ListByReplicationFabricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByReplicationFabricsResponder handles the response to the ListByReplicationFabrics request. The method always +// closes the http.Response Body. +func (client ReplicationvCentersClient) ListByReplicationFabricsResponder(resp *http.Response) (result VCenterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByReplicationFabricsNextResults retrieves the next set of results, if any. +func (client ReplicationvCentersClient) ListByReplicationFabricsNextResults(lastResults VCenterCollection) (result VCenterCollection, err error) { + req, err := lastResults.VCenterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "ListByReplicationFabrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByReplicationFabricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "ListByReplicationFabrics", resp, "Failure sending next results request") + } + + result, err = client.ListByReplicationFabricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "ListByReplicationFabrics", resp, "Failure responding to next results request") + } + + return +} + +// ListByReplicationFabricsComplete gets all elements from the list without paging. +func (client ReplicationvCentersClient) ListByReplicationFabricsComplete(fabricName string, cancel <-chan struct{}) (<-chan VCenter, <-chan error) { + resultChan := make(chan VCenter) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByReplicationFabrics(fabricName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByReplicationFabricsNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Update the operation to update a registered vCenter. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests. +// +// fabricName is fabric name. vCenterName is vCeneter name updateVCenterRequest is the input to the update vCenter +// operation. +func (client ReplicationvCentersClient) Update(fabricName string, vCenterName string, updateVCenterRequest UpdateVCenterRequest, cancel <-chan struct{}) (<-chan VCenter, <-chan error) { + resultChan := make(chan VCenter, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VCenter + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(fabricName, vCenterName, updateVCenterRequest, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicessiterecovery.ReplicationvCentersClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ReplicationvCentersClient) UpdatePreparer(fabricName string, vCenterName string, updateVCenterRequest UpdateVCenterRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", client.ResourceGroupName), + "resourceName": autorest.Encode("path", client.ResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vCenterName": autorest.Encode("path", vCenterName), + } + + const APIVersion = "2016-08-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vCenterName}", pathParameters), + autorest.WithJSON(updateVCenterRequest), + 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 ReplicationvCentersClient) 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 ReplicationvCentersClient) UpdateResponder(resp *http.Response) (result VCenter, 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/recoveryservicessiterecovery/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/version.go new file mode 100644 index 000000000..fcd0f1388 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicessiterecovery/version.go @@ -0,0 +1,28 @@ +package recoveryservicessiterecovery + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-recoveryservicessiterecovery/2016-08-10" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..a2fe3a6d6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..b1db86584 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrule.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..571d96bc7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f4ef80cc5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f0e825dd1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..44661ec9a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/patchschedules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..af411bfaa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/redisgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..5c98eadd8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-redis/2016-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..ea5cfe545 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..8812f0072 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/hybridconnections.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fb724b6ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/models.go @@ -0,0 +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))) +} 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 new file mode 100755 index 000000000..1f3b4f05f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/namespaces.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d1273efe2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9876f37af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-relay/2016-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..eb1a57661 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/wcfrelays.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..b8c8b7e01 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/availabilitystatuses.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a5a18afe8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..25183369c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..e103cf0fa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..30f52bbf9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-resourcehealth/2015-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..87d1267c3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..8a12ca237 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/featuresgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..18f4f5671 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..39d23d92c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-features/2015-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..7810b5bae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..2da9fd32e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/models.go @@ -0,0 +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))) +} 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 new file mode 100755 index 000000000..0e2e9359d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/resourcelinks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..18af7cccf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-links/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..fdcf88219 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..5fef907fa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/managementlocks.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ec9d5be39 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..f5429924e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-locks/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliancedefinitions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliancedefinitions.go new file mode 100644 index 000000000..216ce25c5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliancedefinitions.go @@ -0,0 +1,720 @@ +package managedapplications + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ApplianceDefinitionsClient is the ARM managed applications (appliances) +type ApplianceDefinitionsClient struct { + ManagementClient +} + +// NewApplianceDefinitionsClient creates an instance of the +// ApplianceDefinitionsClient client. +func NewApplianceDefinitionsClient(subscriptionID string) ApplianceDefinitionsClient { + return NewApplianceDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplianceDefinitionsClientWithBaseURI creates an instance of the +// ApplianceDefinitionsClient client. +func NewApplianceDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) ApplianceDefinitionsClient { + return ApplianceDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new appliance definition. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceDefinitionName is the name of the appliance +// definition. parameters is parameters supplied to the create or update an +// appliance definition. +func (client ApplianceDefinitionsClient) CreateOrUpdate(resourceGroupName string, applianceDefinitionName string, parameters ApplianceDefinition, cancel <-chan struct{}) (<-chan ApplianceDefinition, <-chan error) { + resultChan := make(chan ApplianceDefinition, 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: applianceDefinitionName, + Constraints: []validation.Constraint{{Target: "applianceDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ApplianceDefinitionProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ApplianceDefinitionProperties.Authorizations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplianceDefinitionProperties.PackageFileURI", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ApplianceDefinition + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, applianceDefinitionName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ApplianceDefinitionsClient) CreateOrUpdatePreparer(resourceGroupName string, applianceDefinitionName string, parameters ApplianceDefinition, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceDefinitionName": autorest.Encode("path", applianceDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/applianceDefinitions/{applianceDefinitionName}", 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 ApplianceDefinitionsClient) 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 ApplianceDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplianceDefinition, 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 +} + +// CreateOrUpdateByID creates a new appliance definition. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// applianceDefinitionID is the fully qualified ID of the appliance definition, +// including the appliance name and the appliance definition resource type. Use +// the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} +// parameters is parameters supplied to the create or update an appliance +// definition. +func (client ApplianceDefinitionsClient) CreateOrUpdateByID(applianceDefinitionID string, parameters ApplianceDefinition, cancel <-chan struct{}) (<-chan ApplianceDefinition, <-chan error) { + resultChan := make(chan ApplianceDefinition, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ApplianceDefinitionProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ApplianceDefinitionProperties.Authorizations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplianceDefinitionProperties.PackageFileURI", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdateByID") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ApplianceDefinition + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateByIDPreparer(applianceDefinitionID, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "CreateOrUpdateByID", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. +func (client ApplianceDefinitionsClient) CreateOrUpdateByIDPreparer(applianceDefinitionID string, parameters ApplianceDefinition, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceDefinitionId": applianceDefinitionID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceDefinitionId}", 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 ApplianceDefinitionsClient) 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 ApplianceDefinitionsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result ApplianceDefinition, 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 appliance definition. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceDefinitionName is the name of the appliance definition +// to delete. +func (client ApplianceDefinitionsClient) Delete(resourceGroupName string, applianceDefinitionName 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: applianceDefinitionName, + Constraints: []validation.Constraint{{Target: "applianceDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "managedapplications.ApplianceDefinitionsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, applianceDefinitionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ApplianceDefinitionsClient) DeletePreparer(resourceGroupName string, applianceDefinitionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceDefinitionName": autorest.Encode("path", applianceDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/applianceDefinitions/{applianceDefinitionName}", 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 ApplianceDefinitionsClient) 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 ApplianceDefinitionsClient) 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 +} + +// DeleteByID deletes the appliance definition. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// applianceDefinitionID is the fully qualified ID of the appliance definition, +// including the appliance name and the appliance definition resource type. Use +// the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} +func (client ApplianceDefinitionsClient) DeleteByID(applianceDefinitionID 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeleteByIDPreparer(applianceDefinitionID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "DeleteByID", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client ApplianceDefinitionsClient) DeleteByIDPreparer(applianceDefinitionID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceDefinitionId": applianceDefinitionID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceDefinitionId}", 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 ApplianceDefinitionsClient) 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 ApplianceDefinitionsClient) DeleteByIDResponder(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 appliance definition. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceDefinitionName is the name of the appliance +// definition. +func (client ApplianceDefinitionsClient) Get(resourceGroupName string, applianceDefinitionName string) (result ApplianceDefinition, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: 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: applianceDefinitionName, + Constraints: []validation.Constraint{{Target: "applianceDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "managedapplications.ApplianceDefinitionsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, applianceDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplianceDefinitionsClient) GetPreparer(resourceGroupName string, applianceDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceDefinitionName": autorest.Encode("path", applianceDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/applianceDefinitions/{applianceDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplianceDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplianceDefinitionsClient) GetResponder(resp *http.Response) (result ApplianceDefinition, 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 +} + +// GetByID gets the appliance definition. +// +// applianceDefinitionID is the fully qualified ID of the appliance definition, +// including the appliance name and the appliance definition resource type. Use +// the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} +func (client ApplianceDefinitionsClient) GetByID(applianceDefinitionID string) (result ApplianceDefinition, err error) { + req, err := client.GetByIDPreparer(applianceDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "GetByID", resp, "Failure responding to request") + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client ApplianceDefinitionsClient) GetByIDPreparer(applianceDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceDefinitionId": applianceDefinitionID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceDefinitionId}", 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 ApplianceDefinitionsClient) 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 ApplianceDefinitionsClient) GetByIDResponder(resp *http.Response) (result ApplianceDefinition, 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 +} + +// ListByResourceGroup lists the appliance definitions in a resource group. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. +func (client ApplianceDefinitionsClient) ListByResourceGroup(resourceGroupName string) (result ApplianceDefinitionListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "managedapplications.ApplianceDefinitionsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ApplianceDefinitionsClient) 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-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.Solutions/applianceDefinitions", 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 ApplianceDefinitionsClient) 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 ApplianceDefinitionsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplianceDefinitionListResult, 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 ApplianceDefinitionsClient) ListByResourceGroupNextResults(lastResults ApplianceDefinitionListResult) (result ApplianceDefinitionListResult, err error) { + req, err := lastResults.ApplianceDefinitionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "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, "managedapplications.ApplianceDefinitionsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.ApplianceDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroupComplete gets all elements from the list without paging. +func (client ApplianceDefinitionsClient) ListByResourceGroupComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan ApplianceDefinition, <-chan error) { + resultChan := make(chan ApplianceDefinition) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByResourceGroup(resourceGroupName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByResourceGroupNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliances.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliances.go new file mode 100644 index 000000000..ca3737c77 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/appliances.go @@ -0,0 +1,1008 @@ +package managedapplications + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppliancesClient is the ARM managed applications (appliances) +type AppliancesClient struct { + ManagementClient +} + +// NewAppliancesClient creates an instance of the AppliancesClient client. +func NewAppliancesClient(subscriptionID string) AppliancesClient { + return NewAppliancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppliancesClientWithBaseURI creates an instance of the AppliancesClient +// client. +func NewAppliancesClientWithBaseURI(baseURI string, subscriptionID string) AppliancesClient { + return AppliancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new appliance. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceName is the name of the appliance. parameters is +// parameters supplied to the create or update an appliance. +func (client AppliancesClient) CreateOrUpdate(resourceGroupName string, applianceName string, parameters Appliance, cancel <-chan struct{}) (<-chan Appliance, <-chan error) { + resultChan := make(chan Appliance, 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: applianceName, + Constraints: []validation.Constraint{{Target: "applianceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ApplianceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ApplianceProperties.ManagedResourceGroupID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Plan", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Plan.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Plan.Product", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Plan.Version", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.Kind", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "managedapplications.AppliancesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Appliance + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, applianceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppliancesClient) CreateOrUpdatePreparer(resourceGroupName string, applianceName string, parameters Appliance, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceName": autorest.Encode("path", applianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/appliances/{applianceName}", 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 AppliancesClient) 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 AppliancesClient) CreateOrUpdateResponder(resp *http.Response) (result Appliance, 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 +} + +// CreateOrUpdateByID creates a new appliance. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// applianceID is the fully qualified ID of the appliance, including the +// appliance name and the appliance resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} +// parameters is parameters supplied to the create or update an appliance. +func (client AppliancesClient) CreateOrUpdateByID(applianceID string, parameters Appliance, cancel <-chan struct{}) (<-chan Appliance, <-chan error) { + resultChan := make(chan Appliance, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ApplianceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ApplianceProperties.ManagedResourceGroupID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Plan", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Plan.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Plan.Product", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Plan.Version", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.Kind", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "managedapplications.AppliancesClient", "CreateOrUpdateByID") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Appliance + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateByIDPreparer(applianceID, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "CreateOrUpdateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "CreateOrUpdateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "CreateOrUpdateByID", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. +func (client AppliancesClient) CreateOrUpdateByIDPreparer(applianceID string, parameters Appliance, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceId": applianceID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceId}", 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 AppliancesClient) 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 AppliancesClient) CreateOrUpdateByIDResponder(resp *http.Response) (result Appliance, 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 appliance. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceName is the name of the appliance. +func (client AppliancesClient) Delete(resourceGroupName string, applianceName 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: applianceName, + Constraints: []validation.Constraint{{Target: "applianceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "managedapplications.AppliancesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, applianceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client AppliancesClient) DeletePreparer(resourceGroupName string, applianceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceName": autorest.Encode("path", applianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/appliances/{applianceName}", 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 AppliancesClient) 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 AppliancesClient) 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 the appliance. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// applianceID is the fully qualified ID of the appliance, including the +// appliance name and the appliance resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} +func (client AppliancesClient) DeleteByID(applianceID 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeleteByIDPreparer(applianceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "DeleteByID", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client AppliancesClient) DeleteByIDPreparer(applianceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceId": applianceID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceId}", 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 AppliancesClient) 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 AppliancesClient) 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 the appliance. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceName is the name of the appliance. +func (client AppliancesClient) Get(resourceGroupName string, applianceName string) (result Appliance, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: 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: applianceName, + Constraints: []validation.Constraint{{Target: "applianceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "managedapplications.AppliancesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, applianceName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppliancesClient) GetPreparer(resourceGroupName string, applianceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceName": autorest.Encode("path", applianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/appliances/{applianceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppliancesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppliancesClient) GetResponder(resp *http.Response) (result Appliance, 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 +} + +// GetByID gets the appliance. +// +// applianceID is the fully qualified ID of the appliance, including the +// appliance name and the appliance resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} +func (client AppliancesClient) GetByID(applianceID string) (result Appliance, err error) { + req, err := client.GetByIDPreparer(applianceID) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "GetByID", resp, "Failure responding to request") + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client AppliancesClient) GetByIDPreparer(applianceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceId": applianceID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceId}", 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 AppliancesClient) 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 AppliancesClient) GetByIDResponder(resp *http.Response) (result Appliance, 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 +} + +// ListByResourceGroup gets all the appliances within a resource group. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. +func (client AppliancesClient) ListByResourceGroup(resourceGroupName string) (result ApplianceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "managedapplications.AppliancesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppliancesClient) 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-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.Solutions/appliances", 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 AppliancesClient) 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 AppliancesClient) ListByResourceGroupResponder(resp *http.Response) (result ApplianceListResult, 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 AppliancesClient) ListByResourceGroupNextResults(lastResults ApplianceListResult) (result ApplianceListResult, err error) { + req, err := lastResults.ApplianceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "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, "managedapplications.AppliancesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroupComplete gets all elements from the list without paging. +func (client AppliancesClient) ListByResourceGroupComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan Appliance, <-chan error) { + resultChan := make(chan Appliance) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByResourceGroup(resourceGroupName) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByResourceGroupNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListBySubscription gets all the appliances within a subscription. +func (client AppliancesClient) ListBySubscription() (result ApplianceListResult, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client AppliancesClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/appliances", 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 AppliancesClient) 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 AppliancesClient) ListBySubscriptionResponder(resp *http.Response) (result ApplianceListResult, 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 AppliancesClient) ListBySubscriptionNextResults(lastResults ApplianceListResult) (result ApplianceListResult, err error) { + req, err := lastResults.ApplianceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "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, "managedapplications.AppliancesClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscriptionComplete gets all elements from the list without paging. +func (client AppliancesClient) ListBySubscriptionComplete(cancel <-chan struct{}) (<-chan Appliance, <-chan error) { + resultChan := make(chan Appliance) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListBySubscription() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListBySubscriptionNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Update updates an existing appliance. The only value that can be updated via +// PATCH currently is the tags. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. applianceName is the name of the appliance. parameters is +// parameters supplied to update an existing appliance. +func (client AppliancesClient) Update(resourceGroupName string, applianceName string, parameters *Appliance) (result Appliance, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: 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: applianceName, + Constraints: []validation.Constraint{{Target: "applianceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applianceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "managedapplications.AppliancesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, applianceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppliancesClient) UpdatePreparer(resourceGroupName string, applianceName string, parameters *Appliance) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceName": autorest.Encode("path", applianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-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.Solutions/appliances/{applianceName}", 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 AppliancesClient) 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 AppliancesClient) UpdateResponder(resp *http.Response) (result Appliance, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateByID updates an existing appliance. The only value that can be updated +// via PATCH currently is the tags. +// +// applianceID is the fully qualified ID of the appliance, including the +// appliance name and the appliance resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} +// parameters is parameters supplied to update an existing appliance. +func (client AppliancesClient) UpdateByID(applianceID string, parameters *Appliance) (result Appliance, err error) { + req, err := client.UpdateByIDPreparer(applianceID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "UpdateByID", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "UpdateByID", resp, "Failure sending request") + return + } + + result, err = client.UpdateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.AppliancesClient", "UpdateByID", resp, "Failure responding to request") + } + + return +} + +// UpdateByIDPreparer prepares the UpdateByID request. +func (client AppliancesClient) UpdateByIDPreparer(applianceID string, parameters *Appliance) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applianceId": applianceID, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{applianceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateByIDSender sends the UpdateByID request. The method will close the +// http.Response Body if it receives an error. +func (client AppliancesClient) UpdateByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateByIDResponder handles the response to the UpdateByID request. The method always +// closes the http.Response Body. +func (client AppliancesClient) UpdateByIDResponder(resp *http.Response) (result Appliance, 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/managedapplications/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/client.go new file mode 100644 index 000000000..0176ab2c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/client.go @@ -0,0 +1,53 @@ +// Package managedapplications implements the Azure ARM Managedapplications +// service API version 2016-09-01-preview. +// +// ARM managed applications (appliances) +package managedapplications + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Managedapplications + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Managedapplications. +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/managedapplications/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/models.go new file mode 100644 index 000000000..4819f0c11 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/models.go @@ -0,0 +1,275 @@ +package managedapplications + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause 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" +) + +// ApplianceArtifactType enumerates the values for appliance artifact type. +type ApplianceArtifactType string + +const ( + // Custom specifies the custom state for appliance artifact type. + Custom ApplianceArtifactType = "Custom" + // Template specifies the template state for appliance artifact type. + Template ApplianceArtifactType = "Template" +) + +// ApplianceLockLevel enumerates the values for appliance lock level. +type ApplianceLockLevel string + +const ( + // CanNotDelete specifies the can not delete state for appliance lock + // level. + CanNotDelete ApplianceLockLevel = "CanNotDelete" + // None specifies the none state for appliance lock level. + None ApplianceLockLevel = "None" + // ReadOnly specifies the read only state for appliance lock level. + ReadOnly ApplianceLockLevel = "ReadOnly" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Accepted specifies the accepted state for provisioning state. + Accepted ProvisioningState = "Accepted" + // Canceled specifies the canceled state for provisioning state. + Canceled ProvisioningState = "Canceled" + // Created specifies the created state for provisioning state. + Created ProvisioningState = "Created" + // Creating specifies the creating state for provisioning state. + Creating ProvisioningState = "Creating" + // Deleted specifies the deleted state for provisioning state. + Deleted ProvisioningState = "Deleted" + // Deleting specifies the deleting state for provisioning state. + Deleting ProvisioningState = "Deleting" + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // Ready specifies the ready state for provisioning state. + Ready ProvisioningState = "Ready" + // Running specifies the running state for provisioning state. + Running ProvisioningState = "Running" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" + // Updating specifies the updating state for provisioning state. + Updating ProvisioningState = "Updating" +) + +// 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" +) + +// Appliance is information about appliance. +type Appliance 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"` + ManagedBy *string `json:"managedBy,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Identity *Identity `json:"identity,omitempty"` + *ApplianceProperties `json:"properties,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// ApplianceArtifact is appliance artifact. +type ApplianceArtifact struct { + Name *string `json:"name,omitempty"` + URI *string `json:"uri,omitempty"` + Type ApplianceArtifactType `json:"type,omitempty"` +} + +// ApplianceDefinition is information about appliance definition. +type ApplianceDefinition 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"` + ManagedBy *string `json:"managedBy,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Identity *Identity `json:"identity,omitempty"` + *ApplianceDefinitionProperties `json:"properties,omitempty"` +} + +// ApplianceDefinitionListResult is list of appliance definitions. +type ApplianceDefinitionListResult struct { + autorest.Response `json:"-"` + Value *[]ApplianceDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplianceDefinitionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ApplianceDefinitionListResult) ApplianceDefinitionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ApplianceDefinitionProperties is the appliance definition properties. +type ApplianceDefinitionProperties struct { + LockLevel ApplianceLockLevel `json:"lockLevel,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Authorizations *[]ApplianceProviderAuthorization `json:"authorizations,omitempty"` + Artifacts *[]ApplianceArtifact `json:"artifacts,omitempty"` + Description *string `json:"description,omitempty"` + PackageFileURI *string `json:"packageFileUri,omitempty"` +} + +// ApplianceListResult is list of appliances. +type ApplianceListResult struct { + autorest.Response `json:"-"` + Value *[]Appliance `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplianceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ApplianceListResult) ApplianceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppliancePatchable is information about appliance. +type AppliancePatchable 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"` + ManagedBy *string `json:"managedBy,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Identity *Identity `json:"identity,omitempty"` + *AppliancePropertiesPatchable `json:"properties,omitempty"` + Plan *PlanPatchable `json:"plan,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// ApplianceProperties is the appliance properties. +type ApplianceProperties struct { + ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"` + ApplianceDefinitionID *string `json:"applianceDefinitionId,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` + Outputs *map[string]interface{} `json:"outputs,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"` +} + +// AppliancePropertiesPatchable is the appliance properties. +type AppliancePropertiesPatchable struct { + ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"` + ApplianceDefinitionID *string `json:"applianceDefinitionId,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` + Outputs *map[string]interface{} `json:"outputs,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"` +} + +// ApplianceProviderAuthorization is the appliance provider authorization. +type ApplianceProviderAuthorization struct { + PrincipalID *string `json:"principalId,omitempty"` + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` +} + +// ErrorResponse is error reponse indicates ARM appliance is not able to +// process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + HTTPStatus *string `json:"httpStatus,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// GenericResource is resource information. +type GenericResource 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"` + ManagedBy *string `json:"managedBy,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Identity *Identity `json:"identity,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"` +} + +// Plan is plan for the appliance. +type Plan struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Version *string `json:"version,omitempty"` +} + +// PlanPatchable is plan for the appliance. +type PlanPatchable struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Version *string `json:"version,omitempty"` +} + +// Resource is resource information. +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"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/version.go new file mode 100644 index 000000000..6c6cdeb5f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/managedapplications/version.go @@ -0,0 +1,28 @@ +package managedapplications + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-managedapplications/2016-09-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..bf9ccc3f8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/assignments.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e3338811d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..2a808a63d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/definitions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..69cd973b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..1fcc1d8f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-policy/2016-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..3e13c72f9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..34d12aac6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deploymentoperations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7c3e19288 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deployments.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..13244a9ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/groups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dd0f06f5f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..7fd6dc158 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/providers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a7179dda8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..445fccf62 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/tags.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1b58352f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-resources/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..31a609091 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..e2cf1743f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go @@ -0,0 +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))) +} 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 new file mode 100755 index 000000000..b8042f65d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/subscriptionsgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..35b2cd26d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/tenants.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..90005af1b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-subscriptions/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..4d99f6f11 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..9e192dad7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..64eab66c5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d465de3bc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..8e506bbb9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-scheduler/2016-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..1f53128ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/adminkeys.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..06993d493 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..7716a21f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..087fd21db --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/querykeys.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..eaa4896b9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/services.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..4e142ad0e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-search/2015-08-19" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..ab6f67d75 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..4219f1bb5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/gateway.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..8c91d39b3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..7970bb70a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/node.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f9653b15d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/powershell.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9c825e67a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/session.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..963b950fc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-servermanagement/2016-07-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..040182d51 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..ffaaabf29 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/clientgroups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9ed8c12cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machinegroups.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ca1fa113f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machines.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..1b5844b59 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/maps.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0b72e45b8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..3834e2f9c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/ports.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..f36e4b888 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/processes.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fa099ea9b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/summaries.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a7991b09a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-servicemap/2015-11-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..446baff17 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..1cb4882ff --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..efdf329f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/namespaces.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3f7b127e5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..9d52011dd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/queues.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..83799ec0b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/subscriptions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..02938927e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/topics.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..48e34352e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-servicebus/2015-08-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..271143e26 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..fda64c301 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusters.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..496d6f89b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusterversions.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..044756515 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..5024912b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7a34226bb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-servicefabric/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..ec8aca224 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/capabilities.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..dbc1dfaa2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..c0d36034f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/databases.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e195ada6b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/elasticpools.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..e4f3fa4c0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/firewallrules.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6f42dca75 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..510869b74 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/operations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6beccb801 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/recommendedelasticpools.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..83290fa93 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/servers.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0e351022c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/version.go @@ -0,0 +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.2.0-beta arm-sql/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..f0606ac13 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a537bdd25 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..2e2030184 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..b12a6d315 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usage.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..185cdc314 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-storage/2016-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..b5de7c2e6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a7a845033 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/jobs.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..6df5d0ed1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..221e66640 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-storageimportexport/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/accesscontrolrecords.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/accesscontrolrecords.go new file mode 100644 index 000000000..a24d9f87c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/accesscontrolrecords.go @@ -0,0 +1,385 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AccessControlRecordsClient is the client for the AccessControlRecords +// methods of the Storsimple8000series service. +type AccessControlRecordsClient struct { + ManagementClient +} + +// NewAccessControlRecordsClient creates an instance of the +// AccessControlRecordsClient client. +func NewAccessControlRecordsClient(subscriptionID string) AccessControlRecordsClient { + return NewAccessControlRecordsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessControlRecordsClientWithBaseURI creates an instance of the +// AccessControlRecordsClient client. +func NewAccessControlRecordsClientWithBaseURI(baseURI string, subscriptionID string) AccessControlRecordsClient { + return AccessControlRecordsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates an access control record. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// accessControlRecordName is the name of the access control record. parameters +// is the access control record to be added or updated. resourceGroupName is +// the resource group name managerName is the manager name +func (client AccessControlRecordsClient) CreateOrUpdate(accessControlRecordName string, parameters AccessControlRecord, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan AccessControlRecord, <-chan error) { + resultChan := make(chan AccessControlRecord, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AccessControlRecordProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AccessControlRecordProperties.InitiatorName", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AccessControlRecord + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(accessControlRecordName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AccessControlRecordsClient) CreateOrUpdatePreparer(accessControlRecordName string, parameters AccessControlRecord, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accessControlRecordName": accessControlRecordName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}", 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 AccessControlRecordsClient) 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 AccessControlRecordsClient) CreateOrUpdateResponder(resp *http.Response) (result AccessControlRecord, 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 access control record. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// accessControlRecordName is the name of the access control record to delete. +// resourceGroupName is the resource group name managerName is the manager name +func (client AccessControlRecordsClient) Delete(accessControlRecordName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(accessControlRecordName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client AccessControlRecordsClient) DeletePreparer(accessControlRecordName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accessControlRecordName": accessControlRecordName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}", 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 AccessControlRecordsClient) 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 AccessControlRecordsClient) 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 returns the properties of the specified access control record name. +// +// accessControlRecordName is name of access control record to be fetched. +// resourceGroupName is the resource group name managerName is the manager name +func (client AccessControlRecordsClient) Get(accessControlRecordName string, resourceGroupName string, managerName string) (result AccessControlRecord, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "Get") + } + + req, err := client.GetPreparer(accessControlRecordName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccessControlRecordsClient) GetPreparer(accessControlRecordName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accessControlRecordName": accessControlRecordName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccessControlRecordsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccessControlRecordsClient) GetResponder(resp *http.Response) (result AccessControlRecord, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManager retrieves all the access control records in a manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client AccessControlRecordsClient) ListByManager(resourceGroupName string, managerName string) (result AccessControlRecordList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager") + } + + req, err := client.ListByManagerPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager", resp, "Failure sending request") + return + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager", resp, "Failure responding to request") + } + + return +} + +// ListByManagerPreparer prepares the ListByManager request. +func (client AccessControlRecordsClient) ListByManagerPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/accessControlRecords", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByManagerSender sends the ListByManager request. The method will close the +// http.Response Body if it receives an error. +func (client AccessControlRecordsClient) ListByManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByManagerResponder handles the response to the ListByManager request. The method always +// closes the http.Response Body. +func (client AccessControlRecordsClient) ListByManagerResponder(resp *http.Response) (result AccessControlRecordList, 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/storsimple8000series/alerts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/alerts.go new file mode 100644 index 000000000..1cc671db2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/alerts.go @@ -0,0 +1,341 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AlertsClient is the client for the Alerts methods of the +// Storsimple8000series service. +type AlertsClient struct { + ManagementClient +} + +// NewAlertsClient creates an instance of the AlertsClient client. +func NewAlertsClient(subscriptionID string) AlertsClient { + return NewAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertsClientWithBaseURI creates an instance of the AlertsClient client. +func NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient { + return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Clear clear the alerts. +// +// parameters is the clear alert request. resourceGroupName is the resource +// group name managerName is the manager name +func (client AlertsClient) Clear(parameters ClearAlertRequest, resourceGroupName string, managerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Alerts", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AlertsClient", "Clear") + } + + req, err := client.ClearPreparer(parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "Clear", nil, "Failure preparing request") + return + } + + resp, err := client.ClearSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "Clear", resp, "Failure sending request") + return + } + + result, err = client.ClearResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "Clear", resp, "Failure responding to request") + } + + return +} + +// ClearPreparer prepares the Clear request. +func (client AlertsClient) ClearPreparer(parameters ClearAlertRequest, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/clearAlerts", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ClearSender sends the Clear request. The method will close the +// http.Response Body if it receives an error. +func (client AlertsClient) ClearSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ClearResponder handles the response to the Clear request. The method always +// closes the http.Response Body. +func (client AlertsClient) ClearResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListByManager retrieves all the alerts in a manager. +// +// resourceGroupName is the resource group name managerName is the manager name +// filter is oData Filter options +func (client AlertsClient) ListByManager(resourceGroupName string, managerName string, filter string) (result AlertList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AlertsClient", "ListByManager") + } + + req, err := client.ListByManagerPreparer(resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure sending request") + return + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure responding to request") + } + + return +} + +// ListByManagerPreparer prepares the ListByManager request. +func (client AlertsClient) ListByManagerPreparer(resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/alerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByManagerSender sends the ListByManager request. The method will close the +// http.Response Body if it receives an error. +func (client AlertsClient) ListByManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByManagerResponder handles the response to the ListByManager request. The method always +// closes the http.Response Body. +func (client AlertsClient) ListByManagerResponder(resp *http.Response) (result AlertList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagerNextResults retrieves the next set of results, if any. +func (client AlertsClient) ListByManagerNextResults(lastResults AlertList) (result AlertList, err error) { + req, err := lastResults.AlertListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure sending next results request") + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure responding to next results request") + } + + return +} + +// ListByManagerComplete gets all elements from the list without paging. +func (client AlertsClient) ListByManagerComplete(resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Alert, <-chan error) { + resultChan := make(chan Alert) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByManager(resourceGroupName, managerName, filter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByManagerNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// SendTestEmail sends a test alert email. +// +// deviceName is the device name parameters is the send test alert email +// request. resourceGroupName is the resource group name managerName is the +// manager name +func (client AlertsClient) SendTestEmail(deviceName string, parameters SendTestAlertEmailRequest, resourceGroupName string, managerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.EmailList", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AlertsClient", "SendTestEmail") + } + + req, err := client.SendTestEmailPreparer(deviceName, parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "SendTestEmail", nil, "Failure preparing request") + return + } + + resp, err := client.SendTestEmailSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "SendTestEmail", resp, "Failure sending request") + return + } + + result, err = client.SendTestEmailResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "SendTestEmail", resp, "Failure responding to request") + } + + return +} + +// SendTestEmailPreparer prepares the SendTestEmail request. +func (client AlertsClient) SendTestEmailPreparer(deviceName string, parameters SendTestAlertEmailRequest, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/sendTestAlertEmail", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SendTestEmailSender sends the SendTestEmail request. The method will close the +// http.Response Body if it receives an error. +func (client AlertsClient) SendTestEmailSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SendTestEmailResponder handles the response to the SendTestEmail request. The method always +// closes the http.Response Body. +func (client AlertsClient) SendTestEmailResponder(resp *http.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/storsimple8000series/backuppolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backuppolicies.go new file mode 100644 index 000000000..caebc2855 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backuppolicies.go @@ -0,0 +1,487 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// BackupPoliciesClient is the client for the BackupPolicies methods of the +// Storsimple8000series 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)} +} + +// BackupNow backup the backup policy now. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name backupPolicyName is the backup policy name. +// backupType is the backup Type. This can be cloudSnapshot or localSnapshot. +// resourceGroupName is the resource group name managerName is the manager name +func (client BackupPoliciesClient) BackupNow(deviceName string, backupPolicyName string, backupType string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.BackupNowPreparer(deviceName, backupPolicyName, backupType, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow", nil, "Failure preparing request") + return + } + + resp, err := client.BackupNowSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow", resp, "Failure sending request") + return + } + + result, err = client.BackupNowResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// BackupNowPreparer prepares the BackupNow request. +func (client BackupPoliciesClient) BackupNowPreparer(deviceName string, backupPolicyName string, backupType string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "backupType": backupType, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// BackupNowSender sends the BackupNow request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) BackupNowSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// BackupNowResponder handles the response to the BackupNow request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) BackupNowResponder(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 +} + +// CreateOrUpdate creates or updates the backup policy. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// deviceName is the device name backupPolicyName is the name of the backup +// policy to be created/updated. parameters is the backup policy. +// resourceGroupName is the resource group name managerName is the manager name +func (client BackupPoliciesClient) CreateOrUpdate(deviceName string, backupPolicyName string, parameters BackupPolicy, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan BackupPolicy, <-chan error) { + resultChan := make(chan BackupPolicy, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BackupPolicyProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.BackupPolicyProperties.VolumeIds", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result BackupPolicy + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(deviceName, backupPolicyName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BackupPoliciesClient) CreateOrUpdatePreparer(deviceName string, backupPolicyName string, parameters BackupPolicy, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}", 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 BackupPoliciesClient) 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 BackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupPolicy, 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 backup policy. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name backupPolicyName is the name of the backup +// policy. resourceGroupName is the resource group name managerName is the +// manager name +func (client BackupPoliciesClient) Delete(deviceName string, backupPolicyName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(deviceName, backupPolicyName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client BackupPoliciesClient) DeletePreparer(deviceName string, backupPolicyName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}", 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 BackupPoliciesClient) 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 BackupPoliciesClient) 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 backup policy name. +// +// deviceName is the device name backupPolicyName is the name of backup policy +// to be fetched. resourceGroupName is the resource group name managerName is +// the manager name +func (client BackupPoliciesClient) Get(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (result BackupPolicy, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "Get") + } + + req, err := client.GetPreparer(deviceName, backupPolicyName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupPoliciesClient) GetPreparer(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) GetResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDevice gets all the backup policies in a device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client BackupPoliciesClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result BackupPolicyList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice") + } + + req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice", resp, "Failure sending request") + return + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice", resp, "Failure responding to request") + } + + return +} + +// ListByDevicePreparer prepares the ListByDevice request. +func (client BackupPoliciesClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDeviceSender sends the ListByDevice request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) ListByDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDeviceResponder handles the response to the ListByDevice request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) ListByDeviceResponder(resp *http.Response) (result BackupPolicyList, 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/storsimple8000series/backups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backups.go new file mode 100644 index 000000000..d4ef8f2af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backups.go @@ -0,0 +1,489 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// BackupsClient is the client for the Backups methods of the +// Storsimple8000series 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)} +} + +// Clone clones the backup element as a new volume. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// deviceName is the device name backupName is the backup name. +// backupElementName is the backup element name. parameters is the clone +// request object. resourceGroupName is the resource group name managerName is +// the manager name +func (client BackupsClient) Clone(deviceName string, backupName string, backupElementName string, parameters CloneRequest, resourceGroupName string, managerName 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetDeviceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.TargetVolumeName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.TargetAccessControlRecordIds", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupElement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.BackupElement.ElementID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupElement.ElementName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupElement.ElementType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupElement.SizeInBytes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupElement.VolumeName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupElement.VolumeContainerID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "Clone") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ClonePreparer(deviceName, backupName, backupElementName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Clone", nil, "Failure preparing request") + return + } + + resp, err := client.CloneSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Clone", resp, "Failure sending request") + return + } + + result, err = client.CloneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Clone", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ClonePreparer prepares the Clone request. +func (client BackupsClient) ClonePreparer(deviceName string, backupName string, backupElementName string, parameters CloneRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupElementName": backupElementName, + "backupName": backupName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}/elements/{backupElementName}/clone", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CloneSender sends the Clone request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) CloneSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CloneResponder handles the response to the Clone request. The method always +// closes the http.Response Body. +func (client BackupsClient) CloneResponder(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 deletes the backup. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name backupName is the backup name. +// resourceGroupName is the resource group name managerName is the manager name +func (client BackupsClient) Delete(deviceName string, backupName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(deviceName, backupName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client BackupsClient) DeletePreparer(deviceName string, backupName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupName": backupName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}", 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 BackupsClient) 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 BackupsClient) 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 +} + +// ListByDevice retrieves all the backups in a device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name filter is oData Filter options +func (client BackupsClient) ListByDevice(deviceName string, resourceGroupName string, managerName string, filter string) (result BackupList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "ListByDevice") + } + + req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure sending request") + return + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure responding to request") + } + + return +} + +// ListByDevicePreparer prepares the ListByDevice request. +func (client BackupsClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/devices/{deviceName}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDeviceSender sends the ListByDevice request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) ListByDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDeviceResponder handles the response to the ListByDevice request. The method always +// closes the http.Response Body. +func (client BackupsClient) ListByDeviceResponder(resp *http.Response) (result BackupList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDeviceNextResults retrieves the next set of results, if any. +func (client BackupsClient) ListByDeviceNextResults(lastResults BackupList) (result BackupList, err error) { + req, err := lastResults.BackupListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure sending next results request") + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure responding to next results request") + } + + return +} + +// ListByDeviceComplete gets all elements from the list without paging. +func (client BackupsClient) ListByDeviceComplete(deviceName string, resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Backup, <-chan error) { + resultChan := make(chan Backup) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByDevice(deviceName, resourceGroupName, managerName, filter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByDeviceNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Restore restores the backup on the device. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// deviceName is the device name backupName is the backupSet name +// resourceGroupName is the resource group name managerName is the manager name +func (client BackupsClient) Restore(deviceName string, backupName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "Restore") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.RestorePreparer(deviceName, backupName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Restore", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Restore", resp, "Failure sending request") + return + } + + result, err = client.RestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Restore", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestorePreparer prepares the Restore request. +func (client BackupsClient) RestorePreparer(deviceName string, backupName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupName": backupName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}/restore", pathParameters), + 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 BackupsClient) 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 BackupsClient) 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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backupschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backupschedules.go new file mode 100644 index 000000000..d68c9d2f9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/backupschedules.go @@ -0,0 +1,400 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// BackupSchedulesClient is the client for the BackupSchedules methods of the +// Storsimple8000series service. +type BackupSchedulesClient struct { + ManagementClient +} + +// NewBackupSchedulesClient creates an instance of the BackupSchedulesClient +// client. +func NewBackupSchedulesClient(subscriptionID string) BackupSchedulesClient { + return NewBackupSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupSchedulesClientWithBaseURI creates an instance of the +// BackupSchedulesClient client. +func NewBackupSchedulesClientWithBaseURI(baseURI string, subscriptionID string) BackupSchedulesClient { + return BackupSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the backup schedule. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// deviceName is the device name backupPolicyName is the backup policy name. +// backupScheduleName is the backup schedule name. parameters is the backup +// schedule. resourceGroupName is the resource group name managerName is the +// manager name +func (client BackupSchedulesClient) CreateOrUpdate(deviceName string, backupPolicyName string, backupScheduleName string, parameters BackupSchedule, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan BackupSchedule, <-chan error) { + resultChan := make(chan BackupSchedule, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BackupScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.BackupScheduleProperties.ScheduleRecurrence", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.BackupScheduleProperties.ScheduleRecurrence.RecurrenceValue", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.BackupScheduleProperties.RetentionCount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupScheduleProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result BackupSchedule + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(deviceName, backupPolicyName, backupScheduleName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BackupSchedulesClient) CreateOrUpdatePreparer(deviceName string, backupPolicyName string, backupScheduleName string, parameters BackupSchedule, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "backupScheduleName": backupScheduleName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules/{backupScheduleName}", 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 BackupSchedulesClient) 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 BackupSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupSchedule, 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 backup schedule. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name backupPolicyName is the backup policy name. +// backupScheduleName is the name the backup schedule. resourceGroupName is the +// resource group name managerName is the manager name +func (client BackupSchedulesClient) Delete(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(deviceName, backupPolicyName, backupScheduleName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client BackupSchedulesClient) DeletePreparer(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "backupScheduleName": backupScheduleName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules/{backupScheduleName}", 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 BackupSchedulesClient) 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 BackupSchedulesClient) 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 backup schedule name. +// +// deviceName is the device name backupPolicyName is the backup policy name. +// backupScheduleName is the name of the backup schedule to be fetched +// resourceGroupName is the resource group name managerName is the manager name +func (client BackupSchedulesClient) Get(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string) (result BackupSchedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "Get") + } + + req, err := client.GetPreparer(deviceName, backupPolicyName, backupScheduleName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupSchedulesClient) GetPreparer(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "backupScheduleName": backupScheduleName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules/{backupScheduleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupSchedulesClient) GetResponder(resp *http.Response) (result BackupSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBackupPolicy gets all the backup schedules in a backup policy. +// +// deviceName is the device name backupPolicyName is the backup policy name. +// resourceGroupName is the resource group name managerName is the manager name +func (client BackupSchedulesClient) ListByBackupPolicy(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (result BackupScheduleList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy") + } + + req, err := client.ListByBackupPolicyPreparer(deviceName, backupPolicyName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBackupPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy", resp, "Failure sending request") + return + } + + result, err = client.ListByBackupPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy", resp, "Failure responding to request") + } + + return +} + +// ListByBackupPolicyPreparer prepares the ListByBackupPolicy request. +func (client BackupSchedulesClient) ListByBackupPolicyPreparer(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupPolicyName": backupPolicyName, + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByBackupPolicySender sends the ListByBackupPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client BackupSchedulesClient) ListByBackupPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByBackupPolicyResponder handles the response to the ListByBackupPolicy request. The method always +// closes the http.Response Body. +func (client BackupSchedulesClient) ListByBackupPolicyResponder(resp *http.Response) (result BackupScheduleList, 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/storsimple8000series/bandwidthsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/bandwidthsettings.go new file mode 100644 index 000000000..ca266176f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/bandwidthsettings.go @@ -0,0 +1,384 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// BandwidthSettingsClient is the client for the BandwidthSettings methods of +// the Storsimple8000series service. +type BandwidthSettingsClient struct { + ManagementClient +} + +// NewBandwidthSettingsClient creates an instance of the +// BandwidthSettingsClient client. +func NewBandwidthSettingsClient(subscriptionID string) BandwidthSettingsClient { + return NewBandwidthSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBandwidthSettingsClientWithBaseURI creates an instance of the +// BandwidthSettingsClient client. +func NewBandwidthSettingsClientWithBaseURI(baseURI string, subscriptionID string) BandwidthSettingsClient { + return BandwidthSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the bandwidth setting This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// bandwidthSettingName is the bandwidth setting name. parameters is the +// bandwidth setting to be added or updated. resourceGroupName is the resource +// group name managerName is the manager name +func (client BandwidthSettingsClient) CreateOrUpdate(bandwidthSettingName string, parameters BandwidthSetting, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan BandwidthSetting, <-chan error) { + resultChan := make(chan BandwidthSetting, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BandwidthRateSettingProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.BandwidthRateSettingProperties.Schedules", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result BandwidthSetting + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(bandwidthSettingName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BandwidthSettingsClient) CreateOrUpdatePreparer(bandwidthSettingName string, parameters BandwidthSetting, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bandwidthSettingName": bandwidthSettingName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/bandwidthSettings/{bandwidthSettingName}", 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 BandwidthSettingsClient) 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 BandwidthSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result BandwidthSetting, 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 bandwidth setting This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// bandwidthSettingName is the name of the bandwidth setting. resourceGroupName +// is the resource group name managerName is the manager name +func (client BandwidthSettingsClient) Delete(bandwidthSettingName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(bandwidthSettingName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client BandwidthSettingsClient) DeletePreparer(bandwidthSettingName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bandwidthSettingName": bandwidthSettingName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/bandwidthSettings/{bandwidthSettingName}", 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 BandwidthSettingsClient) 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 BandwidthSettingsClient) 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 returns the properties of the specified bandwidth setting name. +// +// bandwidthSettingName is the name of bandwidth setting to be fetched. +// resourceGroupName is the resource group name managerName is the manager name +func (client BandwidthSettingsClient) Get(bandwidthSettingName string, resourceGroupName string, managerName string) (result BandwidthSetting, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "Get") + } + + req, err := client.GetPreparer(bandwidthSettingName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BandwidthSettingsClient) GetPreparer(bandwidthSettingName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bandwidthSettingName": bandwidthSettingName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/bandwidthSettings/{bandwidthSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BandwidthSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BandwidthSettingsClient) GetResponder(resp *http.Response) (result BandwidthSetting, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManager retrieves all the bandwidth setting in a manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client BandwidthSettingsClient) ListByManager(resourceGroupName string, managerName string) (result BandwidthSettingList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager") + } + + req, err := client.ListByManagerPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager", resp, "Failure sending request") + return + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager", resp, "Failure responding to request") + } + + return +} + +// ListByManagerPreparer prepares the ListByManager request. +func (client BandwidthSettingsClient) ListByManagerPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/bandwidthSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByManagerSender sends the ListByManager request. The method will close the +// http.Response Body if it receives an error. +func (client BandwidthSettingsClient) ListByManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByManagerResponder handles the response to the ListByManager request. The method always +// closes the http.Response Body. +func (client BandwidthSettingsClient) ListByManagerResponder(resp *http.Response) (result BandwidthSettingList, 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/storsimple8000series/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/client.go new file mode 100644 index 000000000..5a2d2648a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/client.go @@ -0,0 +1,53 @@ +// Package storsimple8000series implements the Azure ARM Storsimple8000series +// service API version 2017-06-01. +// +// +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Storsimple8000series + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Storsimple8000series. +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/storsimple8000series/cloudappliances.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/cloudappliances.go new file mode 100644 index 000000000..8f364a1a1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/cloudappliances.go @@ -0,0 +1,214 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CloudAppliancesClient is the client for the CloudAppliances methods of the +// Storsimple8000series service. +type CloudAppliancesClient struct { + ManagementClient +} + +// NewCloudAppliancesClient creates an instance of the CloudAppliancesClient +// client. +func NewCloudAppliancesClient(subscriptionID string) CloudAppliancesClient { + return NewCloudAppliancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCloudAppliancesClientWithBaseURI creates an instance of the +// CloudAppliancesClient client. +func NewCloudAppliancesClientWithBaseURI(baseURI string, subscriptionID string) CloudAppliancesClient { + return CloudAppliancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListSupportedConfigurations lists supported cloud appliance models and +// supported configurations. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client CloudAppliancesClient) ListSupportedConfigurations(resourceGroupName string, managerName string) (result CloudApplianceConfigurationList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations") + } + + req, err := client.ListSupportedConfigurationsPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations", resp, "Failure responding to request") + } + + return +} + +// ListSupportedConfigurationsPreparer prepares the ListSupportedConfigurations request. +func (client CloudAppliancesClient) ListSupportedConfigurationsPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/cloudApplianceConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSupportedConfigurationsSender sends the ListSupportedConfigurations request. The method will close the +// http.Response Body if it receives an error. +func (client CloudAppliancesClient) ListSupportedConfigurationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSupportedConfigurationsResponder handles the response to the ListSupportedConfigurations request. The method always +// closes the http.Response Body. +func (client CloudAppliancesClient) ListSupportedConfigurationsResponder(resp *http.Response) (result CloudApplianceConfigurationList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Provision provisions cloud appliance. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// parameters is the cloud appliance resourceGroupName is the resource group +// name managerName is the manager name +func (client CloudAppliancesClient) Provision(parameters CloudAppliance, resourceGroupName string, managerName 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VnetRegion", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.CloudAppliancesClient", "Provision") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ProvisionPreparer(parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "Provision", nil, "Failure preparing request") + return + } + + resp, err := client.ProvisionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "Provision", resp, "Failure sending request") + return + } + + result, err = client.ProvisionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "Provision", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ProvisionPreparer prepares the Provision request. +func (client CloudAppliancesClient) ProvisionPreparer(parameters CloudAppliance, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/provisionCloudAppliance", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ProvisionSender sends the Provision request. The method will close the +// http.Response Body if it receives an error. +func (client CloudAppliancesClient) ProvisionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ProvisionResponder handles the response to the Provision request. The method always +// closes the http.Response Body. +func (client CloudAppliancesClient) 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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devices.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devices.go new file mode 100644 index 000000000..1e4d25823 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devices.go @@ -0,0 +1,1304 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// 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 client for the Devices methods of the +// Storsimple8000series service. +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)} +} + +// AuthorizeForServiceEncryptionKeyRollover authorizes the specified device for +// service data encryption key rollover. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) AuthorizeForServiceEncryptionKeyRollover(deviceName string, resourceGroupName string, managerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "AuthorizeForServiceEncryptionKeyRollover") + } + + req, err := client.AuthorizeForServiceEncryptionKeyRolloverPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "AuthorizeForServiceEncryptionKeyRollover", nil, "Failure preparing request") + return + } + + resp, err := client.AuthorizeForServiceEncryptionKeyRolloverSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "AuthorizeForServiceEncryptionKeyRollover", resp, "Failure sending request") + return + } + + result, err = client.AuthorizeForServiceEncryptionKeyRolloverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "AuthorizeForServiceEncryptionKeyRollover", resp, "Failure responding to request") + } + + return +} + +// AuthorizeForServiceEncryptionKeyRolloverPreparer prepares the AuthorizeForServiceEncryptionKeyRollover request. +func (client DevicesClient) AuthorizeForServiceEncryptionKeyRolloverPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/authorizeForServiceEncryptionKeyRollover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AuthorizeForServiceEncryptionKeyRolloverSender sends the AuthorizeForServiceEncryptionKeyRollover request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) AuthorizeForServiceEncryptionKeyRolloverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AuthorizeForServiceEncryptionKeyRolloverResponder handles the response to the AuthorizeForServiceEncryptionKeyRollover request. The method always +// closes the http.Response Body. +func (client DevicesClient) AuthorizeForServiceEncryptionKeyRolloverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Configure complete minimal setup before using the device. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// parameters is the minimal properties to configure a device. +// resourceGroupName is the resource group name managerName is the manager name +func (client DevicesClient) Configure(parameters ConfigureDeviceRequest, resourceGroupName string, managerName 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ConfigureDeviceRequestProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConfigureDeviceRequestProperties.FriendlyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConfigureDeviceRequestProperties.CurrentDeviceName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConfigureDeviceRequestProperties.TimeZone", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "Configure") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ConfigurePreparer(parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Configure", nil, "Failure preparing request") + return + } + + resp, err := client.ConfigureSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Configure", resp, "Failure sending request") + return + } + + result, err = client.ConfigureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Configure", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ConfigurePreparer prepares the Configure request. +func (client DevicesClient) ConfigurePreparer(parameters ConfigureDeviceRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/configureDevice", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ConfigureSender sends the Configure request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ConfigureSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ConfigureResponder handles the response to the Configure request. The method always +// closes the http.Response Body. +func (client DevicesClient) ConfigureResponder(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 +} + +// Deactivate deactivates the device. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) Deactivate(deviceName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "Deactivate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeactivatePreparer(deviceName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Deactivate", nil, "Failure preparing request") + return + } + + resp, err := client.DeactivateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Deactivate", resp, "Failure sending request") + return + } + + result, err = client.DeactivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Deactivate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeactivatePreparer prepares the Deactivate request. +func (client DevicesClient) DeactivatePreparer(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/deactivate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeactivateSender sends the Deactivate request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) DeactivateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeactivateResponder handles the response to the Deactivate request. The method always +// closes the http.Response Body. +func (client DevicesClient) DeactivateResponder(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 +} + +// Delete deletes the device. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) Delete(deviceName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(deviceName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DevicesClient) DeletePreparer(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}", 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 DevicesClient) 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 DevicesClient) 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 +} + +// Failover failovers a set of volume containers from a specified source device +// to a target device. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// sourceDeviceName is the source device name on which failover is performed. +// parameters is failoverRequest containing the source device and the list of +// volume containers to be failed over. resourceGroupName is the resource group +// name managerName is the manager name +func (client DevicesClient) Failover(sourceDeviceName string, parameters FailoverRequest, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "Failover") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.FailoverPreparer(sourceDeviceName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Failover", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Failover", resp, "Failure sending request") + return + } + + result, err = client.FailoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Failover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// FailoverPreparer prepares the Failover request. +func (client DevicesClient) FailoverPreparer(sourceDeviceName string, parameters FailoverRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "sourceDeviceName": sourceDeviceName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{sourceDeviceName}/failover", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// FailoverSender sends the Failover request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) FailoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// FailoverResponder handles the response to the Failover request. The method always +// closes the http.Response Body. +func (client DevicesClient) FailoverResponder(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 returns the properties of the specified device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name expand is specify $expand=details to +// populate additional fields related to the device or $expand=rolloverdetails +// to populate additional fields related to the service data encryption key +// rollover on device +func (client DevicesClient) Get(deviceName string, resourceGroupName string, managerName string, expand string) (result Device, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "Get") + } + + req, err := client.GetPreparer(deviceName, resourceGroupName, managerName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DevicesClient) GetPreparer(deviceName string, resourceGroupName string, managerName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/devices/{deviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetResponder(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 +} + +// GetUpdateSummary returns the update summary of the specified device name. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) GetUpdateSummary(deviceName string, resourceGroupName string, managerName string) (result Updates, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "GetUpdateSummary") + } + + req, err := client.GetUpdateSummaryPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "GetUpdateSummary", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpdateSummarySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "GetUpdateSummary", resp, "Failure sending request") + return + } + + result, err = client.GetUpdateSummaryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "GetUpdateSummary", resp, "Failure responding to request") + } + + return +} + +// GetUpdateSummaryPreparer prepares the GetUpdateSummary request. +func (client DevicesClient) GetUpdateSummaryPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/updateSummary/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetUpdateSummarySender sends the GetUpdateSummary request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetUpdateSummarySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetUpdateSummaryResponder handles the response to the GetUpdateSummary request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetUpdateSummaryResponder(resp *http.Response) (result Updates, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// InstallUpdates downloads and installs the updates on the device. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) InstallUpdates(deviceName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "InstallUpdates") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.InstallUpdatesPreparer(deviceName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "InstallUpdates", nil, "Failure preparing request") + return + } + + resp, err := client.InstallUpdatesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "InstallUpdates", resp, "Failure sending request") + return + } + + result, err = client.InstallUpdatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "InstallUpdates", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// InstallUpdatesPreparer prepares the InstallUpdates request. +func (client DevicesClient) InstallUpdatesPreparer(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/installUpdates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// InstallUpdatesSender sends the InstallUpdates request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) InstallUpdatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// InstallUpdatesResponder handles the response to the InstallUpdates request. The method always +// closes the http.Response Body. +func (client DevicesClient) InstallUpdatesResponder(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 +} + +// ListByManager returns the list of devices for the specified manager. +// +// resourceGroupName is the resource group name managerName is the manager name +// expand is specify $expand=details to populate additional fields related to +// the device or $expand=rolloverdetails to populate additional fields related +// to the service data encryption key rollover on device +func (client DevicesClient) ListByManager(resourceGroupName string, managerName string, expand string) (result DeviceList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "ListByManager") + } + + req, err := client.ListByManagerPreparer(resourceGroupName, managerName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListByManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListByManager", resp, "Failure sending request") + return + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListByManager", resp, "Failure responding to request") + } + + return +} + +// ListByManagerPreparer prepares the ListByManager request. +func (client DevicesClient) ListByManagerPreparer(resourceGroupName string, managerName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/devices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByManagerSender sends the ListByManager request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListByManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByManagerResponder handles the response to the ListByManager request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListByManagerResponder(resp *http.Response) (result DeviceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFailoverSets returns all failover sets for a given device and their +// eligibility for participating in a failover. A failover set refers to a set +// of volume containers that need to be failed-over as a single unit to +// maintain data integrity. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) ListFailoverSets(deviceName string, resourceGroupName string, managerName string) (result FailoverSetsList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "ListFailoverSets") + } + + req, err := client.ListFailoverSetsPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListFailoverSets", nil, "Failure preparing request") + return + } + + resp, err := client.ListFailoverSetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListFailoverSets", resp, "Failure sending request") + return + } + + result, err = client.ListFailoverSetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListFailoverSets", resp, "Failure responding to request") + } + + return +} + +// ListFailoverSetsPreparer prepares the ListFailoverSets request. +func (client DevicesClient) ListFailoverSetsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/listFailoverSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListFailoverSetsSender sends the ListFailoverSets request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListFailoverSetsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListFailoverSetsResponder handles the response to the ListFailoverSets request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListFailoverSetsResponder(resp *http.Response) (result FailoverSetsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFailoverTargets given a list of volume containers to be failed over from +// a source device, this method returns the eligibility result, as a failover +// target, for all devices under that resource. +// +// sourceDeviceName is the source device name on which failover is performed. +// parameters is listFailoverTargetsRequest containing the list of volume +// containers to be failed over. resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) ListFailoverTargets(sourceDeviceName string, parameters ListFailoverTargetsRequest, resourceGroupName string, managerName string) (result FailoverTargetsList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "ListFailoverTargets") + } + + req, err := client.ListFailoverTargetsPreparer(sourceDeviceName, parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListFailoverTargets", nil, "Failure preparing request") + return + } + + resp, err := client.ListFailoverTargetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListFailoverTargets", resp, "Failure sending request") + return + } + + result, err = client.ListFailoverTargetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListFailoverTargets", resp, "Failure responding to request") + } + + return +} + +// ListFailoverTargetsPreparer prepares the ListFailoverTargets request. +func (client DevicesClient) ListFailoverTargetsPreparer(sourceDeviceName string, parameters ListFailoverTargetsRequest, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "sourceDeviceName": sourceDeviceName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{sourceDeviceName}/listFailoverTargets", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListFailoverTargetsSender sends the ListFailoverTargets request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListFailoverTargetsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListFailoverTargetsResponder handles the response to the ListFailoverTargets request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListFailoverTargetsResponder(resp *http.Response) (result FailoverTargetsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinition gets the metric definitions for the specified device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) ListMetricDefinition(deviceName string, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "ListMetricDefinition") + } + + req, err := client.ListMetricDefinitionPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListMetricDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListMetricDefinition", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListMetricDefinition", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionPreparer prepares the ListMetricDefinition request. +func (client DevicesClient) ListMetricDefinitionPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/metricsDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, 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 gets the metrics for the specified device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name filter is oData Filter options +func (client DevicesClient) ListMetrics(deviceName string, resourceGroupName string, managerName string, filter string) (result MetricList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(deviceName, resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client DevicesClient) ListMetricsPreparer(deviceName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-01" + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/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 DevicesClient) 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 DevicesClient) ListMetricsResponder(resp *http.Response) (result MetricList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ScanForUpdates scans for updates on the device. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DevicesClient) ScanForUpdates(deviceName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "ScanForUpdates") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ScanForUpdatesPreparer(deviceName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ScanForUpdates", nil, "Failure preparing request") + return + } + + resp, err := client.ScanForUpdatesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ScanForUpdates", resp, "Failure sending request") + return + } + + result, err = client.ScanForUpdatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "ScanForUpdates", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ScanForUpdatesPreparer prepares the ScanForUpdates request. +func (client DevicesClient) ScanForUpdatesPreparer(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/scanForUpdates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ScanForUpdatesSender sends the ScanForUpdates request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ScanForUpdatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ScanForUpdatesResponder handles the response to the ScanForUpdates request. The method always +// closes the http.Response Body. +func (client DevicesClient) ScanForUpdatesResponder(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 +} + +// Update patches the device. +// +// deviceName is the device name parameters is patch representation of the +// device. resourceGroupName is the resource group name managerName is the +// manager name +func (client DevicesClient) Update(deviceName string, parameters DevicePatch, resourceGroupName string, managerName string) (result Device, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DevicesClient", "Update") + } + + req, err := client.UpdatePreparer(deviceName, parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DevicesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DevicesClient) UpdatePreparer(deviceName string, parameters DevicePatch, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}", 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 DevicesClient) 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 DevicesClient) UpdateResponder(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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devicesettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devicesettings.go new file mode 100644 index 000000000..68bc6b031 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/devicesettings.go @@ -0,0 +1,832 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DeviceSettingsClient is the client for the DeviceSettings methods of the +// Storsimple8000series service. +type DeviceSettingsClient struct { + ManagementClient +} + +// NewDeviceSettingsClient creates an instance of the DeviceSettingsClient +// client. +func NewDeviceSettingsClient(subscriptionID string) DeviceSettingsClient { + return NewDeviceSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeviceSettingsClientWithBaseURI creates an instance of the +// DeviceSettingsClient client. +func NewDeviceSettingsClientWithBaseURI(baseURI string, subscriptionID string) DeviceSettingsClient { + return DeviceSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdateAlertSettings creates or updates the alert settings of the +// specified device. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name parameters is the alert settings to be added +// or updated. resourceGroupName is the resource group name managerName is the +// manager name +func (client DeviceSettingsClient) CreateOrUpdateAlertSettings(deviceName string, parameters AlertSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan AlertSettings, <-chan error) { + resultChan := make(chan AlertSettings, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AlertNotificationProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AlertSettings + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateAlertSettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAlertSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAlertSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateAlertSettingsPreparer prepares the CreateOrUpdateAlertSettings request. +func (client DeviceSettingsClient) CreateOrUpdateAlertSettingsPreparer(deviceName string, parameters AlertSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateAlertSettingsSender sends the CreateOrUpdateAlertSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) CreateOrUpdateAlertSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateAlertSettingsResponder handles the response to the CreateOrUpdateAlertSettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) CreateOrUpdateAlertSettingsResponder(resp *http.Response) (result AlertSettings, 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 +} + +// CreateOrUpdateTimeSettings creates or updates the time settings of the +// specified device. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name parameters is the time settings to be added or +// updated. resourceGroupName is the resource group name managerName is the +// manager name +func (client DeviceSettingsClient) CreateOrUpdateTimeSettings(deviceName string, parameters TimeSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan TimeSettings, <-chan error) { + resultChan := make(chan TimeSettings, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TimeSettingsProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.TimeSettingsProperties.TimeZone", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result TimeSettings + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateTimeSettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateTimeSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateTimeSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateTimeSettingsPreparer prepares the CreateOrUpdateTimeSettings request. +func (client DeviceSettingsClient) CreateOrUpdateTimeSettingsPreparer(deviceName string, parameters TimeSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateTimeSettingsSender sends the CreateOrUpdateTimeSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) CreateOrUpdateTimeSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateTimeSettingsResponder handles the response to the CreateOrUpdateTimeSettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) CreateOrUpdateTimeSettingsResponder(resp *http.Response) (result TimeSettings, 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 +} + +// GetAlertSettings gets the alert settings of the specified device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DeviceSettingsClient) GetAlertSettings(deviceName string, resourceGroupName string, managerName string) (result AlertSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings") + } + + req, err := client.GetAlertSettingsPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetAlertSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings", resp, "Failure sending request") + return + } + + result, err = client.GetAlertSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings", resp, "Failure responding to request") + } + + return +} + +// GetAlertSettingsPreparer prepares the GetAlertSettings request. +func (client DeviceSettingsClient) GetAlertSettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAlertSettingsSender sends the GetAlertSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) GetAlertSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAlertSettingsResponder handles the response to the GetAlertSettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) GetAlertSettingsResponder(resp *http.Response) (result AlertSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkSettings gets the network settings of the specified device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DeviceSettingsClient) GetNetworkSettings(deviceName string, resourceGroupName string, managerName string) (result NetworkSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings") + } + + req, err := client.GetNetworkSettingsPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings", resp, "Failure responding to request") + } + + return +} + +// GetNetworkSettingsPreparer prepares the GetNetworkSettings request. +func (client DeviceSettingsClient) GetNetworkSettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetNetworkSettingsSender sends the GetNetworkSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) GetNetworkSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetNetworkSettingsResponder handles the response to the GetNetworkSettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) GetNetworkSettingsResponder(resp *http.Response) (result NetworkSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSecuritySettings returns the Security properties of the specified device +// name. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DeviceSettingsClient) GetSecuritySettings(deviceName string, resourceGroupName string, managerName string) (result SecuritySettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings") + } + + req, err := client.GetSecuritySettingsPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecuritySettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings", resp, "Failure sending request") + return + } + + result, err = client.GetSecuritySettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings", resp, "Failure responding to request") + } + + return +} + +// GetSecuritySettingsPreparer prepares the GetSecuritySettings request. +func (client DeviceSettingsClient) GetSecuritySettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSecuritySettingsSender sends the GetSecuritySettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) GetSecuritySettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSecuritySettingsResponder handles the response to the GetSecuritySettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) GetSecuritySettingsResponder(resp *http.Response) (result SecuritySettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTimeSettings gets the time settings of the specified device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DeviceSettingsClient) GetTimeSettings(deviceName string, resourceGroupName string, managerName string) (result TimeSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings") + } + + req, err := client.GetTimeSettingsPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetTimeSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings", resp, "Failure sending request") + return + } + + result, err = client.GetTimeSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings", resp, "Failure responding to request") + } + + return +} + +// GetTimeSettingsPreparer prepares the GetTimeSettings request. +func (client DeviceSettingsClient) GetTimeSettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetTimeSettingsSender sends the GetTimeSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) GetTimeSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetTimeSettingsResponder handles the response to the GetTimeSettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) GetTimeSettingsResponder(resp *http.Response) (result TimeSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SyncRemotemanagementCertificate sync Remote management Certificate between +// appliance and 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. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client DeviceSettingsClient) SyncRemotemanagementCertificate(deviceName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.SyncRemotemanagementCertificatePreparer(deviceName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.SyncRemotemanagementCertificateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate", resp, "Failure sending request") + return + } + + result, err = client.SyncRemotemanagementCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SyncRemotemanagementCertificatePreparer prepares the SyncRemotemanagementCertificate request. +func (client DeviceSettingsClient) SyncRemotemanagementCertificatePreparer(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default/syncRemoteManagementCertificate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SyncRemotemanagementCertificateSender sends the SyncRemotemanagementCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) SyncRemotemanagementCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SyncRemotemanagementCertificateResponder handles the response to the SyncRemotemanagementCertificate request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) SyncRemotemanagementCertificateResponder(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 +} + +// UpdateNetworkSettings updates the network settings on the specified device. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// deviceName is the device name parameters is the network settings to be +// updated. resourceGroupName is the resource group name managerName is the +// manager name +func (client DeviceSettingsClient) UpdateNetworkSettings(deviceName string, parameters NetworkSettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan NetworkSettings, <-chan error) { + resultChan := make(chan NetworkSettings, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result NetworkSettings + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdateNetworkSettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateNetworkSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateNetworkSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateNetworkSettingsPreparer prepares the UpdateNetworkSettings request. +func (client DeviceSettingsClient) UpdateNetworkSettingsPreparer(deviceName string, parameters NetworkSettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateNetworkSettingsSender sends the UpdateNetworkSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) UpdateNetworkSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateNetworkSettingsResponder handles the response to the UpdateNetworkSettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) UpdateNetworkSettingsResponder(resp *http.Response) (result NetworkSettings, 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 +} + +// UpdateSecuritySettings patch Security properties of the specified device +// 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. +// +// deviceName is the device name parameters is the security settings properties +// to be patched. resourceGroupName is the resource group name managerName is +// the manager name +func (client DeviceSettingsClient) UpdateSecuritySettings(deviceName string, parameters SecuritySettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan SecuritySettings, <-chan error) { + resultChan := make(chan SecuritySettings, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result SecuritySettings + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.UpdateSecuritySettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSecuritySettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateSecuritySettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateSecuritySettingsPreparer prepares the UpdateSecuritySettings request. +func (client DeviceSettingsClient) UpdateSecuritySettingsPreparer(deviceName string, parameters SecuritySettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSecuritySettingsSender sends the UpdateSecuritySettings request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSettingsClient) UpdateSecuritySettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateSecuritySettingsResponder handles the response to the UpdateSecuritySettings request. The method always +// closes the http.Response Body. +func (client DeviceSettingsClient) UpdateSecuritySettingsResponder(resp *http.Response) (result SecuritySettings, 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/storsimple8000series/hardwarecomponentgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/hardwarecomponentgroups.go new file mode 100644 index 000000000..bce206034 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/hardwarecomponentgroups.go @@ -0,0 +1,219 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// HardwareComponentGroupsClient is the client for the HardwareComponentGroups +// methods of the Storsimple8000series service. +type HardwareComponentGroupsClient struct { + ManagementClient +} + +// NewHardwareComponentGroupsClient creates an instance of the +// HardwareComponentGroupsClient client. +func NewHardwareComponentGroupsClient(subscriptionID string) HardwareComponentGroupsClient { + return NewHardwareComponentGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHardwareComponentGroupsClientWithBaseURI creates an instance of the +// HardwareComponentGroupsClient client. +func NewHardwareComponentGroupsClientWithBaseURI(baseURI string, subscriptionID string) HardwareComponentGroupsClient { + return HardwareComponentGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ChangeControllerPowerState changes the power state of the controller. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// deviceName is the device name hardwareComponentGroupName is the hardware +// component group name. parameters is the controller power state change +// request. resourceGroupName is the resource group name managerName is the +// manager name +func (client HardwareComponentGroupsClient) ChangeControllerPowerState(deviceName string, hardwareComponentGroupName string, parameters ControllerPowerStateChangeRequest, resourceGroupName string, managerName 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ControllerPowerStateChangeRequestProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.ChangeControllerPowerStatePreparer(deviceName, hardwareComponentGroupName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState", nil, "Failure preparing request") + return + } + + resp, err := client.ChangeControllerPowerStateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState", resp, "Failure sending request") + return + } + + result, err = client.ChangeControllerPowerStateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ChangeControllerPowerStatePreparer prepares the ChangeControllerPowerState request. +func (client HardwareComponentGroupsClient) ChangeControllerPowerStatePreparer(deviceName string, hardwareComponentGroupName string, parameters ControllerPowerStateChangeRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "hardwareComponentGroupName": hardwareComponentGroupName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/hardwareComponentGroups/{hardwareComponentGroupName}/changeControllerPowerState", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ChangeControllerPowerStateSender sends the ChangeControllerPowerState request. The method will close the +// http.Response Body if it receives an error. +func (client HardwareComponentGroupsClient) ChangeControllerPowerStateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ChangeControllerPowerStateResponder handles the response to the ChangeControllerPowerState request. The method always +// closes the http.Response Body. +func (client HardwareComponentGroupsClient) ChangeControllerPowerStateResponder(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 +} + +// ListByDevice lists the hardware component groups at device-level. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client HardwareComponentGroupsClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result HardwareComponentGroupList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice") + } + + req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice", resp, "Failure sending request") + return + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice", resp, "Failure responding to request") + } + + return +} + +// ListByDevicePreparer prepares the ListByDevice request. +func (client HardwareComponentGroupsClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/hardwareComponentGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDeviceSender sends the ListByDevice request. The method will close the +// http.Response Body if it receives an error. +func (client HardwareComponentGroupsClient) ListByDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDeviceResponder handles the response to the ListByDevice request. The method always +// closes the http.Response Body. +func (client HardwareComponentGroupsClient) ListByDeviceResponder(resp *http.Response) (result HardwareComponentGroupList, 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/storsimple8000series/jobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/jobs.go new file mode 100644 index 000000000..5ab8a346b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/jobs.go @@ -0,0 +1,504 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// 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 Storsimple8000series +// 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)} +} + +// Cancel cancels a job on the device. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name jobName is the jobName. resourceGroupName is +// the resource group name managerName is the manager name +func (client JobsClient) Cancel(deviceName string, jobName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "Cancel") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CancelPreparer(deviceName, jobName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Cancel", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CancelPreparer prepares the Cancel request. +func (client JobsClient) CancelPreparer(deviceName string, jobName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "jobName": jobName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/jobs/{jobName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) CancelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client JobsClient) CancelResponder(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 details of the specified job name. +// +// deviceName is the device name jobName is the job Name. resourceGroupName is +// the resource group name managerName is the manager name +func (client JobsClient) Get(deviceName string, jobName string, resourceGroupName string, managerName string) (result Job, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "Get") + } + + req, err := client.GetPreparer(deviceName, jobName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.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, "storsimple8000series.JobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobsClient) GetPreparer(deviceName string, jobName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "jobName": jobName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/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 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 +} + +// ListByDevice gets all the jobs for specified device. With optional OData +// query parameters, a filtered set of jobs is returned. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name filter is oData Filter options +func (client JobsClient) ListByDevice(deviceName string, resourceGroupName string, managerName string, filter string) (result JobList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "ListByDevice") + } + + req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure sending request") + return + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure responding to request") + } + + return +} + +// ListByDevicePreparer prepares the ListByDevice request. +func (client JobsClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/devices/{deviceName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDeviceSender sends the ListByDevice request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListByDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDeviceResponder handles the response to the ListByDevice request. The method always +// closes the http.Response Body. +func (client JobsClient) ListByDeviceResponder(resp *http.Response) (result JobList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDeviceNextResults retrieves the next set of results, if any. +func (client JobsClient) ListByDeviceNextResults(lastResults JobList) (result JobList, err error) { + req, err := lastResults.JobListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure sending next results request") + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure responding to next results request") + } + + return +} + +// ListByDeviceComplete gets all elements from the list without paging. +func (client JobsClient) ListByDeviceComplete(deviceName string, resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByDevice(deviceName, resourceGroupName, managerName, filter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByDeviceNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByManager gets all the jobs for the specified manager. With optional +// OData query parameters, a filtered set of jobs is returned. +// +// resourceGroupName is the resource group name managerName is the manager name +// filter is oData Filter options +func (client JobsClient) ListByManager(resourceGroupName string, managerName string, filter string) (result JobList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "ListByManager") + } + + req, err := client.ListByManagerPreparer(resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure sending request") + return + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure responding to request") + } + + return +} + +// ListByManagerPreparer prepares the ListByManager request. +func (client JobsClient) ListByManagerPreparer(resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByManagerSender sends the ListByManager request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListByManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByManagerResponder handles the response to the ListByManager request. The method always +// closes the http.Response Body. +func (client JobsClient) ListByManagerResponder(resp *http.Response) (result JobList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagerNextResults retrieves the next set of results, if any. +func (client JobsClient) ListByManagerNextResults(lastResults JobList) (result JobList, err error) { + req, err := lastResults.JobListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure sending next results request") + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure responding to next results request") + } + + return +} + +// ListByManagerComplete gets all elements from the list without paging. +func (client JobsClient) ListByManagerComplete(resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Job, <-chan error) { + resultChan := make(chan Job) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByManager(resourceGroupName, managerName, filter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByManagerNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/managers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/managers.go new file mode 100644 index 000000000..825668e47 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/managers.go @@ -0,0 +1,1354 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ManagersClient is the client for the Managers methods of the +// Storsimple8000series service. +type ManagersClient struct { + ManagementClient +} + +// NewManagersClient creates an instance of the ManagersClient client. +func NewManagersClient(subscriptionID string) ManagersClient { + return NewManagersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagersClientWithBaseURI creates an instance of the ManagersClient +// client. +func NewManagersClientWithBaseURI(baseURI string, subscriptionID string) ManagersClient { + return ManagersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateExtendedInfo creates the extended info of the manager. +// +// parameters is the manager extended information. resourceGroupName is the +// resource group name managerName is the manager name +func (client ManagersClient) CreateExtendedInfo(parameters ManagerExtendedInfo, resourceGroupName string, managerName string) (result ManagerExtendedInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagerExtendedInfoProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagerExtendedInfoProperties.IntegrityKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ManagerExtendedInfoProperties.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "CreateExtendedInfo") + } + + req, err := client.CreateExtendedInfoPreparer(parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "CreateExtendedInfo", nil, "Failure preparing request") + return + } + + resp, err := client.CreateExtendedInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "CreateExtendedInfo", resp, "Failure sending request") + return + } + + result, err = client.CreateExtendedInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "CreateExtendedInfo", resp, "Failure responding to request") + } + + return +} + +// CreateExtendedInfoPreparer prepares the CreateExtendedInfo request. +func (client ManagersClient) CreateExtendedInfoPreparer(parameters ManagerExtendedInfo, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateExtendedInfoSender sends the CreateExtendedInfo request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) CreateExtendedInfoSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateExtendedInfoResponder handles the response to the CreateExtendedInfo request. The method always +// closes the http.Response Body. +func (client ManagersClient) CreateExtendedInfoResponder(resp *http.Response) (result ManagerExtendedInfo, 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 the manager. +// +// parameters is the manager. resourceGroupName is the resource group name +// managerName is the manager name +func (client ManagersClient) CreateOrUpdate(parameters Manager, resourceGroupName string, managerName string) (result Manager, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagerProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagerProperties.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagerProperties.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagersClient) CreateOrUpdatePreparer(parameters Manager, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}", 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 ManagersClient) 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 ManagersClient) CreateOrUpdateResponder(resp *http.Response) (result Manager, 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 manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) Delete(resourceGroupName string, managerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagersClient) DeletePreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}", 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 ManagersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagersClient) 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 +} + +// DeleteExtendedInfo deletes the extended info of the manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) DeleteExtendedInfo(resourceGroupName string, managerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "DeleteExtendedInfo") + } + + req, err := client.DeleteExtendedInfoPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "DeleteExtendedInfo", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteExtendedInfoSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "DeleteExtendedInfo", resp, "Failure sending request") + return + } + + result, err = client.DeleteExtendedInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "DeleteExtendedInfo", resp, "Failure responding to request") + } + + return +} + +// DeleteExtendedInfoPreparer prepares the DeleteExtendedInfo request. +func (client ManagersClient) DeleteExtendedInfoPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteExtendedInfoSender sends the DeleteExtendedInfo request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) DeleteExtendedInfoSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteExtendedInfoResponder handles the response to the DeleteExtendedInfo request. The method always +// closes the http.Response Body. +func (client ManagersClient) DeleteExtendedInfoResponder(resp *http.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 properties of the specified manager name. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) Get(resourceGroupName string, managerName string) (result Manager, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagersClient) GetPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagersClient) GetResponder(resp *http.Response) (result Manager, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetActivationKey returns the activation key of the manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) GetActivationKey(resourceGroupName string, managerName string) (result Key, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "GetActivationKey") + } + + req, err := client.GetActivationKeyPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetActivationKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetActivationKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetActivationKey", resp, "Failure sending request") + return + } + + result, err = client.GetActivationKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetActivationKey", resp, "Failure responding to request") + } + + return +} + +// GetActivationKeyPreparer prepares the GetActivationKey request. +func (client ManagersClient) GetActivationKeyPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/listActivationKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetActivationKeySender sends the GetActivationKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) GetActivationKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetActivationKeyResponder handles the response to the GetActivationKey request. The method always +// closes the http.Response Body. +func (client ManagersClient) GetActivationKeyResponder(resp *http.Response) (result Key, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDevicePublicEncryptionKey returns the public encryption key of the +// device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client ManagersClient) GetDevicePublicEncryptionKey(deviceName string, resourceGroupName string, managerName string) (result PublicKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "GetDevicePublicEncryptionKey") + } + + req, err := client.GetDevicePublicEncryptionKeyPreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetDevicePublicEncryptionKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetDevicePublicEncryptionKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetDevicePublicEncryptionKey", resp, "Failure sending request") + return + } + + result, err = client.GetDevicePublicEncryptionKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetDevicePublicEncryptionKey", resp, "Failure responding to request") + } + + return +} + +// GetDevicePublicEncryptionKeyPreparer prepares the GetDevicePublicEncryptionKey request. +func (client ManagersClient) GetDevicePublicEncryptionKeyPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/publicEncryptionKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDevicePublicEncryptionKeySender sends the GetDevicePublicEncryptionKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) GetDevicePublicEncryptionKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDevicePublicEncryptionKeyResponder handles the response to the GetDevicePublicEncryptionKey request. The method always +// closes the http.Response Body. +func (client ManagersClient) GetDevicePublicEncryptionKeyResponder(resp *http.Response) (result PublicKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEncryptionSettings returns the encryption settings of the manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) GetEncryptionSettings(resourceGroupName string, managerName string) (result EncryptionSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "GetEncryptionSettings") + } + + req, err := client.GetEncryptionSettingsPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetEncryptionSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetEncryptionSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetEncryptionSettings", resp, "Failure sending request") + return + } + + result, err = client.GetEncryptionSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetEncryptionSettings", resp, "Failure responding to request") + } + + return +} + +// GetEncryptionSettingsPreparer prepares the GetEncryptionSettings request. +func (client ManagersClient) GetEncryptionSettingsPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/encryptionSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetEncryptionSettingsSender sends the GetEncryptionSettings request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) GetEncryptionSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetEncryptionSettingsResponder handles the response to the GetEncryptionSettings request. The method always +// closes the http.Response Body. +func (client ManagersClient) GetEncryptionSettingsResponder(resp *http.Response) (result EncryptionSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetExtendedInfo returns the extended information of the specified manager +// name. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) GetExtendedInfo(resourceGroupName string, managerName string) (result ManagerExtendedInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "GetExtendedInfo") + } + + req, err := client.GetExtendedInfoPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetExtendedInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetExtendedInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetExtendedInfo", resp, "Failure sending request") + return + } + + result, err = client.GetExtendedInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetExtendedInfo", resp, "Failure responding to request") + } + + return +} + +// GetExtendedInfoPreparer prepares the GetExtendedInfo request. +func (client ManagersClient) GetExtendedInfoPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetExtendedInfoSender sends the GetExtendedInfo request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) GetExtendedInfoSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetExtendedInfoResponder handles the response to the GetExtendedInfo request. The method always +// closes the http.Response Body. +func (client ManagersClient) GetExtendedInfoResponder(resp *http.Response) (result ManagerExtendedInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublicEncryptionKey returns the symmetric encrypted public encryption key +// of the manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) GetPublicEncryptionKey(resourceGroupName string, managerName string) (result SymmetricEncryptedSecret, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "GetPublicEncryptionKey") + } + + req, err := client.GetPublicEncryptionKeyPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetPublicEncryptionKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetPublicEncryptionKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetPublicEncryptionKey", resp, "Failure sending request") + return + } + + result, err = client.GetPublicEncryptionKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "GetPublicEncryptionKey", resp, "Failure responding to request") + } + + return +} + +// GetPublicEncryptionKeyPreparer prepares the GetPublicEncryptionKey request. +func (client ManagersClient) GetPublicEncryptionKeyPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/listPublicEncryptionKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPublicEncryptionKeySender sends the GetPublicEncryptionKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) GetPublicEncryptionKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPublicEncryptionKeyResponder handles the response to the GetPublicEncryptionKey request. The method always +// closes the http.Response Body. +func (client ManagersClient) GetPublicEncryptionKeyResponder(resp *http.Response) (result SymmetricEncryptedSecret, 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 all the managers in a subscription. +func (client ManagersClient) List() (result ManagerList, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorSimple/managers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagersClient) ListResponder(resp *http.Response) (result ManagerList, 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 the managers in a resource group. +// +// resourceGroupName is the resource group name +func (client ManagersClient) ListByResourceGroup(resourceGroupName string) (result ManagerList, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers", 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 ManagersClient) 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 ManagersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagerList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFeatureSupportStatus lists the features and their support status +// +// resourceGroupName is the resource group name managerName is the manager name +// filter is oData Filter options +func (client ManagersClient) ListFeatureSupportStatus(resourceGroupName string, managerName string, filter string) (result FeatureList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "ListFeatureSupportStatus") + } + + req, err := client.ListFeatureSupportStatusPreparer(resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListFeatureSupportStatus", nil, "Failure preparing request") + return + } + + resp, err := client.ListFeatureSupportStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListFeatureSupportStatus", resp, "Failure sending request") + return + } + + result, err = client.ListFeatureSupportStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListFeatureSupportStatus", resp, "Failure responding to request") + } + + return +} + +// ListFeatureSupportStatusPreparer prepares the ListFeatureSupportStatus request. +func (client ManagersClient) ListFeatureSupportStatusPreparer(resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-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.StorSimple/managers/{managerName}/features", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListFeatureSupportStatusSender sends the ListFeatureSupportStatus request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) ListFeatureSupportStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListFeatureSupportStatusResponder handles the response to the ListFeatureSupportStatus request. The method always +// closes the http.Response Body. +func (client ManagersClient) ListFeatureSupportStatusResponder(resp *http.Response) (result FeatureList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinition gets the metric definitions for the specified manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) ListMetricDefinition(resourceGroupName string, managerName string) (result MetricDefinitionList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "ListMetricDefinition") + } + + req, err := client.ListMetricDefinitionPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListMetricDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListMetricDefinition", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListMetricDefinition", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionPreparer prepares the ListMetricDefinition request. +func (client ManagersClient) ListMetricDefinitionPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/metricsDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always +// closes the http.Response Body. +func (client ManagersClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, 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 gets the metrics for the specified manager. +// +// resourceGroupName is the resource group name managerName is the manager name +// filter is oData Filter options +func (client ManagersClient) ListMetrics(resourceGroupName string, managerName string, filter string) (result MetricList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client ManagersClient) ListMetricsPreparer(resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-06-01" + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/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 ManagersClient) 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 ManagersClient) ListMetricsResponder(resp *http.Response) (result MetricList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateActivationKey re-generates and returns the activation key of the +// manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client ManagersClient) RegenerateActivationKey(resourceGroupName string, managerName string) (result Key, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "RegenerateActivationKey") + } + + req, err := client.RegenerateActivationKeyPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "RegenerateActivationKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateActivationKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "RegenerateActivationKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateActivationKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "RegenerateActivationKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateActivationKeyPreparer prepares the RegenerateActivationKey request. +func (client ManagersClient) RegenerateActivationKeyPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/regenerateActivationKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateActivationKeySender sends the RegenerateActivationKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) RegenerateActivationKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateActivationKeyResponder handles the response to the RegenerateActivationKey request. The method always +// closes the http.Response Body. +func (client ManagersClient) RegenerateActivationKeyResponder(resp *http.Response) (result Key, 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 StorSimple Manager. +// +// parameters is the manager update parameters. resourceGroupName is the +// resource group name managerName is the manager name +func (client ManagersClient) Update(parameters ManagerPatch, resourceGroupName string, managerName string) (result Manager, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "Update") + } + + req, err := client.UpdatePreparer(parameters, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ManagersClient) UpdatePreparer(parameters ManagerPatch, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}", 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 ManagersClient) 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 ManagersClient) UpdateResponder(resp *http.Response) (result Manager, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateExtendedInfo updates the extended info of the manager. +// +// parameters is the manager extended information. resourceGroupName is the +// resource group name managerName is the manager name ifMatch is pass the ETag +// of ExtendedInfo fetched from GET call +func (client ManagersClient) UpdateExtendedInfo(parameters ManagerExtendedInfo, resourceGroupName string, managerName string, ifMatch string) (result ManagerExtendedInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.ManagersClient", "UpdateExtendedInfo") + } + + req, err := client.UpdateExtendedInfoPreparer(parameters, resourceGroupName, managerName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "UpdateExtendedInfo", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateExtendedInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "UpdateExtendedInfo", resp, "Failure sending request") + return + } + + result, err = client.UpdateExtendedInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.ManagersClient", "UpdateExtendedInfo", resp, "Failure responding to request") + } + + return +} + +// UpdateExtendedInfoPreparer prepares the UpdateExtendedInfo request. +func (client ManagersClient) UpdateExtendedInfoPreparer(parameters ManagerExtendedInfo, resourceGroupName string, managerName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateExtendedInfoSender sends the UpdateExtendedInfo request. The method will close the +// http.Response Body if it receives an error. +func (client ManagersClient) UpdateExtendedInfoSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateExtendedInfoResponder handles the response to the UpdateExtendedInfo request. The method always +// closes the http.Response Body. +func (client ManagersClient) UpdateExtendedInfoResponder(resp *http.Response) (result ManagerExtendedInfo, 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/storsimple8000series/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/models.go new file mode 100644 index 000000000..98caf1bb4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/models.go @@ -0,0 +1,1954 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause 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" +) + +// AlertEmailNotificationStatus enumerates the values for alert email +// notification status. +type AlertEmailNotificationStatus string + +const ( + // Disabled specifies the disabled state for alert email notification + // status. + Disabled AlertEmailNotificationStatus = "Disabled" + // Enabled specifies the enabled state for alert email notification status. + Enabled AlertEmailNotificationStatus = "Enabled" +) + +// AlertScope enumerates the values for alert scope. +type AlertScope string + +const ( + // AlertScopeDevice specifies the alert scope device state for alert scope. + AlertScopeDevice AlertScope = "Device" + // AlertScopeResource specifies the alert scope resource state for alert + // scope. + AlertScopeResource AlertScope = "Resource" +) + +// AlertSeverity enumerates the values for alert severity. +type AlertSeverity string + +const ( + // Critical specifies the critical state for alert severity. + Critical AlertSeverity = "Critical" + // Informational specifies the informational state for alert severity. + Informational AlertSeverity = "Informational" + // Warning specifies the warning state for alert severity. + Warning AlertSeverity = "Warning" +) + +// AlertSourceType enumerates the values for alert source type. +type AlertSourceType string + +const ( + // AlertSourceTypeDevice specifies the alert source type device state for + // alert source type. + AlertSourceTypeDevice AlertSourceType = "Device" + // AlertSourceTypeResource specifies the alert source type resource state + // for alert source type. + AlertSourceTypeResource AlertSourceType = "Resource" +) + +// AlertStatus enumerates the values for alert status. +type AlertStatus string + +const ( + // Active specifies the active state for alert status. + Active AlertStatus = "Active" + // Cleared specifies the cleared state for alert status. + Cleared AlertStatus = "Cleared" +) + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // Basic specifies the basic state for authentication type. + Basic AuthenticationType = "Basic" + // Invalid specifies the invalid state for authentication type. + Invalid AuthenticationType = "Invalid" + // None specifies the none state for authentication type. + None AuthenticationType = "None" + // NTLM specifies the ntlm state for authentication type. + NTLM AuthenticationType = "NTLM" +) + +// AuthorizationEligibility enumerates the values for authorization +// eligibility. +type AuthorizationEligibility string + +const ( + // Eligible specifies the eligible state for authorization eligibility. + Eligible AuthorizationEligibility = "Eligible" + // InEligible specifies the in eligible state for authorization + // eligibility. + InEligible AuthorizationEligibility = "InEligible" +) + +// AuthorizationStatus enumerates the values for authorization status. +type AuthorizationStatus string + +const ( + // AuthorizationStatusDisabled specifies the authorization status disabled + // state for authorization status. + AuthorizationStatusDisabled AuthorizationStatus = "Disabled" + // AuthorizationStatusEnabled specifies the authorization status enabled + // state for authorization status. + AuthorizationStatusEnabled AuthorizationStatus = "Enabled" +) + +// BackupJobCreationType enumerates the values for backup job creation type. +type BackupJobCreationType string + +const ( + // Adhoc specifies the adhoc state for backup job creation type. + Adhoc BackupJobCreationType = "Adhoc" + // BySchedule specifies the by schedule state for backup job creation type. + BySchedule BackupJobCreationType = "BySchedule" + // BySSM specifies the by ssm state for backup job creation type. + BySSM BackupJobCreationType = "BySSM" +) + +// BackupPolicyCreationType enumerates the values for backup policy creation +// type. +type BackupPolicyCreationType string + +const ( + // BackupPolicyCreationTypeBySaaS specifies the backup policy creation type + // by saa s state for backup policy creation type. + BackupPolicyCreationTypeBySaaS BackupPolicyCreationType = "BySaaS" + // BackupPolicyCreationTypeBySSM specifies the backup policy creation type + // by ssm state for backup policy creation type. + BackupPolicyCreationTypeBySSM BackupPolicyCreationType = "BySSM" +) + +// BackupStatus enumerates the values for backup status. +type BackupStatus string + +const ( + // BackupStatusDisabled specifies the backup status disabled state for + // backup status. + BackupStatusDisabled BackupStatus = "Disabled" + // BackupStatusEnabled specifies the backup status enabled state for backup + // status. + BackupStatusEnabled BackupStatus = "Enabled" +) + +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // CloudSnapshot specifies the cloud snapshot state for backup type. + CloudSnapshot BackupType = "CloudSnapshot" + // LocalSnapshot specifies the local snapshot state for backup type. + LocalSnapshot BackupType = "LocalSnapshot" +) + +// ControllerID enumerates the values for controller id. +type ControllerID string + +const ( + // ControllerIDController0 specifies the controller id controller 0 state + // for controller id. + ControllerIDController0 ControllerID = "Controller0" + // ControllerIDController1 specifies the controller id controller 1 state + // for controller id. + ControllerIDController1 ControllerID = "Controller1" + // ControllerIDNone specifies the controller id none state for controller + // id. + ControllerIDNone ControllerID = "None" + // ControllerIDUnknown specifies the controller id unknown state for + // controller id. + ControllerIDUnknown ControllerID = "Unknown" +) + +// ControllerPowerStateAction enumerates the values for controller power state +// action. +type ControllerPowerStateAction string + +const ( + // Restart specifies the restart state for controller power state action. + Restart ControllerPowerStateAction = "Restart" + // Shutdown specifies the shutdown state for controller power state action. + Shutdown ControllerPowerStateAction = "Shutdown" + // Start specifies the start state for controller power state action. + Start ControllerPowerStateAction = "Start" +) + +// ControllerStatus enumerates the values for controller status. +type ControllerStatus string + +const ( + // ControllerStatusFailure specifies the controller status failure state + // for controller status. + ControllerStatusFailure ControllerStatus = "Failure" + // ControllerStatusNotPresent specifies the controller status not present + // state for controller status. + ControllerStatusNotPresent ControllerStatus = "NotPresent" + // ControllerStatusOk specifies the controller status ok state for + // controller status. + ControllerStatusOk ControllerStatus = "Ok" + // ControllerStatusPoweredOff specifies the controller status powered off + // state for controller status. + ControllerStatusPoweredOff ControllerStatus = "PoweredOff" + // ControllerStatusRecovering specifies the controller status recovering + // state for controller status. + ControllerStatusRecovering ControllerStatus = "Recovering" + // ControllerStatusWarning specifies the controller status warning state + // for controller status. + ControllerStatusWarning ControllerStatus = "Warning" +) + +// 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" +) + +// DeviceConfigurationStatus enumerates the values for device configuration +// status. +type DeviceConfigurationStatus string + +const ( + // Complete specifies the complete state for device configuration status. + Complete DeviceConfigurationStatus = "Complete" + // Pending specifies the pending state for device configuration status. + Pending DeviceConfigurationStatus = "Pending" +) + +// DeviceStatus enumerates the values for device status. +type DeviceStatus string + +const ( + // Creating specifies the creating state for device status. + Creating DeviceStatus = "Creating" + // Deactivated specifies the deactivated state for device status. + Deactivated DeviceStatus = "Deactivated" + // Deactivating specifies the deactivating state for device status. + Deactivating DeviceStatus = "Deactivating" + // Deleted specifies the deleted state for device status. + Deleted DeviceStatus = "Deleted" + // MaintenanceMode specifies the maintenance mode state for device status. + MaintenanceMode DeviceStatus = "MaintenanceMode" + // Offline specifies the offline state for device status. + Offline DeviceStatus = "Offline" + // Online specifies the online state for device status. + Online DeviceStatus = "Online" + // Provisioning specifies the provisioning state for device status. + Provisioning DeviceStatus = "Provisioning" + // ReadyToSetup specifies the ready to setup state for device status. + ReadyToSetup DeviceStatus = "ReadyToSetup" + // RequiresAttention specifies the requires attention state for device + // status. + RequiresAttention DeviceStatus = "RequiresAttention" + // Unknown specifies the unknown state for device status. + Unknown DeviceStatus = "Unknown" +) + +// DeviceType enumerates the values for device type. +type DeviceType string + +const ( + // DeviceTypeInvalid specifies the device type invalid state for device + // type. + DeviceTypeInvalid DeviceType = "Invalid" + // DeviceTypeSeries8000PhysicalAppliance specifies the device type series + // 8000 physical appliance state for device type. + DeviceTypeSeries8000PhysicalAppliance DeviceType = "Series8000PhysicalAppliance" + // DeviceTypeSeries8000VirtualAppliance specifies the device type series + // 8000 virtual appliance state for device type. + DeviceTypeSeries8000VirtualAppliance DeviceType = "Series8000VirtualAppliance" +) + +// EncryptionAlgorithm enumerates the values for encryption algorithm. +type EncryptionAlgorithm string + +const ( + // EncryptionAlgorithmAES256 specifies the encryption algorithm aes256 + // state for encryption algorithm. + EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" + // EncryptionAlgorithmNone specifies the encryption algorithm none state + // for encryption algorithm. + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + // EncryptionAlgorithmRSAESPKCS1V15 specifies the encryption algorithm + // rsaespkcs1v15 state for encryption algorithm. + EncryptionAlgorithmRSAESPKCS1V15 EncryptionAlgorithm = "RSAES_PKCS1_v_1_5" +) + +// EncryptionStatus enumerates the values for encryption status. +type EncryptionStatus string + +const ( + // EncryptionStatusDisabled specifies the encryption status disabled state + // for encryption status. + EncryptionStatusDisabled EncryptionStatus = "Disabled" + // EncryptionStatusEnabled specifies the encryption status enabled state + // for encryption status. + EncryptionStatusEnabled EncryptionStatus = "Enabled" +) + +// FeatureSupportStatus enumerates the values for feature support status. +type FeatureSupportStatus string + +const ( + // NotAvailable specifies the not available state for feature support + // status. + NotAvailable FeatureSupportStatus = "NotAvailable" + // Supported specifies the supported state for feature support status. + Supported FeatureSupportStatus = "Supported" + // UnsupportedDeviceVersion specifies the unsupported device version state + // for feature support status. + UnsupportedDeviceVersion FeatureSupportStatus = "UnsupportedDeviceVersion" +) + +// HardwareComponentStatus enumerates the values for hardware component status. +type HardwareComponentStatus string + +const ( + // HardwareComponentStatusFailure specifies the hardware component status + // failure state for hardware component status. + HardwareComponentStatusFailure HardwareComponentStatus = "Failure" + // HardwareComponentStatusNotPresent specifies the hardware component + // status not present state for hardware component status. + HardwareComponentStatusNotPresent HardwareComponentStatus = "NotPresent" + // HardwareComponentStatusOk specifies the hardware component status ok + // state for hardware component status. + HardwareComponentStatusOk HardwareComponentStatus = "Ok" + // HardwareComponentStatusPoweredOff specifies the hardware component + // status powered off state for hardware component status. + HardwareComponentStatusPoweredOff HardwareComponentStatus = "PoweredOff" + // HardwareComponentStatusRecovering specifies the hardware component + // status recovering state for hardware component status. + HardwareComponentStatusRecovering HardwareComponentStatus = "Recovering" + // HardwareComponentStatusUnknown specifies the hardware component status + // unknown state for hardware component status. + HardwareComponentStatusUnknown HardwareComponentStatus = "Unknown" + // HardwareComponentStatusWarning specifies the hardware component status + // warning state for hardware component status. + HardwareComponentStatusWarning HardwareComponentStatus = "Warning" +) + +// InEligibilityCategory enumerates the values for in eligibility category. +type InEligibilityCategory string + +const ( + // DeviceNotOnline specifies the device not online state for in eligibility + // category. + DeviceNotOnline InEligibilityCategory = "DeviceNotOnline" + // NotSupportedAppliance specifies the not supported appliance state for in + // eligibility category. + NotSupportedAppliance InEligibilityCategory = "NotSupportedAppliance" + // RolloverPending specifies the rollover pending state for in eligibility + // category. + RolloverPending InEligibilityCategory = "RolloverPending" +) + +// ISCSIAndCloudStatus enumerates the values for iscsi and cloud status. +type ISCSIAndCloudStatus string + +const ( + // ISCSIAndCloudStatusCloudEnabled specifies the iscsi and cloud status + // cloud enabled state for iscsi and cloud status. + ISCSIAndCloudStatusCloudEnabled ISCSIAndCloudStatus = "CloudEnabled" + // ISCSIAndCloudStatusDisabled specifies the iscsi and cloud status + // disabled state for iscsi and cloud status. + ISCSIAndCloudStatusDisabled ISCSIAndCloudStatus = "Disabled" + // ISCSIAndCloudStatusIscsiAndCloudEnabled specifies the iscsi and cloud + // status iscsi and cloud enabled state for iscsi and cloud status. + ISCSIAndCloudStatusIscsiAndCloudEnabled ISCSIAndCloudStatus = "IscsiAndCloudEnabled" + // ISCSIAndCloudStatusIscsiEnabled specifies the iscsi and cloud status + // iscsi enabled state for iscsi and cloud status. + ISCSIAndCloudStatusIscsiEnabled ISCSIAndCloudStatus = "IscsiEnabled" +) + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // Canceled specifies the canceled state for job status. + Canceled JobStatus = "Canceled" + // Failed specifies the failed state for job status. + Failed JobStatus = "Failed" + // Running specifies the running state for job status. + Running JobStatus = "Running" + // Succeeded specifies the succeeded state for job status. + Succeeded JobStatus = "Succeeded" +) + +// JobType enumerates the values for job type. +type JobType string + +const ( + // CloneVolume specifies the clone volume state for job type. + CloneVolume JobType = "CloneVolume" + // CreateCloudAppliance specifies the create cloud appliance state for job + // type. + CreateCloudAppliance JobType = "CreateCloudAppliance" + // CreateLocallyPinnedVolume specifies the create locally pinned volume + // state for job type. + CreateLocallyPinnedVolume JobType = "CreateLocallyPinnedVolume" + // FailoverVolumeContainers specifies the failover volume containers state + // for job type. + FailoverVolumeContainers JobType = "FailoverVolumeContainers" + // InstallUpdates specifies the install updates state for job type. + InstallUpdates JobType = "InstallUpdates" + // ManualBackup specifies the manual backup state for job type. + ManualBackup JobType = "ManualBackup" + // ModifyVolume specifies the modify volume state for job type. + ModifyVolume JobType = "ModifyVolume" + // RestoreBackup specifies the restore backup state for job type. + RestoreBackup JobType = "RestoreBackup" + // ScheduledBackup specifies the scheduled backup state for job type. + ScheduledBackup JobType = "ScheduledBackup" + // SupportPackageLogs specifies the support package logs state for job + // type. + SupportPackageLogs JobType = "SupportPackageLogs" +) + +// KeyRolloverStatus enumerates the values for key rollover status. +type KeyRolloverStatus string + +const ( + // NotRequired specifies the not required state for key rollover status. + NotRequired KeyRolloverStatus = "NotRequired" + // Required specifies the required state for key rollover status. + Required KeyRolloverStatus = "Required" +) + +// Kind enumerates the values for kind. +type Kind string + +const ( + // Series8000 specifies the series 8000 state for kind. + Series8000 Kind = "Series8000" +) + +// ManagerType enumerates the values for manager type. +type ManagerType string + +const ( + // GardaV1 specifies the garda v1 state for manager type. + GardaV1 ManagerType = "GardaV1" + // HelsinkiV1 specifies the helsinki v1 state for manager type. + HelsinkiV1 ManagerType = "HelsinkiV1" +) + +// MetricAggregationType enumerates the values for metric aggregation type. +type MetricAggregationType string + +const ( + // MetricAggregationTypeAverage specifies the metric aggregation type + // average state for metric aggregation type. + MetricAggregationTypeAverage MetricAggregationType = "Average" + // MetricAggregationTypeLast specifies the metric aggregation type last + // state for metric aggregation type. + MetricAggregationTypeLast MetricAggregationType = "Last" + // MetricAggregationTypeMaximum specifies the metric aggregation type + // maximum state for metric aggregation type. + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + // MetricAggregationTypeMinimum specifies the metric aggregation type + // minimum state for metric aggregation type. + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + // MetricAggregationTypeNone specifies the metric aggregation type none + // state for metric aggregation type. + MetricAggregationTypeNone MetricAggregationType = "None" + // MetricAggregationTypeTotal specifies the metric aggregation type total + // state for metric aggregation type. + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // Bytes specifies the bytes state for metric unit. + Bytes MetricUnit = "Bytes" + // BytesPerSecond specifies the bytes per second state for metric unit. + BytesPerSecond MetricUnit = "BytesPerSecond" + // Count specifies the count state for metric unit. + Count MetricUnit = "Count" + // CountPerSecond specifies the count per second state for metric unit. + CountPerSecond MetricUnit = "CountPerSecond" + // Percent specifies the percent state for metric unit. + Percent MetricUnit = "Percent" + // Seconds specifies the seconds state for metric unit. + Seconds MetricUnit = "Seconds" +) + +// MonitoringStatus enumerates the values for monitoring status. +type MonitoringStatus string + +const ( + // MonitoringStatusDisabled specifies the monitoring status disabled state + // for monitoring status. + MonitoringStatusDisabled MonitoringStatus = "Disabled" + // MonitoringStatusEnabled specifies the monitoring status enabled state + // for monitoring status. + MonitoringStatusEnabled MonitoringStatus = "Enabled" +) + +// NetInterfaceID enumerates the values for net interface id. +type NetInterfaceID string + +const ( + // NetInterfaceIDData0 specifies the net interface id data 0 state for net + // interface id. + NetInterfaceIDData0 NetInterfaceID = "Data0" + // NetInterfaceIDData1 specifies the net interface id data 1 state for net + // interface id. + NetInterfaceIDData1 NetInterfaceID = "Data1" + // NetInterfaceIDData2 specifies the net interface id data 2 state for net + // interface id. + NetInterfaceIDData2 NetInterfaceID = "Data2" + // NetInterfaceIDData3 specifies the net interface id data 3 state for net + // interface id. + NetInterfaceIDData3 NetInterfaceID = "Data3" + // NetInterfaceIDData4 specifies the net interface id data 4 state for net + // interface id. + NetInterfaceIDData4 NetInterfaceID = "Data4" + // NetInterfaceIDData5 specifies the net interface id data 5 state for net + // interface id. + NetInterfaceIDData5 NetInterfaceID = "Data5" + // NetInterfaceIDInvalid specifies the net interface id invalid state for + // net interface id. + NetInterfaceIDInvalid NetInterfaceID = "Invalid" +) + +// NetInterfaceStatus enumerates the values for net interface status. +type NetInterfaceStatus string + +const ( + // NetInterfaceStatusDisabled specifies the net interface status disabled + // state for net interface status. + NetInterfaceStatusDisabled NetInterfaceStatus = "Disabled" + // NetInterfaceStatusEnabled specifies the net interface status enabled + // state for net interface status. + NetInterfaceStatusEnabled NetInterfaceStatus = "Enabled" +) + +// NetworkMode enumerates the values for network mode. +type NetworkMode string + +const ( + // NetworkModeBOTH specifies the network mode both state for network mode. + NetworkModeBOTH NetworkMode = "BOTH" + // NetworkModeInvalid specifies the network mode invalid state for network + // mode. + NetworkModeInvalid NetworkMode = "Invalid" + // NetworkModeIPV4 specifies the network mode ipv4 state for network mode. + NetworkModeIPV4 NetworkMode = "IPV4" + // NetworkModeIPV6 specifies the network mode ipv6 state for network mode. + NetworkModeIPV6 NetworkMode = "IPV6" +) + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusDeleting specifies the operation status deleting state + // for operation status. + OperationStatusDeleting OperationStatus = "Deleting" + // OperationStatusNone specifies the operation status none state for + // operation status. + OperationStatusNone OperationStatus = "None" + // OperationStatusRestoring specifies the operation status restoring state + // for operation status. + OperationStatusRestoring OperationStatus = "Restoring" + // OperationStatusUpdating specifies the operation status updating state + // for operation status. + OperationStatusUpdating OperationStatus = "Updating" +) + +// OwnerShipStatus enumerates the values for owner ship status. +type OwnerShipStatus string + +const ( + // NotOwned specifies the not owned state for owner ship status. + NotOwned OwnerShipStatus = "NotOwned" + // Owned specifies the owned state for owner ship status. + Owned OwnerShipStatus = "Owned" +) + +// RecurrenceType enumerates the values for recurrence type. +type RecurrenceType string + +const ( + // Daily specifies the daily state for recurrence type. + Daily RecurrenceType = "Daily" + // Hourly specifies the hourly state for recurrence type. + Hourly RecurrenceType = "Hourly" + // Minutes specifies the minutes state for recurrence type. + Minutes RecurrenceType = "Minutes" + // Weekly specifies the weekly state for recurrence type. + Weekly RecurrenceType = "Weekly" +) + +// RemoteManagementModeConfiguration enumerates the values for remote +// management mode configuration. +type RemoteManagementModeConfiguration string + +const ( + // RemoteManagementModeConfigurationDisabled specifies the remote + // management mode configuration disabled state for remote management mode + // configuration. + RemoteManagementModeConfigurationDisabled RemoteManagementModeConfiguration = "Disabled" + // RemoteManagementModeConfigurationHTTPSAndHTTPEnabled specifies the + // remote management mode configuration https and http enabled state for + // remote management mode configuration. + RemoteManagementModeConfigurationHTTPSAndHTTPEnabled RemoteManagementModeConfiguration = "HttpsAndHttpEnabled" + // RemoteManagementModeConfigurationHTTPSEnabled specifies the remote + // management mode configuration https enabled state for remote management + // mode configuration. + RemoteManagementModeConfigurationHTTPSEnabled RemoteManagementModeConfiguration = "HttpsEnabled" + // RemoteManagementModeConfigurationUnknown specifies the remote management + // mode configuration unknown state for remote management mode + // configuration. + RemoteManagementModeConfigurationUnknown RemoteManagementModeConfiguration = "Unknown" +) + +// ScheduledBackupStatus enumerates the values for scheduled backup status. +type ScheduledBackupStatus string + +const ( + // ScheduledBackupStatusDisabled specifies the scheduled backup status + // disabled state for scheduled backup status. + ScheduledBackupStatusDisabled ScheduledBackupStatus = "Disabled" + // ScheduledBackupStatusEnabled specifies the scheduled backup status + // enabled state for scheduled backup status. + ScheduledBackupStatusEnabled ScheduledBackupStatus = "Enabled" +) + +// ScheduleStatus enumerates the values for schedule status. +type ScheduleStatus string + +const ( + // ScheduleStatusDisabled specifies the schedule status disabled state for + // schedule status. + ScheduleStatusDisabled ScheduleStatus = "Disabled" + // ScheduleStatusEnabled specifies the schedule status enabled state for + // schedule status. + ScheduleStatusEnabled ScheduleStatus = "Enabled" +) + +// SslStatus enumerates the values for ssl status. +type SslStatus string + +const ( + // SslStatusDisabled specifies the ssl status disabled state for ssl + // status. + SslStatusDisabled SslStatus = "Disabled" + // SslStatusEnabled specifies the ssl status enabled state for ssl status. + SslStatusEnabled SslStatus = "Enabled" +) + +// TargetEligibilityResultCode enumerates the values for target eligibility +// result code. +type TargetEligibilityResultCode string + +const ( + // LocalToTieredVolumesConversionWarning specifies the local to tiered + // volumes conversion warning state for target eligibility result code. + LocalToTieredVolumesConversionWarning TargetEligibilityResultCode = "LocalToTieredVolumesConversionWarning" + // TargetAndSourceCannotBeSameError specifies the target and source cannot + // be same error state for target eligibility result code. + TargetAndSourceCannotBeSameError TargetEligibilityResultCode = "TargetAndSourceCannotBeSameError" + // TargetInsufficientCapacityError specifies the target insufficient + // capacity error state for target eligibility result code. + TargetInsufficientCapacityError TargetEligibilityResultCode = "TargetInsufficientCapacityError" + // TargetInsufficientLocalVolumeMemoryError specifies the target + // insufficient local volume memory error state for target eligibility + // result code. + TargetInsufficientLocalVolumeMemoryError TargetEligibilityResultCode = "TargetInsufficientLocalVolumeMemoryError" + // TargetInsufficientTieredVolumeMemoryError specifies the target + // insufficient tiered volume memory error state for target eligibility + // result code. + TargetInsufficientTieredVolumeMemoryError TargetEligibilityResultCode = "TargetInsufficientTieredVolumeMemoryError" + // TargetIsNotOnlineError specifies the target is not online error state + // for target eligibility result code. + TargetIsNotOnlineError TargetEligibilityResultCode = "TargetIsNotOnlineError" + // TargetSourceIncompatibleVersionError specifies the target source + // incompatible version error state for target eligibility result code. + TargetSourceIncompatibleVersionError TargetEligibilityResultCode = "TargetSourceIncompatibleVersionError" +) + +// TargetEligibilityStatus enumerates the values for target eligibility status. +type TargetEligibilityStatus string + +const ( + // TargetEligibilityStatusEligible specifies the target eligibility status + // eligible state for target eligibility status. + TargetEligibilityStatusEligible TargetEligibilityStatus = "Eligible" + // TargetEligibilityStatusNotEligible specifies the target eligibility + // status not eligible state for target eligibility status. + TargetEligibilityStatusNotEligible TargetEligibilityStatus = "NotEligible" +) + +// VirtualMachineAPIType enumerates the values for virtual machine api type. +type VirtualMachineAPIType string + +const ( + // Arm specifies the arm state for virtual machine api type. + Arm VirtualMachineAPIType = "Arm" + // Classic specifies the classic state for virtual machine api type. + Classic VirtualMachineAPIType = "Classic" +) + +// VolumeStatus enumerates the values for volume status. +type VolumeStatus string + +const ( + // VolumeStatusOffline specifies the volume status offline state for volume + // status. + VolumeStatusOffline VolumeStatus = "Offline" + // VolumeStatusOnline specifies the volume status online state for volume + // status. + VolumeStatusOnline VolumeStatus = "Online" +) + +// VolumeType enumerates the values for volume type. +type VolumeType string + +const ( + // Archival specifies the archival state for volume type. + Archival VolumeType = "Archival" + // LocallyPinned specifies the locally pinned state for volume type. + LocallyPinned VolumeType = "LocallyPinned" + // Tiered specifies the tiered state for volume type. + Tiered VolumeType = "Tiered" +) + +// AccessControlRecord is the access control record. +type AccessControlRecord struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *AccessControlRecordProperties `json:"properties,omitempty"` +} + +// AccessControlRecordList is the collection of access control records. +type AccessControlRecordList struct { + autorest.Response `json:"-"` + Value *[]AccessControlRecord `json:"value,omitempty"` +} + +// AccessControlRecordProperties is the properties of access control record. +type AccessControlRecordProperties struct { + InitiatorName *string `json:"initiatorName,omitempty"` + VolumeCount *int32 `json:"volumeCount,omitempty"` +} + +// AcsConfiguration is the ACS configuration. +type AcsConfiguration struct { + Namespace *string `json:"namespace,omitempty"` + Realm *string `json:"realm,omitempty"` + ServiceURL *string `json:"serviceUrl,omitempty"` +} + +// Alert is the alert. +type Alert struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *AlertProperties `json:"properties,omitempty"` +} + +// AlertErrorDetails is the details of the error for which the alert was raised +type AlertErrorDetails struct { + ErrorCode *string `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Occurences *int32 `json:"occurences,omitempty"` +} + +// AlertFilter is the OData filters to be used for Alert +type AlertFilter struct { + Status AlertStatus `json:"status,omitempty"` + Severity AlertSeverity `json:"severity,omitempty"` + SourceType AlertSourceType `json:"sourceType,omitempty"` + SourceName *string `json:"sourceName,omitempty"` + AppearedOnTime *date.Time `json:"appearedOnTime,omitempty"` +} + +// AlertList is the collection of alerts. +type AlertList struct { + autorest.Response `json:"-"` + Value *[]Alert `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AlertList) AlertListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AlertNotificationProperties is the properties of the alert notification +// settings. +type AlertNotificationProperties struct { + EmailNotification AlertEmailNotificationStatus `json:"emailNotification,omitempty"` + AlertNotificationCulture *string `json:"alertNotificationCulture,omitempty"` + NotificationToServiceOwners AlertEmailNotificationStatus `json:"notificationToServiceOwners,omitempty"` + AdditionalRecipientEmailList *[]string `json:"additionalRecipientEmailList,omitempty"` +} + +// AlertProperties is the properties of alert +type AlertProperties struct { + Title *string `json:"title,omitempty"` + Scope AlertScope `json:"scope,omitempty"` + AlertType *string `json:"alertType,omitempty"` + AppearedAtTime *date.Time `json:"appearedAtTime,omitempty"` + AppearedAtSourceTime *date.Time `json:"appearedAtSourceTime,omitempty"` + ClearedAtTime *date.Time `json:"clearedAtTime,omitempty"` + ClearedAtSourceTime *date.Time `json:"clearedAtSourceTime,omitempty"` + Source *AlertSource `json:"source,omitempty"` + Recommendation *string `json:"recommendation,omitempty"` + ResolutionReason *string `json:"resolutionReason,omitempty"` + Severity AlertSeverity `json:"severity,omitempty"` + Status AlertStatus `json:"status,omitempty"` + ErrorDetails *AlertErrorDetails `json:"errorDetails,omitempty"` + DetailedInformation *map[string]*string `json:"detailedInformation,omitempty"` +} + +// AlertSettings is the alert settings. +type AlertSettings struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *AlertNotificationProperties `json:"properties,omitempty"` +} + +// AlertSource is the source details at which the alert was raised +type AlertSource struct { + Name *string `json:"name,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + AlertSourceType AlertSourceType `json:"alertSourceType,omitempty"` +} + +// AsymmetricEncryptedSecret is represent the secrets intended for encryption +// with asymmetric key pair. +type AsymmetricEncryptedSecret struct { + Value *string `json:"value,omitempty"` + EncryptionCertThumbprint *string `json:"encryptionCertThumbprint,omitempty"` + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` +} + +// AvailableProviderOperation is represents available provider operation. +type AvailableProviderOperation struct { + Name *string `json:"name,omitempty"` + Display *AvailableProviderOperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// AvailableProviderOperationDisplay is contains the localized display +// information for this particular operation/action. These value will be used +// by several clients for (a) custom role definitions for RBAC, (b) complex +// query filters for the event service and (c) audit history/records for +// management operations. +type AvailableProviderOperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// AvailableProviderOperationList is list of available provider operations. +type AvailableProviderOperationList struct { + autorest.Response `json:"-"` + Value *[]AvailableProviderOperation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableProviderOperationListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AvailableProviderOperationList) AvailableProviderOperationListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Backup is the backup. +type Backup struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *BackupProperties `json:"properties,omitempty"` +} + +// BackupElement is the backup element. +type BackupElement struct { + ElementID *string `json:"elementId,omitempty"` + ElementName *string `json:"elementName,omitempty"` + ElementType *string `json:"elementType,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` + VolumeContainerID *string `json:"volumeContainerId,omitempty"` + VolumeType VolumeType `json:"volumeType,omitempty"` +} + +// BackupFilter is the OData filters to be used for backups. +type BackupFilter struct { + BackupPolicyID *string `json:"backupPolicyId,omitempty"` + VolumeID *string `json:"volumeId,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` +} + +// BackupList is the collection of backups. +type BackupList struct { + autorest.Response `json:"-"` + Value *[]Backup `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// BackupListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client BackupList) BackupListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// BackupPolicy is the backup policy. +type BackupPolicy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// BackupPolicyList is the collection of backup policies. +type BackupPolicyList struct { + autorest.Response `json:"-"` + Value *[]BackupPolicy `json:"value,omitempty"` +} + +// BackupPolicyProperties is the properties of the backup policy. +type BackupPolicyProperties struct { + VolumeIds *[]string `json:"volumeIds,omitempty"` + NextBackupTime *date.Time `json:"nextBackupTime,omitempty"` + LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` + SchedulesCount *int64 `json:"schedulesCount,omitempty"` + ScheduledBackupStatus ScheduledBackupStatus `json:"scheduledBackupStatus,omitempty"` + BackupPolicyCreationType BackupPolicyCreationType `json:"backupPolicyCreationType,omitempty"` + SsmHostName *string `json:"ssmHostName,omitempty"` +} + +// BackupProperties is the properties of the backup. +type BackupProperties struct { + CreatedOn *date.Time `json:"createdOn,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + BackupType BackupType `json:"backupType,omitempty"` + BackupJobCreationType BackupJobCreationType `json:"backupJobCreationType,omitempty"` + BackupPolicyID *string `json:"backupPolicyId,omitempty"` + SsmHostName *string `json:"ssmHostName,omitempty"` + Elements *[]BackupElement `json:"elements,omitempty"` +} + +// BackupSchedule is the backup schedule. +type BackupSchedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *BackupScheduleProperties `json:"properties,omitempty"` +} + +// BackupScheduleList is the backup schedule list. +type BackupScheduleList struct { + autorest.Response `json:"-"` + Value *[]BackupSchedule `json:"value,omitempty"` +} + +// BackupScheduleProperties is the properties of the backup schedule. +type BackupScheduleProperties struct { + ScheduleRecurrence *ScheduleRecurrence `json:"scheduleRecurrence,omitempty"` + BackupType BackupType `json:"backupType,omitempty"` + RetentionCount *int64 `json:"retentionCount,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + ScheduleStatus ScheduleStatus `json:"scheduleStatus,omitempty"` + LastSuccessfulRun *date.Time `json:"lastSuccessfulRun,omitempty"` +} + +// BandwidthRateSettingProperties is the properties of the bandwidth setting. +type BandwidthRateSettingProperties struct { + Schedules *[]BandwidthSchedule `json:"schedules,omitempty"` + VolumeCount *int32 `json:"volumeCount,omitempty"` +} + +// BandwidthSchedule is the schedule for bandwidth setting. +type BandwidthSchedule struct { + Start *Time `json:"start,omitempty"` + Stop *Time `json:"stop,omitempty"` + RateInMbps *int32 `json:"rateInMbps,omitempty"` + Days *[]DayOfWeek `json:"days,omitempty"` +} + +// BandwidthSetting is the bandwidth setting. +type BandwidthSetting struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *BandwidthRateSettingProperties `json:"properties,omitempty"` +} + +// BandwidthSettingList is the collection of bandwidth setting entities. +type BandwidthSettingList struct { + autorest.Response `json:"-"` + Value *[]BandwidthSetting `json:"value,omitempty"` +} + +// BaseModel is represents the base class for all other ARM object models +type BaseModel struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` +} + +// ChapSettings is the Challenge-Handshake Authentication Protocol (CHAP) +// settings. +type ChapSettings struct { + InitiatorUser *string `json:"initiatorUser,omitempty"` + InitiatorSecret *AsymmetricEncryptedSecret `json:"initiatorSecret,omitempty"` + TargetUser *string `json:"targetUser,omitempty"` + TargetSecret *AsymmetricEncryptedSecret `json:"targetSecret,omitempty"` +} + +// ClearAlertRequest is the request for clearing the alert +type ClearAlertRequest struct { + ResolutionMessage *string `json:"resolutionMessage,omitempty"` + Alerts *[]string `json:"alerts,omitempty"` +} + +// CloneRequest is the clone job request. +type CloneRequest struct { + TargetDeviceID *string `json:"targetDeviceId,omitempty"` + TargetVolumeName *string `json:"targetVolumeName,omitempty"` + TargetAccessControlRecordIds *[]string `json:"targetAccessControlRecordIds,omitempty"` + BackupElement *BackupElement `json:"backupElement,omitempty"` +} + +// CloudAppliance is the cloud appliance. +type CloudAppliance struct { + Name *string `json:"name,omitempty"` + VnetName *string `json:"vnetName,omitempty"` + VnetRegion *string `json:"vnetRegion,omitempty"` + IsVnetDNSConfigured *bool `json:"isVnetDnsConfigured,omitempty"` + IsVnetExpressConfigured *bool `json:"isVnetExpressConfigured,omitempty"` + SubnetName *string `json:"subnetName,omitempty"` + StorageAccountName *string `json:"storageAccountName,omitempty"` + StorageAccountType *string `json:"storageAccountType,omitempty"` + VMType *string `json:"vmType,omitempty"` + VMImageName *string `json:"vmImageName,omitempty"` + ModelNumber *string `json:"modelNumber,omitempty"` +} + +// CloudApplianceConfiguration is the cloud appliance configuration +type CloudApplianceConfiguration struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *CloudApplianceConfigurationProperties `json:"properties,omitempty"` +} + +// CloudApplianceConfigurationList is the cloud appliance configuration list +type CloudApplianceConfigurationList struct { + autorest.Response `json:"-"` + Value *[]CloudApplianceConfiguration `json:"value,omitempty"` +} + +// CloudApplianceConfigurationProperties is the properties of cloud appliance +// configuration. +type CloudApplianceConfigurationProperties struct { + ModelNumber *string `json:"modelNumber,omitempty"` + CloudPlatform *string `json:"cloudPlatform,omitempty"` + AcsConfiguration *AcsConfiguration `json:"acsConfiguration,omitempty"` + SupportedStorageAccountTypes *[]string `json:"supportedStorageAccountTypes,omitempty"` + SupportedRegions *[]string `json:"supportedRegions,omitempty"` + SupportedVMTypes *[]string `json:"supportedVmTypes,omitempty"` + SupportedVMImages *[]VMImage `json:"supportedVmImages,omitempty"` +} + +// CloudApplianceSettings is the cloud appliance settings. +type CloudApplianceSettings struct { + ServiceDataEncryptionKey *AsymmetricEncryptedSecret `json:"serviceDataEncryptionKey,omitempty"` + ChannelIntegrityKey *AsymmetricEncryptedSecret `json:"channelIntegrityKey,omitempty"` +} + +// ConfigureDeviceRequest is the mandatory device configuration request. +type ConfigureDeviceRequest struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *ConfigureDeviceRequestProperties `json:"properties,omitempty"` +} + +// ConfigureDeviceRequestProperties is the properties of the configure device +// request. +type ConfigureDeviceRequestProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + CurrentDeviceName *string `json:"currentDeviceName,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + DNSSettings *SecondaryDNSSettings `json:"dnsSettings,omitempty"` + NetworkInterfaceData0Settings *NetworkInterfaceData0Settings `json:"networkInterfaceData0Settings,omitempty"` +} + +// ControllerPowerStateChangeRequest is the controller power state change +// request. +type ControllerPowerStateChangeRequest struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *ControllerPowerStateChangeRequestProperties `json:"properties,omitempty"` +} + +// ControllerPowerStateChangeRequestProperties is the properties of the +// controller power state change request. +type ControllerPowerStateChangeRequestProperties struct { + Action ControllerPowerStateAction `json:"action,omitempty"` + ActiveController ControllerID `json:"activeController,omitempty"` + Controller0State ControllerStatus `json:"controller0State,omitempty"` + Controller1State ControllerStatus `json:"controller1State,omitempty"` +} + +// DataStatistics is the additional details related to the data related +// statistics of a job. Currently applicable only for Backup, Clone and Restore +// jobs. +type DataStatistics struct { + TotalData *int64 `json:"totalData,omitempty"` + ProcessedData *int64 `json:"processedData,omitempty"` + CloudData *int64 `json:"cloudData,omitempty"` + Throughput *int64 `json:"throughput,omitempty"` +} + +// Device is the StorSimple device. +type Device struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *DeviceProperties `json:"properties,omitempty"` +} + +// DeviceDetails is the additional device details regarding the end point count +// and volume container count. +type DeviceDetails struct { + EndpointCount *int32 `json:"endpointCount,omitempty"` + VolumeContainerCount *int32 `json:"volumeContainerCount,omitempty"` +} + +// DeviceList is the collection of devices. +type DeviceList struct { + autorest.Response `json:"-"` + Value *[]Device `json:"value,omitempty"` +} + +// DevicePatch is the device patch. +type DevicePatch struct { + *DevicePatchProperties `json:"properties,omitempty"` +} + +// DevicePatchProperties is the properties of the device patch. +type DevicePatchProperties struct { + DeviceDescription *string `json:"deviceDescription,omitempty"` +} + +// DeviceProperties is the properties of the StorSimple device. +type DeviceProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + ActivationTime *date.Time `json:"activationTime,omitempty"` + Culture *string `json:"culture,omitempty"` + DeviceDescription *string `json:"deviceDescription,omitempty"` + DeviceSoftwareVersion *string `json:"deviceSoftwareVersion,omitempty"` + FriendlySoftwareName *string `json:"friendlySoftwareName,omitempty"` + DeviceConfigurationStatus DeviceConfigurationStatus `json:"deviceConfigurationStatus,omitempty"` + TargetIqn *string `json:"targetIqn,omitempty"` + ModelDescription *string `json:"modelDescription,omitempty"` + Status DeviceStatus `json:"status,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + DeviceType DeviceType `json:"deviceType,omitempty"` + ActiveController ControllerID `json:"activeController,omitempty"` + FriendlySoftwareVersion *string `json:"friendlySoftwareVersion,omitempty"` + AvailableLocalStorageInBytes *int64 `json:"availableLocalStorageInBytes,omitempty"` + AvailableTieredStorageInBytes *int64 `json:"availableTieredStorageInBytes,omitempty"` + ProvisionedTieredStorageInBytes *int64 `json:"provisionedTieredStorageInBytes,omitempty"` + ProvisionedLocalStorageInBytes *int64 `json:"provisionedLocalStorageInBytes,omitempty"` + ProvisionedVolumeSizeInBytes *int64 `json:"provisionedVolumeSizeInBytes,omitempty"` + UsingStorageInBytes *int64 `json:"usingStorageInBytes,omitempty"` + TotalTieredStorageInBytes *int64 `json:"totalTieredStorageInBytes,omitempty"` + AgentGroupVersion *int32 `json:"agentGroupVersion,omitempty"` + NetworkInterfaceCardCount *int32 `json:"networkInterfaceCardCount,omitempty"` + DeviceLocation *string `json:"deviceLocation,omitempty"` + VirtualMachineAPIType VirtualMachineAPIType `json:"virtualMachineApiType,omitempty"` + Details *DeviceDetails `json:"details,omitempty"` + RolloverDetails *DeviceRolloverDetails `json:"rolloverDetails,omitempty"` +} + +// DeviceRolloverDetails is the additional device details for the service data +// encryption key rollover. +type DeviceRolloverDetails struct { + AuthorizationEligibility AuthorizationEligibility `json:"authorizationEligibility,omitempty"` + AuthorizationStatus AuthorizationStatus `json:"authorizationStatus,omitempty"` + InEligibilityReason InEligibilityCategory `json:"inEligibilityReason,omitempty"` +} + +// DimensionFilter is the dimension filter. +type DimensionFilter struct { + Name *string `json:"name,omitempty"` + Values *string `json:"values,omitempty"` +} + +// DNSSettings is the DNS(Domain Name Server) settings of a device. +type DNSSettings struct { + PrimaryDNSServer *string `json:"primaryDnsServer,omitempty"` + PrimaryIpv6DNSServer *string `json:"primaryIpv6DnsServer,omitempty"` + SecondaryDNSServers *[]string `json:"secondaryDnsServers,omitempty"` + SecondaryIpv6DNSServers *[]string `json:"secondaryIpv6DnsServers,omitempty"` +} + +// EncryptionSettings is the encryption settings. +type EncryptionSettings struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *EncryptionSettingsProperties `json:"properties,omitempty"` +} + +// EncryptionSettingsProperties is the properties of encryption settings. +type EncryptionSettingsProperties struct { + EncryptionStatus EncryptionStatus `json:"encryptionStatus,omitempty"` + KeyRolloverStatus KeyRolloverStatus `json:"keyRolloverStatus,omitempty"` +} + +// FailoverRequest is the request object for triggering a failover of volume +// containers, from a source device to a target device. +type FailoverRequest struct { + TargetDeviceID *string `json:"targetDeviceId,omitempty"` + VolumeContainers *[]string `json:"volumeContainers,omitempty"` +} + +// FailoverSet is the failover set on a device. +type FailoverSet struct { + VolumeContainers *[]VolumeContainerFailoverMetadata `json:"volumeContainers,omitempty"` + EligibilityResult *FailoverSetEligibilityResult `json:"eligibilityResult,omitempty"` +} + +// FailoverSetEligibilityResult is the eligibility result of failover set, for +// failover. +type FailoverSetEligibilityResult struct { + IsEligibleForFailover *bool `json:"isEligibleForFailover,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// FailoverSetsList is the list of failover sets. +type FailoverSetsList struct { + autorest.Response `json:"-"` + Value *[]FailoverSet `json:"value,omitempty"` +} + +// FailoverTarget is represents the eligibility of a device as a failover +// target device. +type FailoverTarget struct { + DeviceID *string `json:"deviceId,omitempty"` + DeviceStatus DeviceStatus `json:"deviceStatus,omitempty"` + ModelDescription *string `json:"modelDescription,omitempty"` + DeviceSoftwareVersion *string `json:"deviceSoftwareVersion,omitempty"` + DataContainersCount *int32 `json:"dataContainersCount,omitempty"` + VolumesCount *int32 `json:"volumesCount,omitempty"` + AvailableLocalStorageInBytes *int64 `json:"availableLocalStorageInBytes,omitempty"` + AvailableTieredStorageInBytes *int64 `json:"availableTieredStorageInBytes,omitempty"` + DeviceLocation *string `json:"deviceLocation,omitempty"` + FriendlyDeviceSoftwareVersion *string `json:"friendlyDeviceSoftwareVersion,omitempty"` + EligibilityResult *TargetEligibilityResult `json:"eligibilityResult,omitempty"` +} + +// FailoverTargetsList is the list of all devices in a resource and their +// eligibility status as a failover target device. +type FailoverTargetsList struct { + autorest.Response `json:"-"` + Value *[]FailoverTarget `json:"value,omitempty"` +} + +// Feature is the feature. +type Feature struct { + Name *string `json:"name,omitempty"` + Status FeatureSupportStatus `json:"status,omitempty"` +} + +// FeatureFilter is the OData filter to be used for features. +type FeatureFilter struct { + DeviceID *string `json:"deviceId,omitempty"` +} + +// FeatureList is the collections of features. +type FeatureList struct { + autorest.Response `json:"-"` + Value *[]Feature `json:"value,omitempty"` +} + +// HardwareComponent is the hardware component. +type HardwareComponent struct { + ComponentID *string `json:"componentId,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Status HardwareComponentStatus `json:"status,omitempty"` + StatusDisplayName *string `json:"statusDisplayName,omitempty"` +} + +// HardwareComponentGroup is the hardware component group. +type HardwareComponentGroup struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *HardwareComponentGroupProperties `json:"properties,omitempty"` +} + +// HardwareComponentGroupList is the collection of hardware component groups. +type HardwareComponentGroupList struct { + autorest.Response `json:"-"` + Value *[]HardwareComponentGroup `json:"value,omitempty"` +} + +// HardwareComponentGroupProperties is the properties of hardware component +// group. +type HardwareComponentGroupProperties struct { + DisplayName *string `json:"displayName,omitempty"` + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + Components *[]HardwareComponent `json:"components,omitempty"` +} + +// Job is the job. +type Job struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + Status JobStatus `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + Error *JobErrorDetails `json:"error,omitempty"` + *JobProperties `json:"properties,omitempty"` +} + +// JobErrorDetails is the job error details. Contains list of job error items. +type JobErrorDetails struct { + ErrorDetails *[]JobErrorItem `json:"errorDetails,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// JobErrorItem is the job error items. +type JobErrorItem struct { + Recommendations *[]string `json:"recommendations,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// JobFilter is the OData filter to be used for jobs. +type JobFilter struct { + Status *string `json:"status,omitempty"` + JobType *string `json:"jobType,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` +} + +// JobList is the collection of jobs. +type JobList struct { + autorest.Response `json:"-"` + Value *[]Job `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobList) JobListPreparer() (*http.Request, error) { + if client.NextLink == nil || 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 the properties of the job. +type JobProperties struct { + JobType JobType `json:"jobType,omitempty"` + DataStats *DataStatistics `json:"dataStats,omitempty"` + EntityLabel *string `json:"entityLabel,omitempty"` + EntityType *string `json:"entityType,omitempty"` + JobStages *[]JobStage `json:"jobStages,omitempty"` + DeviceID *string `json:"deviceId,omitempty"` + IsCancellable *bool `json:"isCancellable,omitempty"` + BackupType BackupType `json:"backupType,omitempty"` + SourceDeviceID *string `json:"sourceDeviceId,omitempty"` + BackupPointInTime *date.Time `json:"backupPointInTime,omitempty"` +} + +// JobStage is the details about the specific stage of a job. +type JobStage struct { + Message *string `json:"message,omitempty"` + StageStatus JobStatus `json:"stageStatus,omitempty"` + Detail *string `json:"detail,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` +} + +// Key is the key. +type Key struct { + autorest.Response `json:"-"` + ActivationKey *string `json:"activationKey,omitempty"` +} + +// ListFailoverTargetsRequest is the request object for fetching the list of +// failover targets (eligible devices for failover). +type ListFailoverTargetsRequest struct { + VolumeContainers *[]string `json:"volumeContainers,omitempty"` +} + +// Manager is the StorSimple Manager. +type Manager 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"` + *ManagerProperties `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ManagerExtendedInfo is the extended info of the manager. +type ManagerExtendedInfo struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *ManagerExtendedInfoProperties `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ManagerExtendedInfoProperties is the properties of the manager extended +// info. +type ManagerExtendedInfoProperties struct { + Version *string `json:"version,omitempty"` + IntegrityKey *string `json:"integrityKey,omitempty"` + EncryptionKey *string `json:"encryptionKey,omitempty"` + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + PortalCertificateThumbprint *string `json:"portalCertificateThumbprint,omitempty"` + Algorithm *string `json:"algorithm,omitempty"` +} + +// ManagerIntrinsicSettings is intrinsic settings which refers to the type of +// the Storsimple Manager. +type ManagerIntrinsicSettings struct { + Type ManagerType `json:"type,omitempty"` +} + +// ManagerList is the list of StorSimple Managers. +type ManagerList struct { + autorest.Response `json:"-"` + Value *[]Manager `json:"value,omitempty"` +} + +// ManagerPatch is the StorSimple Manager patch. +type ManagerPatch struct { + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ManagerProperties is the properties of the StorSimple Manager. +type ManagerProperties struct { + CisIntrinsicSettings *ManagerIntrinsicSettings `json:"cisIntrinsicSettings,omitempty"` + Sku *ManagerSku `json:"sku,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ManagerSku is the Sku. +type ManagerSku struct { + Name *string `json:"name,omitempty"` +} + +// MetricAvailablity is the metric availability. +type MetricAvailablity struct { + TimeGrain *string `json:"timeGrain,omitempty"` + Retention *string `json:"retention,omitempty"` +} + +// MetricData is the metric data. +type MetricData struct { + TimeStamp *date.Time `json:"timeStamp,omitempty"` + Sum *float64 `json:"sum,omitempty"` + Count *int32 `json:"count,omitempty"` + Average *float64 `json:"average,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` +} + +// MetricDefinition is the monitoring metric definition. +type MetricDefinition struct { + Name *MetricName `json:"name,omitempty"` + Unit MetricUnit `json:"unit,omitempty"` + PrimaryAggregationType MetricAggregationType `json:"primaryAggregationType,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + MetricAvailabilities *[]MetricAvailablity `json:"metricAvailabilities,omitempty"` + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + Category *string `json:"category,omitempty"` + Type *string `json:"type,omitempty"` +} + +// MetricDefinitionList is the list of metric definitions. +type MetricDefinitionList struct { + autorest.Response `json:"-"` + Value *[]MetricDefinition `json:"value,omitempty"` +} + +// MetricDimension is the metric dimension. It indicates the source of the +// metric. +type MetricDimension struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// MetricFilter is the OData filters to be used for metrics. +type MetricFilter struct { + Name *MetricNameFilter `json:"name,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + Category *string `json:"category,omitempty"` + Dimensions *DimensionFilter `json:"dimensions,omitempty"` +} + +// MetricList is the metric list. +type MetricList struct { + autorest.Response `json:"-"` + Value *[]Metrics `json:"value,omitempty"` +} + +// MetricName is the metric name. +type MetricName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MetricNameFilter is the metric name filter, specifying the name of the +// metric to be filtered on. +type MetricNameFilter struct { + Value *string `json:"value,omitempty"` +} + +// Metrics is the monitoring metric. +type Metrics struct { + ResourceID *string `json:"resourceId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + PrimaryAggregation MetricAggregationType `json:"primaryAggregation,omitempty"` + Name *MetricName `json:"name,omitempty"` + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + Unit MetricUnit `json:"unit,omitempty"` + Type *string `json:"type,omitempty"` + Values *[]MetricData `json:"values,omitempty"` +} + +// NetworkAdapterList is the collection of network adapters on the device. +type NetworkAdapterList struct { + Value *[]NetworkAdapters `json:"value,omitempty"` +} + +// NetworkAdapters is represents the network adapter on device. +type NetworkAdapters struct { + InterfaceID NetInterfaceID `json:"interfaceId,omitempty"` + NetInterfaceStatus NetInterfaceStatus `json:"netInterfaceStatus,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + IscsiAndCloudStatus ISCSIAndCloudStatus `json:"iscsiAndCloudStatus,omitempty"` + Speed *int64 `json:"speed,omitempty"` + Mode NetworkMode `json:"mode,omitempty"` + NicIpv4Settings *NicIPv4 `json:"nicIpv4Settings,omitempty"` + NicIpv6Settings *NicIPv6 `json:"nicIpv6Settings,omitempty"` +} + +// NetworkInterfaceData0Settings is the 'Data 0' network interface card +// settings. +type NetworkInterfaceData0Settings struct { + ControllerZeroIP *string `json:"controllerZeroIp,omitempty"` + ControllerOneIP *string `json:"controllerOneIp,omitempty"` +} + +// NetworkSettings is represents the network settings of a device. +type NetworkSettings struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *NetworkSettingsProperties `json:"properties,omitempty"` +} + +// NetworkSettingsPatch is represents the patch request for the network +// settings of a device. +type NetworkSettingsPatch struct { + *NetworkSettingsPatchProperties `json:"properties,omitempty"` +} + +// NetworkSettingsPatchProperties is the properties of the network settings +// patch. +type NetworkSettingsPatchProperties struct { + DNSSettings *DNSSettings `json:"dnsSettings,omitempty"` + NetworkAdapters *NetworkAdapterList `json:"networkAdapters,omitempty"` +} + +// NetworkSettingsProperties is the properties of the network settings of +// device. +type NetworkSettingsProperties struct { + DNSSettings *DNSSettings `json:"dnsSettings,omitempty"` + NetworkAdapters *NetworkAdapterList `json:"networkAdapters,omitempty"` + WebproxySettings *WebproxySettings `json:"webproxySettings,omitempty"` +} + +// NicIPv4 is details related to the IPv4 address configuration. +type NicIPv4 struct { + Ipv4Address *string `json:"ipv4Address,omitempty"` + Ipv4Netmask *string `json:"ipv4Netmask,omitempty"` + Ipv4Gateway *string `json:"ipv4Gateway,omitempty"` + Controller0Ipv4Address *string `json:"controller0Ipv4Address,omitempty"` + Controller1Ipv4Address *string `json:"controller1Ipv4Address,omitempty"` +} + +// NicIPv6 is details related to the IPv6 address configuration. +type NicIPv6 struct { + Ipv6Address *string `json:"ipv6Address,omitempty"` + Ipv6Prefix *string `json:"ipv6Prefix,omitempty"` + Ipv6Gateway *string `json:"ipv6Gateway,omitempty"` + Controller0Ipv6Address *string `json:"controller0Ipv6Address,omitempty"` + Controller1Ipv6Address *string `json:"controller1Ipv6Address,omitempty"` +} + +// PublicKey is the public key. +type PublicKey struct { + autorest.Response `json:"-"` + Key *string `json:"key,omitempty"` +} + +// RemoteManagementSettings is the settings for remote management of a device. +type RemoteManagementSettings struct { + RemoteManagementMode RemoteManagementModeConfiguration `json:"remoteManagementMode,omitempty"` + RemoteManagementCertificate *string `json:"remoteManagementCertificate,omitempty"` +} + +// RemoteManagementSettingsPatch is the settings for updating remote management +// mode of the device. +type RemoteManagementSettingsPatch struct { + RemoteManagementMode RemoteManagementModeConfiguration `json:"remoteManagementMode,omitempty"` +} + +// Resource is the 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"` +} + +// ScheduleRecurrence is the schedule recurrence. +type ScheduleRecurrence struct { + RecurrenceType RecurrenceType `json:"recurrenceType,omitempty"` + RecurrenceValue *int32 `json:"recurrenceValue,omitempty"` + WeeklyDaysList *[]DayOfWeek `json:"weeklyDaysList,omitempty"` +} + +// SecondaryDNSSettings is the secondary DNS settings. +type SecondaryDNSSettings struct { + SecondaryDNSServers *[]string `json:"secondaryDnsServers,omitempty"` +} + +// SecuritySettings is the security settings of a device. +type SecuritySettings struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *SecuritySettingsProperties `json:"properties,omitempty"` +} + +// SecuritySettingsPatch is represents the patch request for the security +// settings of a device. +type SecuritySettingsPatch struct { + *SecuritySettingsPatchProperties `json:"properties,omitempty"` +} + +// SecuritySettingsPatchProperties is the properties of the security settings +// patch. +type SecuritySettingsPatchProperties struct { + RemoteManagementSettings *RemoteManagementSettingsPatch `json:"remoteManagementSettings,omitempty"` + DeviceAdminPassword *AsymmetricEncryptedSecret `json:"deviceAdminPassword,omitempty"` + SnapshotPassword *AsymmetricEncryptedSecret `json:"snapshotPassword,omitempty"` + ChapSettings *ChapSettings `json:"chapSettings,omitempty"` + CloudApplianceSettings *CloudApplianceSettings `json:"cloudApplianceSettings,omitempty"` +} + +// SecuritySettingsProperties is the properties of security settings of a +// device. +type SecuritySettingsProperties struct { + RemoteManagementSettings *RemoteManagementSettings `json:"remoteManagementSettings,omitempty"` + ChapSettings *ChapSettings `json:"chapSettings,omitempty"` +} + +// SendTestAlertEmailRequest is the request for sending test alert email +type SendTestAlertEmailRequest struct { + EmailList *[]string `json:"emailList,omitempty"` +} + +// StorageAccountCredential is the storage account credential. +type StorageAccountCredential struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *StorageAccountCredentialProperties `json:"properties,omitempty"` +} + +// StorageAccountCredentialList is the collection of storage account credential +// entities. +type StorageAccountCredentialList struct { + autorest.Response `json:"-"` + Value *[]StorageAccountCredential `json:"value,omitempty"` +} + +// StorageAccountCredentialProperties is the storage account credential +// properties. +type StorageAccountCredentialProperties struct { + EndPoint *string `json:"endPoint,omitempty"` + SslStatus SslStatus `json:"sslStatus,omitempty"` + AccessKey *AsymmetricEncryptedSecret `json:"accessKey,omitempty"` + VolumesCount *int32 `json:"volumesCount,omitempty"` +} + +// SymmetricEncryptedSecret is represents the secrets encrypted using Symmetric +// Encryption Key. +type SymmetricEncryptedSecret struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` + ValueCertificateThumbprint *string `json:"valueCertificateThumbprint,omitempty"` + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` +} + +// TargetEligibilityErrorMessage is the error/warning message due to which the +// device is ineligible as a failover target device. +type TargetEligibilityErrorMessage struct { + Message *string `json:"message,omitempty"` + Resolution *string `json:"resolution,omitempty"` + ResultCode TargetEligibilityResultCode `json:"resultCode,omitempty"` +} + +// TargetEligibilityResult is the eligibility result of device, as a failover +// target device. +type TargetEligibilityResult struct { + EligibilityStatus TargetEligibilityStatus `json:"eligibilityStatus,omitempty"` + Messages *[]TargetEligibilityErrorMessage `json:"messages,omitempty"` +} + +// Time is the time. +type Time struct { + Hours *int32 `json:"hours,omitempty"` + Minutes *int32 `json:"minutes,omitempty"` + Seconds *int32 `json:"seconds,omitempty"` +} + +// TimeSettings is the time settings of a device. +type TimeSettings struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *TimeSettingsProperties `json:"properties,omitempty"` +} + +// TimeSettingsProperties is the properties of time settings of a device. +type TimeSettingsProperties struct { + TimeZone *string `json:"timeZone,omitempty"` + PrimaryTimeServer *string `json:"primaryTimeServer,omitempty"` + SecondaryTimeServer *[]string `json:"secondaryTimeServer,omitempty"` +} + +// Updates is the updates profile of a device. +type Updates struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *UpdatesProperties `json:"properties,omitempty"` +} + +// UpdatesProperties is the properties of the updates profile. +type UpdatesProperties struct { + RegularUpdatesAvailable *bool `json:"regularUpdatesAvailable,omitempty"` + MaintenanceModeUpdatesAvailable *bool `json:"maintenanceModeUpdatesAvailable,omitempty"` + IsUpdateInProgress *bool `json:"isUpdateInProgress,omitempty"` + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` +} + +// VMImage is the virtual machine image. +type VMImage struct { + Name *string `json:"name,omitempty"` + Version *string `json:"version,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` +} + +// Volume is the volume. +type Volume struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *VolumeProperties `json:"properties,omitempty"` +} + +// VolumeContainer is the volume container. +type VolumeContainer struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Kind Kind `json:"kind,omitempty"` + *VolumeContainerProperties `json:"properties,omitempty"` +} + +// VolumeContainerFailoverMetadata is the metadata of the volume container, +// that is being considered as part of a failover set. +type VolumeContainerFailoverMetadata struct { + VolumeContainerID *string `json:"volumeContainerId,omitempty"` + Volumes *[]VolumeFailoverMetadata `json:"volumes,omitempty"` +} + +// VolumeContainerList is the collection of volume container entities. +type VolumeContainerList struct { + autorest.Response `json:"-"` + Value *[]VolumeContainer `json:"value,omitempty"` +} + +// VolumeContainerProperties is the properties of volume container. +type VolumeContainerProperties struct { + EncryptionKey *AsymmetricEncryptedSecret `json:"encryptionKey,omitempty"` + EncryptionStatus EncryptionStatus `json:"encryptionStatus,omitempty"` + VolumeCount *int32 `json:"volumeCount,omitempty"` + StorageAccountCredentialID *string `json:"storageAccountCredentialId,omitempty"` + OwnerShipStatus OwnerShipStatus `json:"ownerShipStatus,omitempty"` + BandWidthRateInMbps *int32 `json:"bandWidthRateInMbps,omitempty"` + BandwidthSettingID *string `json:"bandwidthSettingId,omitempty"` + TotalCloudStorageUsageInBytes *int64 `json:"totalCloudStorageUsageInBytes,omitempty"` +} + +// VolumeFailoverMetadata is the metadata of a volume that has valid cloud +// snapshot. +type VolumeFailoverMetadata struct { + VolumeID *string `json:"volumeId,omitempty"` + VolumeType VolumeType `json:"volumeType,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + BackupCreatedDate *date.Time `json:"backupCreatedDate,omitempty"` + BackupElementID *string `json:"backupElementId,omitempty"` + BackupID *string `json:"backupId,omitempty"` + BackupPolicyID *string `json:"backupPolicyId,omitempty"` +} + +// VolumeList is the collection of volumes. +type VolumeList struct { + autorest.Response `json:"-"` + Value *[]Volume `json:"value,omitempty"` +} + +// VolumeProperties is the properties of volume. +type VolumeProperties struct { + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + VolumeType VolumeType `json:"volumeType,omitempty"` + VolumeContainerID *string `json:"volumeContainerId,omitempty"` + AccessControlRecordIds *[]string `json:"accessControlRecordIds,omitempty"` + VolumeStatus VolumeStatus `json:"volumeStatus,omitempty"` + OperationStatus OperationStatus `json:"operationStatus,omitempty"` + BackupStatus BackupStatus `json:"backupStatus,omitempty"` + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + BackupPolicyIds *[]string `json:"backupPolicyIds,omitempty"` +} + +// WebproxySettings is the web proxy settings on the device. +type WebproxySettings struct { + ConnectionURI *string `json:"connectionUri,omitempty"` + Authentication AuthenticationType `json:"authentication,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/operations.go new file mode 100644 index 000000000..0fa27df73 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/operations.go @@ -0,0 +1,169 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 +// Storsimple8000series 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.Storsimple provider +func (client OperationsClient) List() (result AvailableProviderOperationList, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.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, "storsimple8000series.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.StorSimple/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 AvailableProviderOperationList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.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 AvailableProviderOperationList) (result AvailableProviderOperationList, err error) { + req, err := lastResults.AvailableProviderOperationListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storsimple8000series.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, "storsimple8000series.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan AvailableProviderOperation, <-chan error) { + resultChan := make(chan AvailableProviderOperation) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/storageaccountcredentials.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/storageaccountcredentials.go new file mode 100644 index 000000000..97f50a486 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/storageaccountcredentials.go @@ -0,0 +1,389 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// StorageAccountCredentialsClient is the client for the +// StorageAccountCredentials methods of the Storsimple8000series service. +type StorageAccountCredentialsClient struct { + ManagementClient +} + +// NewStorageAccountCredentialsClient creates an instance of the +// StorageAccountCredentialsClient client. +func NewStorageAccountCredentialsClient(subscriptionID string) StorageAccountCredentialsClient { + return NewStorageAccountCredentialsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStorageAccountCredentialsClientWithBaseURI creates an instance of the +// StorageAccountCredentialsClient client. +func NewStorageAccountCredentialsClientWithBaseURI(baseURI string, subscriptionID string) StorageAccountCredentialsClient { + return StorageAccountCredentialsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the storage account credential. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// storageAccountCredentialName is the storage account credential name. +// parameters is the storage account credential to be added or updated. +// resourceGroupName is the resource group name managerName is the manager name +func (client StorageAccountCredentialsClient) CreateOrUpdate(storageAccountCredentialName string, parameters StorageAccountCredential, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan StorageAccountCredential, <-chan error) { + resultChan := make(chan StorageAccountCredential, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageAccountCredentialProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.StorageAccountCredentialProperties.EndPoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StorageAccountCredentialProperties.AccessKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.StorageAccountCredentialProperties.AccessKey.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result StorageAccountCredential + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(storageAccountCredentialName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client StorageAccountCredentialsClient) CreateOrUpdatePreparer(storageAccountCredentialName string, parameters StorageAccountCredential, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "storageAccountCredentialName": storageAccountCredentialName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/storageAccountCredentials/{storageAccountCredentialName}", 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 StorageAccountCredentialsClient) 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 StorageAccountCredentialsClient) CreateOrUpdateResponder(resp *http.Response) (result StorageAccountCredential, 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 storage account credential. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// storageAccountCredentialName is the name of the storage account credential. +// resourceGroupName is the resource group name managerName is the manager name +func (client StorageAccountCredentialsClient) Delete(storageAccountCredentialName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(storageAccountCredentialName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client StorageAccountCredentialsClient) DeletePreparer(storageAccountCredentialName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "storageAccountCredentialName": storageAccountCredentialName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/storageAccountCredentials/{storageAccountCredentialName}", 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 StorageAccountCredentialsClient) 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 StorageAccountCredentialsClient) 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 storage account credential name. +// +// storageAccountCredentialName is the name of storage account credential to be +// fetched. resourceGroupName is the resource group name managerName is the +// manager name +func (client StorageAccountCredentialsClient) Get(storageAccountCredentialName string, resourceGroupName string, managerName string) (result StorageAccountCredential, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "Get") + } + + req, err := client.GetPreparer(storageAccountCredentialName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client StorageAccountCredentialsClient) GetPreparer(storageAccountCredentialName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "storageAccountCredentialName": storageAccountCredentialName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/storageAccountCredentials/{storageAccountCredentialName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountCredentialsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client StorageAccountCredentialsClient) GetResponder(resp *http.Response) (result StorageAccountCredential, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManager gets all the storage account credentials in a manager. +// +// resourceGroupName is the resource group name managerName is the manager name +func (client StorageAccountCredentialsClient) ListByManager(resourceGroupName string, managerName string) (result StorageAccountCredentialList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager") + } + + req, err := client.ListByManagerPreparer(resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager", resp, "Failure sending request") + return + } + + result, err = client.ListByManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager", resp, "Failure responding to request") + } + + return +} + +// ListByManagerPreparer prepares the ListByManager request. +func (client StorageAccountCredentialsClient) ListByManagerPreparer(resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/storageAccountCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByManagerSender sends the ListByManager request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountCredentialsClient) ListByManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByManagerResponder handles the response to the ListByManager request. The method always +// closes the http.Response Body. +func (client StorageAccountCredentialsClient) ListByManagerResponder(resp *http.Response) (result StorageAccountCredentialList, 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/storsimple8000series/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/version.go new file mode 100644 index 000000000..653c39873 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/version.go @@ -0,0 +1,28 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-storsimple8000series/2017-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumecontainers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumecontainers.go new file mode 100644 index 000000000..6a5fee0ce --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumecontainers.go @@ -0,0 +1,548 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VolumeContainersClient is the client for the VolumeContainers methods of the +// Storsimple8000series service. +type VolumeContainersClient struct { + ManagementClient +} + +// NewVolumeContainersClient creates an instance of the VolumeContainersClient +// client. +func NewVolumeContainersClient(subscriptionID string) VolumeContainersClient { + return NewVolumeContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVolumeContainersClientWithBaseURI creates an instance of the +// VolumeContainersClient client. +func NewVolumeContainersClientWithBaseURI(baseURI string, subscriptionID string) VolumeContainersClient { + return VolumeContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the volume 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. +// +// deviceName is the device name volumeContainerName is the name of the volume +// container. parameters is the volume container to be added or updated. +// resourceGroupName is the resource group name managerName is the manager name +func (client VolumeContainersClient) CreateOrUpdate(deviceName string, volumeContainerName string, parameters VolumeContainer, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan VolumeContainer, <-chan error) { + resultChan := make(chan VolumeContainer, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VolumeContainerProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VolumeContainerProperties.EncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VolumeContainerProperties.EncryptionKey.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.VolumeContainerProperties.StorageAccountCredentialID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result VolumeContainer + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(deviceName, volumeContainerName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VolumeContainersClient) CreateOrUpdatePreparer(deviceName string, volumeContainerName string, parameters VolumeContainer, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}", 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 VolumeContainersClient) 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 VolumeContainersClient) CreateOrUpdateResponder(resp *http.Response) (result VolumeContainer, 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 volume 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. +// +// deviceName is the device name volumeContainerName is the name of the volume +// container. resourceGroupName is the resource group name managerName is the +// manager name +func (client VolumeContainersClient) Delete(deviceName string, volumeContainerName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(deviceName, volumeContainerName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VolumeContainersClient) DeletePreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}", 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 VolumeContainersClient) 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 VolumeContainersClient) 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 volume container name. +// +// deviceName is the device name volumeContainerName is the name of the volume +// container. resourceGroupName is the resource group name managerName is the +// manager name +func (client VolumeContainersClient) Get(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (result VolumeContainer, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "Get") + } + + req, err := client.GetPreparer(deviceName, volumeContainerName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VolumeContainersClient) GetPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VolumeContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VolumeContainersClient) GetResponder(resp *http.Response) (result VolumeContainer, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDevice gets all the volume containers in a device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client VolumeContainersClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result VolumeContainerList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice") + } + + req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice", resp, "Failure sending request") + return + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice", resp, "Failure responding to request") + } + + return +} + +// ListByDevicePreparer prepares the ListByDevice request. +func (client VolumeContainersClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDeviceSender sends the ListByDevice request. The method will close the +// http.Response Body if it receives an error. +func (client VolumeContainersClient) ListByDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDeviceResponder handles the response to the ListByDevice request. The method always +// closes the http.Response Body. +func (client VolumeContainersClient) ListByDeviceResponder(resp *http.Response) (result VolumeContainerList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinition gets the metric definitions for the specified volume +// container. +// +// deviceName is the device name volumeContainerName is the volume container +// name. resourceGroupName is the resource group name managerName is the +// manager name +func (client VolumeContainersClient) ListMetricDefinition(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition") + } + + req, err := client.ListMetricDefinitionPreparer(deviceName, volumeContainerName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionPreparer prepares the ListMetricDefinition request. +func (client VolumeContainersClient) ListMetricDefinitionPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/metricsDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client VolumeContainersClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always +// closes the http.Response Body. +func (client VolumeContainersClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, 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 gets the metrics for the specified volume container. +// +// deviceName is the device name volumeContainerName is the volume container +// name. resourceGroupName is the resource group name managerName is the +// manager name filter is oData Filter options +func (client VolumeContainersClient) ListMetrics(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, filter string) (result MetricList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(deviceName, volumeContainerName, resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client VolumeContainersClient) ListMetricsPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + } + + const APIVersion = "2017-06-01" + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/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 VolumeContainersClient) 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 VolumeContainersClient) ListMetricsResponder(resp *http.Response) (result MetricList, 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/storsimple8000series/volumes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumes.go new file mode 100644 index 000000000..f6d438faa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storsimple8000series/volumes.go @@ -0,0 +1,626 @@ +package storsimple8000series + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VolumesClient is the client for the Volumes methods of the +// Storsimple8000series service. +type VolumesClient struct { + ManagementClient +} + +// NewVolumesClient creates an instance of the VolumesClient client. +func NewVolumesClient(subscriptionID string) VolumesClient { + return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVolumesClientWithBaseURI creates an instance of the VolumesClient client. +func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient { + return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the volume. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// deviceName is the device name volumeContainerName is the volume container +// name. volumeName is the volume name. parameters is volume to be created or +// updated. resourceGroupName is the resource group name managerName is the +// manager name +func (client VolumesClient) CreateOrUpdate(deviceName string, volumeContainerName string, volumeName string, parameters Volume, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan Volume, <-chan error) { + resultChan := make(chan Volume, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VolumeProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VolumeProperties.SizeInBytes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VolumeProperties.AccessControlRecordIds", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Volume + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(deviceName, volumeContainerName, volumeName, parameters, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VolumesClient) CreateOrUpdatePreparer(deviceName string, volumeContainerName string, volumeName string, parameters Volume, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + "volumeName": volumeName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}", 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 VolumesClient) 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 VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, 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 volume. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// deviceName is the device name volumeContainerName is the volume container +// name. volumeName is the volume name. resourceGroupName is the resource group +// name managerName is the manager name +func (client VolumesClient) Delete(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName 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: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VolumesClient) DeletePreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + "volumeName": volumeName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}", 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 VolumesClient) 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 VolumesClient) 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 returns the properties of the specified volume name. +// +// deviceName is the device name volumeContainerName is the volume container +// name. volumeName is the volume name. resourceGroupName is the resource group +// name managerName is the manager name +func (client VolumesClient) Get(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (result Volume, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "Get") + } + + req, err := client.GetPreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VolumesClient) GetPreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + "volumeName": volumeName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDevice retrieves all the volumes in a device. +// +// deviceName is the device name resourceGroupName is the resource group name +// managerName is the manager name +func (client VolumesClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result VolumeList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListByDevice") + } + + req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByDevice", resp, "Failure sending request") + return + } + + result, err = client.ListByDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByDevice", resp, "Failure responding to request") + } + + return +} + +// ListByDevicePreparer prepares the ListByDevice request. +func (client VolumesClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDeviceSender sends the ListByDevice request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ListByDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDeviceResponder handles the response to the ListByDevice request. The method always +// closes the http.Response Body. +func (client VolumesClient) ListByDeviceResponder(resp *http.Response) (result VolumeList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVolumeContainer retrieves all the volumes in a volume container. +// +// deviceName is the device name volumeContainerName is the volume container +// name. resourceGroupName is the resource group name managerName is the +// manager name +func (client VolumesClient) ListByVolumeContainer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (result VolumeList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer") + } + + req, err := client.ListByVolumeContainerPreparer(deviceName, volumeContainerName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVolumeContainerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer", resp, "Failure sending request") + return + } + + result, err = client.ListByVolumeContainerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer", resp, "Failure responding to request") + } + + return +} + +// ListByVolumeContainerPreparer prepares the ListByVolumeContainer request. +func (client VolumesClient) ListByVolumeContainerPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByVolumeContainerSender sends the ListByVolumeContainer request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ListByVolumeContainerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByVolumeContainerResponder handles the response to the ListByVolumeContainer request. The method always +// closes the http.Response Body. +func (client VolumesClient) ListByVolumeContainerResponder(resp *http.Response) (result VolumeList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinition gets the metric definitions for the specified volume. +// +// deviceName is the device name volumeContainerName is the volume container +// name. volumeName is the volume name. resourceGroupName is the resource group +// name managerName is the manager name +func (client VolumesClient) ListMetricDefinition(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition") + } + + req, err := client.ListMetricDefinitionPreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionPreparer prepares the ListMetricDefinition request. +func (client VolumesClient) ListMetricDefinitionPreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + "volumeName": volumeName, + } + + const APIVersion = "2017-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.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}/metricsDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always +// closes the http.Response Body. +func (client VolumesClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, 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 gets the metrics for the specified volume. +// +// deviceName is the device name volumeContainerName is the volume container +// name. volumeName is the volume name. resourceGroupName is the resource group +// name managerName is the manager name filter is oData Filter options +func (client VolumesClient) ListMetrics(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, filter string) (result MetricList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: managerName, + Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client VolumesClient) ListMetricsPreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": deviceName, + "managerName": managerName, + "resourceGroupName": resourceGroupName, + "subscriptionId": client.SubscriptionID, + "volumeContainerName": volumeContainerName, + "volumeName": volumeName, + } + + const APIVersion = "2017-06-01" + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}/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 VolumesClient) 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 VolumesClient) ListMetricsResponder(resp *http.Response) (result MetricList, 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/streamanalytics/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/client.go new file mode 100644 index 000000000..78ba4ee72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/client.go @@ -0,0 +1,53 @@ +// Package streamanalytics implements the Azure ARM Streamanalytics service API +// version . +// +// Composite Swagger for Stream Analytics Client +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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 Streamanalytics + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Streamanalytics. +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/streamanalytics/functions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/functions.go new file mode 100644 index 000000000..34cdce08f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/functions.go @@ -0,0 +1,670 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// FunctionsClient is the composite Swagger for Stream Analytics Client +type FunctionsClient struct { + ManagementClient +} + +// NewFunctionsClient creates an instance of the FunctionsClient client. +func NewFunctionsClient(subscriptionID string) FunctionsClient { + return NewFunctionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFunctionsClientWithBaseURI creates an instance of the FunctionsClient +// client. +func NewFunctionsClientWithBaseURI(baseURI string, subscriptionID string) FunctionsClient { + return FunctionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates a function or replaces an already existing function +// under an existing streaming job. +// +// function is the definition of the function that will be used to create a new +// function or replace the existing one under the streaming job. +// 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. jobName is the name of the streaming job. functionName is the +// name of the function. ifMatch is the ETag of the function. Omit this value +// to always overwrite the current function. Specify the last-seen ETag value +// to prevent accidentally overwritting concurrent changes. ifNoneMatch is set +// to '*' to allow a new function to be created, but to prevent updating an +// existing function. Other values will result in a 412 Pre-condition Failed +// response. +func (client FunctionsClient) CreateOrReplace(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (result Function, err error) { + req, err := client.CreateOrReplacePreparer(function, resourceGroupName, jobName, functionName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", resp, "Failure responding to request") + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client FunctionsClient) CreateOrReplacePreparer(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters), + autorest.WithJSON(function), + 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{}) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client FunctionsClient) CreateOrReplaceResponder(resp *http.Response) (result Function, 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 function from the streaming job. +// +// 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. jobName is the name of the streaming job. functionName is the +// name of the function. +func (client FunctionsClient) Delete(resourceGroupName string, jobName string, functionName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, jobName, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FunctionsClient) DeletePreparer(resourceGroupName string, jobName string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", 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 FunctionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FunctionsClient) 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 details about the specified function. +// +// 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. jobName is the name of the streaming job. functionName is the +// name of the function. +func (client FunctionsClient) Get(resourceGroupName string, jobName string, functionName string) (result Function, err error) { + req, err := client.GetPreparer(resourceGroupName, jobName, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FunctionsClient) GetPreparer(resourceGroupName string, jobName string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FunctionsClient) GetResponder(resp *http.Response) (result Function, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJob lists all of the functions under the specified streaming +// job. +// +// 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. jobName is the name of the streaming job. selectParameter is the +// $select OData query parameter. This is a comma-separated list of structural +// properties to include in the response, or “*” to include all properties. By +// default, all properties are returned except diagnostics. Currently only +// accepts '*' as a valid value. +func (client FunctionsClient) ListByStreamingJob(resourceGroupName string, jobName string, selectParameter string) (result FunctionListResult, err error) { + req, err := client.ListByStreamingJobPreparer(resourceGroupName, jobName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure sending request") + return + } + + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure responding to request") + } + + return +} + +// ListByStreamingJobPreparer prepares the ListByStreamingJob request. +func (client FunctionsClient) ListByStreamingJobPreparer(resourceGroupName string, jobName string, selectParameter 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-03-01" + 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("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always +// closes the http.Response Body. +func (client FunctionsClient) ListByStreamingJobResponder(resp *http.Response) (result FunctionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJobNextResults retrieves the next set of results, if any. +func (client FunctionsClient) ListByStreamingJobNextResults(lastResults FunctionListResult) (result FunctionListResult, err error) { + req, err := lastResults.FunctionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure sending next results request") + } + + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure responding to next results request") + } + + return +} + +// ListByStreamingJobComplete gets all elements from the list without paging. +func (client FunctionsClient) ListByStreamingJobComplete(resourceGroupName string, jobName string, selectParameter string, cancel <-chan struct{}) (<-chan Function, <-chan error) { + resultChan := make(chan Function) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByStreamingJob(resourceGroupName, jobName, selectParameter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByStreamingJobNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// RetrieveDefaultDefinition retrieves the default definition of a function +// based on the parameters specified. +// +// 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. jobName is the name of the streaming job. functionName is the +// name of the function. functionRetrieveDefaultDefinitionParameters is +// parameters used to specify the type of function to retrieve the default +// definition for. +func (client FunctionsClient) RetrieveDefaultDefinition(resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *FunctionRetrieveDefaultDefinitionParameters) (result Function, err error) { + req, err := client.RetrieveDefaultDefinitionPreparer(resourceGroupName, jobName, functionName, functionRetrieveDefaultDefinitionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveDefaultDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", resp, "Failure sending request") + return + } + + result, err = client.RetrieveDefaultDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", resp, "Failure responding to request") + } + + return +} + +// RetrieveDefaultDefinitionPreparer prepares the RetrieveDefaultDefinition request. +func (client FunctionsClient) RetrieveDefaultDefinitionPreparer(resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *FunctionRetrieveDefaultDefinitionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/RetrieveDefaultDefinition", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if functionRetrieveDefaultDefinitionParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(functionRetrieveDefaultDefinitionParameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// RetrieveDefaultDefinitionSender sends the RetrieveDefaultDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) RetrieveDefaultDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveDefaultDefinitionResponder handles the response to the RetrieveDefaultDefinition request. The method always +// closes the http.Response Body. +func (client FunctionsClient) RetrieveDefaultDefinitionResponder(resp *http.Response) (result Function, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Test tests if the information provided for a function is valid. This can +// range from testing the connection to the underlying web service behind the +// function or making sure the function code provided is syntactically correct. +// This method may poll for completion. Polling can be canceled by passing the +// 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. jobName is the name of the streaming job. functionName is the +// name of the function. function is if the function specified does not already +// exist, this parameter must contain the full function definition intended to +// be tested. If the function specified already exists, this parameter can be +// left null to test the existing function as is or if specified, the +// properties specified will overwrite the corresponding properties in the +// existing function (exactly like a PATCH operation) and the resulting +// function will be tested. +func (client FunctionsClient) Test(resourceGroupName string, jobName string, functionName string, function *Function, cancel <-chan struct{}) (<-chan ResourceTestStatus, <-chan error) { + resultChan := make(chan ResourceTestStatus, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ResourceTestStatus + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestPreparer(resourceGroupName, jobName, functionName, function, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", nil, "Failure preparing request") + return + } + + resp, err := client.TestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", resp, "Failure sending request") + return + } + + result, err = client.TestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestPreparer prepares the Test request. +func (client FunctionsClient) TestPreparer(resourceGroupName string, jobName string, functionName string, function *Function, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if function != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(function)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestSender sends the Test request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) TestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestResponder handles the response to the Test request. The method always +// closes the http.Response Body. +func (client FunctionsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, 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 function under an existing streaming job. This +// can be used to partially update (ie. update one or two properties) a +// function without affecting the rest the job or function definition. +// +// function is a function object. The properties specified here will overwrite +// the corresponding properties in the existing function (ie. Those properties +// will be updated). Any properties that are set to null here will mean that +// the corresponding property in the existing function will remain the same and +// not change as a result of this PATCH operation. 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. jobName is the name +// of the streaming job. functionName is the name of the function. ifMatch is +// the ETag of the function. Omit this value to always overwrite the current +// function. Specify the last-seen ETag value to prevent accidentally +// overwritting concurrent changes. +func (client FunctionsClient) Update(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (result Function, err error) { + req, err := client.UpdatePreparer(function, resourceGroupName, jobName, functionName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FunctionsClient) UpdatePreparer(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters), + autorest.WithJSON(function), + 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 FunctionsClient) 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 FunctionsClient) UpdateResponder(resp *http.Response) (result Function, 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/streamanalytics/inputs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/inputs.go new file mode 100644 index 000000000..5a224d670 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/inputs.go @@ -0,0 +1,588 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// InputsClient is the composite Swagger for Stream Analytics Client +type InputsClient struct { + ManagementClient +} + +// NewInputsClient creates an instance of the InputsClient client. +func NewInputsClient(subscriptionID string) InputsClient { + return NewInputsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInputsClientWithBaseURI creates an instance of the InputsClient client. +func NewInputsClientWithBaseURI(baseURI string, subscriptionID string) InputsClient { + return InputsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates an input or replaces an already existing input under +// an existing streaming job. +// +// input is the definition of the input that will be used to create a new input +// or replace the existing one under the streaming job. 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. jobName is the +// name of the streaming job. inputName is the name of the input. ifMatch is +// the ETag of the input. Omit this value to always overwrite the current +// input. Specify the last-seen ETag value to prevent accidentally overwritting +// concurrent changes. ifNoneMatch is set to '*' to allow a new input to be +// created, but to prevent updating an existing input. Other values will result +// in a 412 Pre-condition Failed response. +func (client InputsClient) CreateOrReplace(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (result Input, err error) { + req, err := client.CreateOrReplacePreparer(input, resourceGroupName, jobName, inputName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", resp, "Failure responding to request") + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client InputsClient) CreateOrReplacePreparer(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters), + autorest.WithJSON(input), + 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{}) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client InputsClient) CreateOrReplaceResponder(resp *http.Response) (result Input, 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 input from the streaming job. +// +// 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. jobName is the name of the streaming job. inputName is the name +// of the input. +func (client InputsClient) Delete(resourceGroupName string, jobName string, inputName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, jobName, inputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client InputsClient) DeletePreparer(resourceGroupName string, jobName string, inputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", 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 InputsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client InputsClient) 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 details about the specified input. +// +// 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. jobName is the name of the streaming job. inputName is the name +// of the input. +func (client InputsClient) Get(resourceGroupName string, jobName string, inputName string) (result Input, err error) { + req, err := client.GetPreparer(resourceGroupName, jobName, inputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client InputsClient) GetPreparer(resourceGroupName string, jobName string, inputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InputsClient) GetResponder(resp *http.Response) (result Input, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJob lists all of the inputs under the specified streaming +// job. +// +// 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. jobName is the name of the streaming job. selectParameter is the +// $select OData query parameter. This is a comma-separated list of structural +// properties to include in the response, or “*” to include all properties. By +// default, all properties are returned except diagnostics. Currently only +// accepts '*' as a valid value. +func (client InputsClient) ListByStreamingJob(resourceGroupName string, jobName string, selectParameter string) (result InputListResult, err error) { + req, err := client.ListByStreamingJobPreparer(resourceGroupName, jobName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure sending request") + return + } + + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure responding to request") + } + + return +} + +// ListByStreamingJobPreparer prepares the ListByStreamingJob request. +func (client InputsClient) ListByStreamingJobPreparer(resourceGroupName string, jobName string, selectParameter 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-03-01" + 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("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always +// closes the http.Response Body. +func (client InputsClient) ListByStreamingJobResponder(resp *http.Response) (result InputListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJobNextResults retrieves the next set of results, if any. +func (client InputsClient) ListByStreamingJobNextResults(lastResults InputListResult) (result InputListResult, err error) { + req, err := lastResults.InputListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure sending next results request") + } + + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure responding to next results request") + } + + return +} + +// ListByStreamingJobComplete gets all elements from the list without paging. +func (client InputsClient) ListByStreamingJobComplete(resourceGroupName string, jobName string, selectParameter string, cancel <-chan struct{}) (<-chan Input, <-chan error) { + resultChan := make(chan Input) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByStreamingJob(resourceGroupName, jobName, selectParameter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByStreamingJobNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Test tests whether an input’s datasource is reachable and usable by the +// Azure Stream Analytics 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 that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. jobName is the name of the streaming job. inputName is the name +// of the input. input is if the input specified does not already exist, this +// parameter must contain the full input definition intended to be tested. If +// the input specified already exists, this parameter can be left null to test +// the existing input as is or if specified, the properties specified will +// overwrite the corresponding properties in the existing input (exactly like a +// PATCH operation) and the resulting input will be tested. +func (client InputsClient) Test(resourceGroupName string, jobName string, inputName string, input *Input, cancel <-chan struct{}) (<-chan ResourceTestStatus, <-chan error) { + resultChan := make(chan ResourceTestStatus, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ResourceTestStatus + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestPreparer(resourceGroupName, jobName, inputName, input, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", nil, "Failure preparing request") + return + } + + resp, err := client.TestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", resp, "Failure sending request") + return + } + + result, err = client.TestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestPreparer prepares the Test request. +func (client InputsClient) TestPreparer(resourceGroupName string, jobName string, inputName string, input *Input, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if input != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(input)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestSender sends the Test request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) TestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestResponder handles the response to the Test request. The method always +// closes the http.Response Body. +func (client InputsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, 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 input under an existing streaming job. This can +// be used to partially update (ie. update one or two properties) an input +// without affecting the rest the job or input definition. +// +// input is an Input object. The properties specified here will overwrite the +// corresponding properties in the existing input (ie. Those properties will be +// updated). Any properties that are set to null here will mean that the +// corresponding property in the existing input will remain the same and not +// change as a result of this PATCH operation. 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. jobName is the name of +// the streaming job. inputName is the name of the input. ifMatch is the ETag +// of the input. Omit this value to always overwrite the current input. Specify +// the last-seen ETag value to prevent accidentally overwritting concurrent +// changes. +func (client InputsClient) Update(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (result Input, err error) { + req, err := client.UpdatePreparer(input, resourceGroupName, jobName, inputName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client InputsClient) UpdatePreparer(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters), + autorest.WithJSON(input), + 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 InputsClient) 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 InputsClient) UpdateResponder(resp *http.Response) (result Input, 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/streamanalytics/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/models.go new file mode 100644 index 000000000..bb3d04b6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/models.go @@ -0,0 +1,806 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause 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" +) + +// CompatibilityLevel enumerates the values for compatibility level. +type CompatibilityLevel string + +const ( + // OneFullStopZero specifies the one full stop zero state for compatibility + // level. + OneFullStopZero CompatibilityLevel = "1.0" +) + +// Encoding enumerates the values for encoding. +type Encoding string + +const ( + // UTF8 specifies the utf8 state for encoding. + UTF8 Encoding = "UTF8" +) + +// EventsOutOfOrderPolicy enumerates the values for events out of order policy. +type EventsOutOfOrderPolicy string + +const ( + // Adjust specifies the adjust state for events out of order policy. + Adjust EventsOutOfOrderPolicy = "Adjust" + // Drop specifies the drop state for events out of order policy. + Drop EventsOutOfOrderPolicy = "Drop" +) + +// JSONOutputSerializationFormat enumerates the values for json output +// serialization format. +type JSONOutputSerializationFormat string + +const ( + // Array specifies the array state for json output serialization format. + Array JSONOutputSerializationFormat = "Array" + // LineSeparated specifies the line separated state for json output + // serialization format. + LineSeparated JSONOutputSerializationFormat = "LineSeparated" +) + +// OutputErrorPolicy enumerates the values for output error policy. +type OutputErrorPolicy string + +const ( + // OutputErrorPolicyDrop specifies the output error policy drop state for + // output error policy. + OutputErrorPolicyDrop OutputErrorPolicy = "Drop" + // OutputErrorPolicyStop specifies the output error policy stop state for + // output error policy. + OutputErrorPolicyStop OutputErrorPolicy = "Stop" +) + +// OutputStartMode enumerates the values for output start mode. +type OutputStartMode string + +const ( + // CustomTime specifies the custom time state for output start mode. + CustomTime OutputStartMode = "CustomTime" + // JobStartTime specifies the job start time state for output start mode. + JobStartTime OutputStartMode = "JobStartTime" + // LastOutputEventTime specifies the last output event time state for + // output start mode. + LastOutputEventTime OutputStartMode = "LastOutputEventTime" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Standard specifies the standard state for sku name. + Standard SkuName = "Standard" +) + +// UdfType enumerates the values for udf type. +type UdfType string + +const ( + // Scalar specifies the scalar state for udf type. + Scalar UdfType = "Scalar" +) + +// AvroSerialization is describes how data from an input is serialized or how +// data is serialized when written to an output in Avro format. +type AvroSerialization struct { + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionBinding is the binding to an Azure +// Machine Learning web service. +type AzureMachineLearningWebServiceFunctionBinding struct { + *AzureMachineLearningWebServiceFunctionBindingProperties `json:"properties,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionBindingProperties is the binding +// properties associated with an Azure Machine learning web service. +type AzureMachineLearningWebServiceFunctionBindingProperties struct { + Endpoint *string `json:"endpoint,omitempty"` + APIKey *string `json:"apiKey,omitempty"` + Inputs *AzureMachineLearningWebServiceInputs `json:"inputs,omitempty"` + Outputs *[]AzureMachineLearningWebServiceOutputColumn `json:"outputs,omitempty"` + BatchSize *int32 `json:"batchSize,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionBindingRetrievalProperties is the +// binding retrieval properties associated with an Azure Machine learning web +// service. +type AzureMachineLearningWebServiceFunctionBindingRetrievalProperties struct { + ExecuteEndpoint *string `json:"executeEndpoint,omitempty"` + UdfType UdfType `json:"udfType,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters is +// the parameters needed to retrieve the default function definition for an +// Azure Machine Learning web service function. +type AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters struct { + *AzureMachineLearningWebServiceFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` +} + +// AzureMachineLearningWebServiceInputColumn is describes an input column for +// the Azure Machine Learning web service endpoint. +type AzureMachineLearningWebServiceInputColumn struct { + Name *string `json:"name,omitempty"` + DataType *string `json:"dataType,omitempty"` + MapTo *int32 `json:"mapTo,omitempty"` +} + +// AzureMachineLearningWebServiceInputs is the inputs for the Azure Machine +// Learning web service endpoint. +type AzureMachineLearningWebServiceInputs struct { + Name *string `json:"name,omitempty"` + ColumnNames *[]AzureMachineLearningWebServiceInputColumn `json:"columnNames,omitempty"` +} + +// AzureMachineLearningWebServiceOutputColumn is describes an output column for +// the Azure Machine Learning web service endpoint. +type AzureMachineLearningWebServiceOutputColumn struct { + Name *string `json:"name,omitempty"` + DataType *string `json:"dataType,omitempty"` +} + +// AzureSQLDatabaseDataSourceProperties is the properties that are associated +// with an Azure SQL database data source. +type AzureSQLDatabaseDataSourceProperties struct { + Server *string `json:"server,omitempty"` + Database *string `json:"database,omitempty"` + User *string `json:"user,omitempty"` + Password *string `json:"password,omitempty"` + Table *string `json:"table,omitempty"` +} + +// AzureSQLDatabaseOutputDataSource is describes an Azure SQL database output +// data source. +type AzureSQLDatabaseOutputDataSource struct { + *AzureSQLDatabaseOutputDataSourceProperties `json:"properties,omitempty"` +} + +// AzureSQLDatabaseOutputDataSourceProperties is the properties that are +// associated with an Azure SQL database output. +type AzureSQLDatabaseOutputDataSourceProperties struct { + Server *string `json:"server,omitempty"` + Database *string `json:"database,omitempty"` + User *string `json:"user,omitempty"` + Password *string `json:"password,omitempty"` + Table *string `json:"table,omitempty"` +} + +// AzureTableOutputDataSource is describes an Azure Table data source. +type AzureTableOutputDataSource struct { + *AzureTableOutputDataSourceProperties `json:"properties,omitempty"` +} + +// AzureTableOutputDataSourceProperties is the properties that are associated +// with an Azure Table output. +type AzureTableOutputDataSourceProperties struct { + AccountName *string `json:"accountName,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + Table *string `json:"table,omitempty"` + PartitionKey *string `json:"partitionKey,omitempty"` + RowKey *string `json:"rowKey,omitempty"` + ColumnsToRemove *[]string `json:"columnsToRemove,omitempty"` + BatchSize *int32 `json:"batchSize,omitempty"` +} + +// BlobDataSourceProperties is the properties that are associated with a blob +// data source. +type BlobDataSourceProperties struct { + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + Container *string `json:"container,omitempty"` + PathPattern *string `json:"pathPattern,omitempty"` + DateFormat *string `json:"dateFormat,omitempty"` + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// BlobOutputDataSource is describes a blob output data source. +type BlobOutputDataSource struct { + *BlobOutputDataSourceProperties `json:"properties,omitempty"` +} + +// BlobOutputDataSourceProperties is the properties that are associated with a +// blob output. +type BlobOutputDataSourceProperties struct { + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + Container *string `json:"container,omitempty"` + PathPattern *string `json:"pathPattern,omitempty"` + DateFormat *string `json:"dateFormat,omitempty"` + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// BlobReferenceInputDataSource is describes a blob input data source that +// contains reference data. +type BlobReferenceInputDataSource struct { + *BlobReferenceInputDataSourceProperties `json:"properties,omitempty"` +} + +// BlobReferenceInputDataSourceProperties is the properties that are associated +// with a blob input containing reference data. +type BlobReferenceInputDataSourceProperties struct { + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + Container *string `json:"container,omitempty"` + PathPattern *string `json:"pathPattern,omitempty"` + DateFormat *string `json:"dateFormat,omitempty"` + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// BlobStreamInputDataSource is describes a blob input data source that +// contains stream data. +type BlobStreamInputDataSource struct { + *BlobStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// BlobStreamInputDataSourceProperties is the properties that are associated +// with a blob input containing stream data. +type BlobStreamInputDataSourceProperties struct { + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + Container *string `json:"container,omitempty"` + PathPattern *string `json:"pathPattern,omitempty"` + DateFormat *string `json:"dateFormat,omitempty"` + TimeFormat *string `json:"timeFormat,omitempty"` + SourcePartitionCount *int32 `json:"sourcePartitionCount,omitempty"` +} + +// CsvSerialization is describes how data from an input is serialized or how +// data is serialized when written to an output in CSV format. +type CsvSerialization struct { + *CsvSerializationProperties `json:"properties,omitempty"` +} + +// CsvSerializationProperties is the properties that are associated with the +// CSV serialization type. +type CsvSerializationProperties struct { + FieldDelimiter *string `json:"fieldDelimiter,omitempty"` + Encoding Encoding `json:"encoding,omitempty"` +} + +// DiagnosticCondition is condition applicable to the resource, or to the job +// overall, that warrant customer attention. +type DiagnosticCondition struct { + Since *string `json:"since,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Diagnostics is describes conditions applicable to the Input, Output, or the +// job overall, that warrant customer attention. +type Diagnostics struct { + Conditions *[]DiagnosticCondition `json:"conditions,omitempty"` +} + +// DocumentDbOutputDataSource is describes a DocumentDB data source. +type DocumentDbOutputDataSource struct { + *DocumentDbOutputDataSourceProperties `json:"properties,omitempty"` +} + +// DocumentDbOutputDataSourceProperties is the properties that are associated +// with a DocumentDB output. +type DocumentDbOutputDataSourceProperties struct { + AccountID *string `json:"accountId,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + Database *string `json:"database,omitempty"` + CollectionNamePattern *string `json:"collectionNamePattern,omitempty"` + PartitionKey *string `json:"partitionKey,omitempty"` + DocumentID *string `json:"documentId,omitempty"` +} + +// ErrorResponse is describes the error that occurred. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// EventHubDataSourceProperties is the common properties that are associated +// with Event Hub data sources. +type EventHubDataSourceProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + EventHubName *string `json:"eventHubName,omitempty"` +} + +// EventHubOutputDataSource is describes an Event Hub output data source. +type EventHubOutputDataSource struct { + *EventHubOutputDataSourceProperties `json:"properties,omitempty"` +} + +// EventHubOutputDataSourceProperties is the properties that are associated +// with an Event Hub output. +type EventHubOutputDataSourceProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + EventHubName *string `json:"eventHubName,omitempty"` + PartitionKey *string `json:"partitionKey,omitempty"` +} + +// EventHubStreamInputDataSource is describes an Event Hub input data source +// that contains stream data. +type EventHubStreamInputDataSource struct { + *EventHubStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// EventHubStreamInputDataSourceProperties is the properties that are +// associated with a Event Hub input containing stream data. +type EventHubStreamInputDataSourceProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + EventHubName *string `json:"eventHubName,omitempty"` + ConsumerGroupName *string `json:"consumerGroupName,omitempty"` +} + +// Function is a function object, containing all information associated with +// the named function. All functions are contained under a streaming job. +type Function struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Properties *FunctionProperties `json:"properties,omitempty"` +} + +// FunctionBinding is the physical binding of the function. For example, in the +// Azure Machine Learning web service’s case, this describes the endpoint. +type FunctionBinding struct { +} + +// FunctionInput is describes one input parameter of a function. +type FunctionInput struct { + DataType *string `json:"dataType,omitempty"` + IsConfigurationParameter *bool `json:"isConfigurationParameter,omitempty"` +} + +// FunctionListResult is object containing a list of functions under a +// streaming job. +type FunctionListResult struct { + autorest.Response `json:"-"` + Value *[]Function `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// FunctionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client FunctionListResult) FunctionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// FunctionOutput is describes the output of a function. +type FunctionOutput struct { + DataType *string `json:"dataType,omitempty"` +} + +// FunctionProperties is the properties that are associated with a function. +type FunctionProperties struct { + Etag *string `json:"etag,omitempty"` +} + +// FunctionRetrieveDefaultDefinitionParameters is parameters used to specify +// the type of function to retrieve the default definition for. +type FunctionRetrieveDefaultDefinitionParameters struct { +} + +// Input is an input object, containing all information associated with the +// named input. All inputs are contained under a streaming job. +type Input struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Properties *InputProperties `json:"properties,omitempty"` +} + +// InputListResult is object containing a list of inputs under a streaming job. +type InputListResult struct { + autorest.Response `json:"-"` + Value *[]Input `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// InputListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client InputListResult) InputListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// InputProperties is the properties that are associated with an input. +type InputProperties struct { + Serialization *Serialization `json:"serialization,omitempty"` + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// IoTHubStreamInputDataSource is describes an IoT Hub input data source that +// contains stream data. +type IoTHubStreamInputDataSource struct { + *IoTHubStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// IoTHubStreamInputDataSourceProperties is the properties that are associated +// with a IoT Hub input containing stream data. +type IoTHubStreamInputDataSourceProperties struct { + IotHubNamespace *string `json:"iotHubNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + ConsumerGroupName *string `json:"consumerGroupName,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` +} + +// JavaScriptFunctionBinding is the binding to a JavaScript function. +type JavaScriptFunctionBinding struct { + *JavaScriptFunctionBindingProperties `json:"properties,omitempty"` +} + +// JavaScriptFunctionBindingProperties is the binding properties associated +// with a JavaScript function. +type JavaScriptFunctionBindingProperties struct { + Script *string `json:"script,omitempty"` +} + +// JavaScriptFunctionBindingRetrievalProperties is the binding retrieval +// properties associated with a JavaScript function. +type JavaScriptFunctionBindingRetrievalProperties struct { + Script *string `json:"script,omitempty"` + UdfType UdfType `json:"udfType,omitempty"` +} + +// JavaScriptFunctionRetrieveDefaultDefinitionParameters is the parameters +// needed to retrieve the default function definition for a JavaScript +// function. +type JavaScriptFunctionRetrieveDefaultDefinitionParameters struct { + *JavaScriptFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` +} + +// JSONSerialization is describes how data from an input is serialized or how +// data is serialized when written to an output in JSON format. +type JSONSerialization struct { + *JSONSerializationProperties `json:"properties,omitempty"` +} + +// JSONSerializationProperties is the properties that are associated with the +// JSON serialization type. +type JSONSerializationProperties struct { + Encoding Encoding `json:"encoding,omitempty"` + Format JSONOutputSerializationFormat `json:"format,omitempty"` +} + +// Operation is a Stream Analytics REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is contains the localized display information for this +// particular operation / action. +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 result of the request to list Stream Analytics +// 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))) +} + +// Output is an output object, containing all information associated with the +// named output. All outputs are contained under a streaming job. +type Output struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *OutputProperties `json:"properties,omitempty"` +} + +// OutputDataSource is describes the data source that output will be written +// to. +type OutputDataSource struct { +} + +// OutputListResult is object containing a list of outputs under a streaming +// job. +type OutputListResult struct { + autorest.Response `json:"-"` + Value *[]Output `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OutputListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OutputListResult) OutputListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OutputProperties is the properties that are associated with an output. +type OutputProperties struct { + Datasource *OutputDataSource `json:"datasource,omitempty"` + Serialization *Serialization `json:"serialization,omitempty"` + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ReferenceInputDataSource is describes an input data source that contains +// reference data. +type ReferenceInputDataSource struct { +} + +// ReferenceInputProperties is the properties that are associated with an input +// containing reference data. +type ReferenceInputProperties struct { + Serialization *Serialization `json:"serialization,omitempty"` + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + Etag *string `json:"etag,omitempty"` + Datasource *ReferenceInputDataSource `json:"datasource,omitempty"` +} + +// Resource is the base 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"` +} + +// ResourceTestStatus is describes the status of the test operation along with +// error information, if applicable. +type ResourceTestStatus struct { + autorest.Response `json:"-"` + Status *string `json:"status,omitempty"` + Error *ErrorResponse `json:"error,omitempty"` +} + +// ScalarFunctionConfiguration is describes the configuration of the scalar +// function. +type ScalarFunctionConfiguration struct { + Inputs *[]FunctionInput `json:"inputs,omitempty"` + Output *FunctionOutput `json:"output,omitempty"` + Binding *FunctionBinding `json:"binding,omitempty"` +} + +// ScalarFunctionProperties is the properties that are associated with a scalar +// function. +type ScalarFunctionProperties struct { + Etag *string `json:"etag,omitempty"` + *ScalarFunctionConfiguration `json:"properties,omitempty"` +} + +// Serialization is describes how data from an input is serialized or how data +// is serialized when written to an output. +type Serialization struct { +} + +// ServiceBusDataSourceProperties is the common properties that are associated +// with Service Bus data sources (Queues, Topics, Event Hubs, etc.). +type ServiceBusDataSourceProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` +} + +// ServiceBusQueueOutputDataSource is describes a Service Bus Queue data +// source. +type ServiceBusQueueOutputDataSource struct { + *ServiceBusQueueOutputDataSourceProperties `json:"properties,omitempty"` +} + +// ServiceBusQueueOutputDataSourceProperties is the properties that are +// associated with a Service Bus Queue output. +type ServiceBusQueueOutputDataSourceProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + QueueName *string `json:"queueName,omitempty"` + PropertyColumns *[]string `json:"propertyColumns,omitempty"` +} + +// ServiceBusTopicOutputDataSource is describes a Service Bus Topic data +// source. +type ServiceBusTopicOutputDataSource struct { + *ServiceBusTopicOutputDataSourceProperties `json:"properties,omitempty"` +} + +// ServiceBusTopicOutputDataSourceProperties is the properties that are +// associated with a Service Bus Topic output. +type ServiceBusTopicOutputDataSourceProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + TopicName *string `json:"topicName,omitempty"` + PropertyColumns *[]string `json:"propertyColumns,omitempty"` +} + +// Sku is the properties that are associated with a SKU. +type Sku struct { + Name SkuName `json:"name,omitempty"` +} + +// StartStreamingJobParameters is parameters supplied to the Start Streaming +// Job operation. +type StartStreamingJobParameters struct { + OutputStartMode OutputStartMode `json:"outputStartMode,omitempty"` + OutputStartTime *date.Time `json:"outputStartTime,omitempty"` +} + +// StorageAccount is the properties that are associated with an Azure Storage +// account +type StorageAccount struct { + AccountName *string `json:"accountName,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` +} + +// StreamingJob is a streamng job object, containing all information associated +// with the named streaming job. +type StreamingJob 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"` + *StreamingJobProperties `json:"properties,omitempty"` +} + +// StreamingJobListResult is object containing a list of streaming jobs. +type StreamingJobListResult struct { + autorest.Response `json:"-"` + Value *[]StreamingJob `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// StreamingJobListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client StreamingJobListResult) StreamingJobListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// StreamingJobProperties is the properties that are associated with a +// streaming job. +type StreamingJobProperties struct { + Sku *Sku `json:"sku,omitempty"` + JobID *string `json:"jobId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + JobState *string `json:"jobState,omitempty"` + OutputStartMode OutputStartMode `json:"outputStartMode,omitempty"` + OutputStartTime *date.Time `json:"outputStartTime,omitempty"` + LastOutputEventTime *date.Time `json:"lastOutputEventTime,omitempty"` + EventsOutOfOrderPolicy EventsOutOfOrderPolicy `json:"eventsOutOfOrderPolicy,omitempty"` + OutputErrorPolicy OutputErrorPolicy `json:"outputErrorPolicy,omitempty"` + EventsOutOfOrderMaxDelayInSeconds *int32 `json:"eventsOutOfOrderMaxDelayInSeconds,omitempty"` + EventsLateArrivalMaxDelayInSeconds *int32 `json:"eventsLateArrivalMaxDelayInSeconds,omitempty"` + DataLocale *string `json:"dataLocale,omitempty"` + CompatibilityLevel CompatibilityLevel `json:"compatibilityLevel,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + Inputs *[]Input `json:"inputs,omitempty"` + Transformation *Transformation `json:"transformation,omitempty"` + Outputs *[]Output `json:"outputs,omitempty"` + Functions *[]Function `json:"functions,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// StreamInputDataSource is describes an input data source that contains stream +// data. +type StreamInputDataSource struct { +} + +// StreamInputProperties is the properties that are associated with an input +// containing stream data. +type StreamInputProperties struct { + Serialization *Serialization `json:"serialization,omitempty"` + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + Etag *string `json:"etag,omitempty"` + Datasource *StreamInputDataSource `json:"datasource,omitempty"` +} + +// SubResource is the base sub-resource model definition. +type SubResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// SubscriptionQuota is describes the current quota for the subscription. +type SubscriptionQuota struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *SubscriptionQuotaProperties `json:"properties,omitempty"` +} + +// SubscriptionQuotaProperties is describes the properties of the quota. +type SubscriptionQuotaProperties struct { + MaxCount *int32 `json:"maxCount,omitempty"` + CurrentCount *int32 `json:"currentCount,omitempty"` +} + +// SubscriptionQuotasListResult is result of the GetQuotas operation. It +// contains a list of quotas for the subscription in a particular region. +type SubscriptionQuotasListResult struct { + autorest.Response `json:"-"` + Value *[]SubscriptionQuota `json:"value,omitempty"` +} + +// Transformation is a transformation object, containing all information +// associated with the named transformation. All transformations are contained +// under a streaming job. +type Transformation struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *TransformationProperties `json:"properties,omitempty"` +} + +// TransformationProperties is the properties that are associated with a +// transformation. +type TransformationProperties struct { + StreamingUnits *int32 `json:"streamingUnits,omitempty"` + Query *string `json:"query,omitempty"` + Etag *string `json:"etag,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/operations.go new file mode 100644 index 000000000..dc0c7814d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/operations.go @@ -0,0 +1,167 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and 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 Stream Analytics 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 Stream Analytics related operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.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, "streamanalytics.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*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.StreamAnalytics/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, "streamanalytics.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, "streamanalytics.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan Operation, <-chan error) { + resultChan := make(chan Operation) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List() + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/outputs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/outputs.go new file mode 100644 index 000000000..e26a22c93 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/outputs.go @@ -0,0 +1,588 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OutputsClient is the composite Swagger for Stream Analytics Client +type OutputsClient struct { + ManagementClient +} + +// NewOutputsClient creates an instance of the OutputsClient client. +func NewOutputsClient(subscriptionID string) OutputsClient { + return NewOutputsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOutputsClientWithBaseURI creates an instance of the OutputsClient client. +func NewOutputsClientWithBaseURI(baseURI string, subscriptionID string) OutputsClient { + return OutputsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates an output or replaces an already existing output +// under an existing streaming job. +// +// output is the definition of the output that will be used to create a new +// output or replace the existing one under the streaming job. +// 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. jobName is the name of the streaming job. outputName is the name +// of the output. ifMatch is the ETag of the output. Omit this value to always +// overwrite the current output. Specify the last-seen ETag value to prevent +// accidentally overwritting concurrent changes. ifNoneMatch is set to '*' to +// allow a new output to be created, but to prevent updating an existing +// output. Other values will result in a 412 Pre-condition Failed response. +func (client OutputsClient) CreateOrReplace(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (result Output, err error) { + req, err := client.CreateOrReplacePreparer(output, resourceGroupName, jobName, outputName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", resp, "Failure responding to request") + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client OutputsClient) CreateOrReplacePreparer(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters), + autorest.WithJSON(output), + 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{}) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client OutputsClient) CreateOrReplaceResponder(resp *http.Response) (result Output, 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 output from the streaming job. +// +// 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. jobName is the name of the streaming job. outputName is the name +// of the output. +func (client OutputsClient) Delete(resourceGroupName string, jobName string, outputName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, jobName, outputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OutputsClient) DeletePreparer(resourceGroupName string, jobName string, outputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", 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 OutputsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OutputsClient) 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 details about the specified output. +// +// 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. jobName is the name of the streaming job. outputName is the name +// of the output. +func (client OutputsClient) Get(resourceGroupName string, jobName string, outputName string) (result Output, err error) { + req, err := client.GetPreparer(resourceGroupName, jobName, outputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client OutputsClient) GetPreparer(resourceGroupName string, jobName string, outputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OutputsClient) GetResponder(resp *http.Response) (result Output, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJob lists all of the outputs under the specified streaming +// job. +// +// 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. jobName is the name of the streaming job. selectParameter is the +// $select OData query parameter. This is a comma-separated list of structural +// properties to include in the response, or “*” to include all properties. By +// default, all properties are returned except diagnostics. Currently only +// accepts '*' as a valid value. +func (client OutputsClient) ListByStreamingJob(resourceGroupName string, jobName string, selectParameter string) (result OutputListResult, err error) { + req, err := client.ListByStreamingJobPreparer(resourceGroupName, jobName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure sending request") + return + } + + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure responding to request") + } + + return +} + +// ListByStreamingJobPreparer prepares the ListByStreamingJob request. +func (client OutputsClient) ListByStreamingJobPreparer(resourceGroupName string, jobName string, selectParameter 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-03-01" + 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("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always +// closes the http.Response Body. +func (client OutputsClient) ListByStreamingJobResponder(resp *http.Response) (result OutputListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJobNextResults retrieves the next set of results, if any. +func (client OutputsClient) ListByStreamingJobNextResults(lastResults OutputListResult) (result OutputListResult, err error) { + req, err := lastResults.OutputListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure sending next results request") + } + + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure responding to next results request") + } + + return +} + +// ListByStreamingJobComplete gets all elements from the list without paging. +func (client OutputsClient) ListByStreamingJobComplete(resourceGroupName string, jobName string, selectParameter string, cancel <-chan struct{}) (<-chan Output, <-chan error) { + resultChan := make(chan Output) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByStreamingJob(resourceGroupName, jobName, selectParameter) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByStreamingJobNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Test tests whether an output’s datasource is reachable and usable by the +// Azure Stream Analytics 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 that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. jobName is the name of the streaming job. outputName is the name +// of the output. output is if the output specified does not already exist, +// this parameter must contain the full output definition intended to be +// tested. If the output specified already exists, this parameter can be left +// null to test the existing output as is or if specified, the properties +// specified will overwrite the corresponding properties in the existing output +// (exactly like a PATCH operation) and the resulting output will be tested. +func (client OutputsClient) Test(resourceGroupName string, jobName string, outputName string, output *Output, cancel <-chan struct{}) (<-chan ResourceTestStatus, <-chan error) { + resultChan := make(chan ResourceTestStatus, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ResourceTestStatus + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.TestPreparer(resourceGroupName, jobName, outputName, output, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", nil, "Failure preparing request") + return + } + + resp, err := client.TestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", resp, "Failure sending request") + return + } + + result, err = client.TestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// TestPreparer prepares the Test request. +func (client OutputsClient) TestPreparer(resourceGroupName string, jobName string, outputName string, output *Output, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if output != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(output)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// TestSender sends the Test request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) TestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// TestResponder handles the response to the Test request. The method always +// closes the http.Response Body. +func (client OutputsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, 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 output under an existing streaming job. This can +// be used to partially update (ie. update one or two properties) an output +// without affecting the rest the job or output definition. +// +// output is an Output object. The properties specified here will overwrite the +// corresponding properties in the existing output (ie. Those properties will +// be updated). Any properties that are set to null here will mean that the +// corresponding property in the existing output will remain the same and not +// change as a result of this PATCH operation. 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. jobName is the name of +// the streaming job. outputName is the name of the output. ifMatch is the ETag +// of the output. Omit this value to always overwrite the current output. +// Specify the last-seen ETag value to prevent accidentally overwritting +// concurrent changes. +func (client OutputsClient) Update(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (result Output, err error) { + req, err := client.UpdatePreparer(output, resourceGroupName, jobName, outputName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OutputsClient) UpdatePreparer(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters), + autorest.WithJSON(output), + 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 OutputsClient) 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 OutputsClient) UpdateResponder(resp *http.Response) (result Output, 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/streamanalytics/streamingjobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/streamingjobs.go new file mode 100644 index 000000000..1c6c2addc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/streamingjobs.go @@ -0,0 +1,842 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// StreamingJobsClient is the composite Swagger for Stream Analytics Client +type StreamingJobsClient struct { + ManagementClient +} + +// NewStreamingJobsClient creates an instance of the StreamingJobsClient +// client. +func NewStreamingJobsClient(subscriptionID string) StreamingJobsClient { + return NewStreamingJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStreamingJobsClientWithBaseURI creates an instance of the +// StreamingJobsClient client. +func NewStreamingJobsClientWithBaseURI(baseURI string, subscriptionID string) StreamingJobsClient { + return StreamingJobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates a streaming job or replaces an already existing +// streaming job. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// streamingJob is the definition of the streaming job that will be used to +// create a new streaming job or replace the existing one. 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. jobName is the +// name of the streaming job. ifMatch is the ETag of the streaming job. Omit +// this value to always overwrite the current record set. Specify the last-seen +// ETag value to prevent accidentally overwritting concurrent changes. +// ifNoneMatch is set to '*' to allow a new streaming job to be created, but to +// prevent updating an existing record set. Other values will result in a 412 +// Pre-condition Failed response. +func (client StreamingJobsClient) CreateOrReplace(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string, cancel <-chan struct{}) (<-chan StreamingJob, <-chan error) { + resultChan := make(chan StreamingJob, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result StreamingJob + defer func() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrReplacePreparer(streamingJob, resourceGroupName, jobName, ifMatch, ifNoneMatch, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client StreamingJobsClient) CreateOrReplacePreparer(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string, cancel <-chan struct{}) (*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-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.StreamAnalytics/streamingjobs/{jobName}", pathParameters), + autorest.WithJSON(streamingJob), + 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{Cancel: cancel}) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client StreamingJobsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) CreateOrReplaceResponder(resp *http.Response) (result StreamingJob, 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 streaming job. This method may poll for completion. Polling +// can be canceled by passing the 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. jobName is the name of the streaming job. +func (client StreamingJobsClient) Delete(resourceGroupName string, jobName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, jobName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client StreamingJobsClient) DeletePreparer(resourceGroupName string, jobName string, cancel <-chan struct{}) (*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-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.StreamAnalytics/streamingjobs/{jobName}", 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 StreamingJobsClient) 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 StreamingJobsClient) 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 about the specified streaming job. +// +// 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. jobName is the name of the streaming job. expand is the $expand +// OData query parameter. This is a comma-separated list of additional +// streaming job properties to include in the response, beyond the default set +// returned when this parameter is absent. The default set is all streaming job +// properties other than 'inputs', 'transformation', 'outputs', and +// 'functions'. +func (client StreamingJobsClient) Get(resourceGroupName string, jobName string, expand string) (result StreamingJob, err error) { + req, err := client.GetPreparer(resourceGroupName, jobName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client StreamingJobsClient) GetPreparer(resourceGroupName string, jobName string, expand 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-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.StreamAnalytics/streamingjobs/{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 StreamingJobsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) GetResponder(resp *http.Response) (result StreamingJob, 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 streaming jobs in the given subscription. +// +// expand is the $expand OData query parameter. This is a comma-separated list +// of additional streaming job properties to include in the response, beyond +// the default set returned when this parameter is absent. The default set is +// all streaming job properties other than 'inputs', 'transformation', +// 'outputs', and 'functions'. +func (client StreamingJobsClient) List(expand string) (result StreamingJobListResult, err error) { + req, err := client.ListPreparer(expand) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client StreamingJobsClient) ListPreparer(expand 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 len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client StreamingJobsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) ListResponder(resp *http.Response) (result StreamingJobListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client StreamingJobsClient) ListNextResults(lastResults StreamingJobListResult) (result StreamingJobListResult, err error) { + req, err := lastResults.StreamingJobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListComplete gets all elements from the list without paging. +func (client StreamingJobsClient) ListComplete(expand string, cancel <-chan struct{}) (<-chan StreamingJob, <-chan error) { + resultChan := make(chan StreamingJob) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.List(expand) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// ListByResourceGroup lists all of the streaming jobs in the specified +// 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. expand is the $expand OData query parameter. This is a +// comma-separated list of additional streaming job properties to include in +// the response, beyond the default set returned when this parameter is absent. +// The default set is all streaming job properties other than 'inputs', +// 'transformation', 'outputs', and 'functions'. +func (client StreamingJobsClient) ListByResourceGroup(resourceGroupName string, expand string) (result StreamingJobListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client StreamingJobsClient) ListByResourceGroupPreparer(resourceGroupName string, expand 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(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.StreamAnalytics/streamingjobs", 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 StreamingJobsClient) 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 StreamingJobsClient) ListByResourceGroupResponder(resp *http.Response) (result StreamingJobListResult, 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 StreamingJobsClient) ListByResourceGroupNextResults(lastResults StreamingJobListResult) (result StreamingJobListResult, err error) { + req, err := lastResults.StreamingJobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "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, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroupComplete gets all elements from the list without paging. +func (client StreamingJobsClient) ListByResourceGroupComplete(resourceGroupName string, expand string, cancel <-chan struct{}) (<-chan StreamingJob, <-chan error) { + resultChan := make(chan StreamingJob) + errChan := make(chan error, 1) + go func() { + defer func() { + close(resultChan) + close(errChan) + }() + list, err := client.ListByResourceGroup(resourceGroupName, expand) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + for list.NextLink != nil { + list, err = client.ListByResourceGroupNextResults(list) + if err != nil { + errChan <- err + return + } + if list.Value != nil { + for _, item := range *list.Value { + select { + case <-cancel: + return + case resultChan <- item: + // Intentionally left blank + } + } + } + } + }() + return resultChan, errChan +} + +// Start starts a streaming job. Once a job is started it will start processing +// input events and produce output. This method may poll for completion. +// Polling can be canceled by passing the 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. jobName is the name of the streaming job. startJobParameters is +// parameters applicable to a start streaming job operation. +func (client StreamingJobsClient) Start(resourceGroupName string, jobName string, startJobParameters *StartStreamingJobParameters, 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, jobName, startJobParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client StreamingJobsClient) StartPreparer(resourceGroupName string, jobName string, startJobParameters *StartStreamingJobParameters, cancel <-chan struct{}) (*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-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.StreamAnalytics/streamingjobs/{jobName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if startJobParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(startJobParameters)) + } + 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 StreamingJobsClient) 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 StreamingJobsClient) 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 a running streaming job. This will cause a running streaming job +// to stop processing input events and producing output. This method may poll +// for completion. Polling can be canceled by passing the 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. jobName is the name of the streaming job. +func (client StreamingJobsClient) Stop(resourceGroupName string, jobName 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() { + if err != nil { + errChan <- err + } + resultChan <- result + close(resultChan) + close(errChan) + }() + req, err := client.StopPreparer(resourceGroupName, jobName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StopPreparer prepares the Stop request. +func (client StreamingJobsClient) StopPreparer(resourceGroupName string, jobName string, cancel <-chan struct{}) (*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-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.StreamAnalytics/streamingjobs/{jobName}/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 StreamingJobsClient) 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 StreamingJobsClient) 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 updates an existing streaming job. This can be used to partially +// update (ie. update one or two properties) a streaming job without affecting +// the rest the job definition. +// +// streamingJob is a streaming job object. The properties specified here will +// overwrite the corresponding properties in the existing streaming job (ie. +// Those properties will be updated). Any properties that are set to null here +// will mean that the corresponding property in the existing input will remain +// the same and not change as a result of this PATCH operation. +// 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. jobName is the name of the streaming job. ifMatch is the ETag of +// the streaming job. Omit this value to always overwrite the current record +// set. Specify the last-seen ETag value to prevent accidentally overwritting +// concurrent changes. +func (client StreamingJobsClient) Update(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string) (result StreamingJob, err error) { + req, err := client.UpdatePreparer(streamingJob, resourceGroupName, jobName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client StreamingJobsClient) UpdatePreparer(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch 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-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.StreamAnalytics/streamingjobs/{jobName}", pathParameters), + autorest.WithJSON(streamingJob), + 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 StreamingJobsClient) 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 StreamingJobsClient) UpdateResponder(resp *http.Response) (result StreamingJob, 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/streamanalytics/subscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/subscriptions.go new file mode 100644 index 000000000..4bde29076 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/subscriptions.go @@ -0,0 +1,109 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// SubscriptionsClient is the composite Swagger for Stream Analytics 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)} +} + +// ListQuotas retrieves the subscription's current quota information in a +// particular region. +// +// location is the region in which to retrieve the subscription's quota +// information. You can find out which regions Azure Stream Analytics is +// supported in here: https://azure.microsoft.com/en-us/regions/ +func (client SubscriptionsClient) ListQuotas(location string) (result SubscriptionQuotasListResult, err error) { + req, err := client.ListQuotasPreparer(location) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", nil, "Failure preparing request") + return + } + + resp, err := client.ListQuotasSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", resp, "Failure sending request") + return + } + + result, err = client.ListQuotasResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", resp, "Failure responding to request") + } + + return +} + +// ListQuotasPreparer prepares the ListQuotas request. +func (client SubscriptionsClient) ListQuotasPreparer(location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "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.StreamAnalytics/locations/{location}/quotas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListQuotasSender sends the ListQuotas request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListQuotasSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListQuotasResponder handles the response to the ListQuotas request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListQuotasResponder(resp *http.Response) (result SubscriptionQuotasListResult, 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/streamanalytics/transformations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/transformations.go new file mode 100644 index 000000000..67b8d858b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/transformations.go @@ -0,0 +1,284 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// TransformationsClient is the composite Swagger for Stream Analytics Client +type TransformationsClient struct { + ManagementClient +} + +// NewTransformationsClient creates an instance of the TransformationsClient +// client. +func NewTransformationsClient(subscriptionID string) TransformationsClient { + return NewTransformationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTransformationsClientWithBaseURI creates an instance of the +// TransformationsClient client. +func NewTransformationsClientWithBaseURI(baseURI string, subscriptionID string) TransformationsClient { + return TransformationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates a transformation or replaces an already existing +// transformation under an existing streaming job. +// +// transformation is the definition of the transformation that will be used to +// create a new transformation or replace the existing one under the streaming +// job. 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. jobName is the name of the streaming job. transformationName is +// the name of the transformation. ifMatch is the ETag of the transformation. +// Omit this value to always overwrite the current transformation. Specify the +// last-seen ETag value to prevent accidentally overwritting concurrent +// changes. ifNoneMatch is set to '*' to allow a new transformation to be +// created, but to prevent updating an existing transformation. Other values +// will result in a 412 Pre-condition Failed response. +func (client TransformationsClient) CreateOrReplace(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (result Transformation, err error) { + req, err := client.CreateOrReplacePreparer(transformation, resourceGroupName, jobName, transformationName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", resp, "Failure responding to request") + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client TransformationsClient) CreateOrReplacePreparer(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "transformationName": autorest.Encode("path", transformationName), + } + + 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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters), + autorest.WithJSON(transformation), + 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{}) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client TransformationsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client TransformationsClient) CreateOrReplaceResponder(resp *http.Response) (result Transformation, 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 details about the specified transformation. +// +// 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. jobName is the name of the streaming job. transformationName is +// the name of the transformation. +func (client TransformationsClient) Get(resourceGroupName string, jobName string, transformationName string) (result Transformation, err error) { + req, err := client.GetPreparer(resourceGroupName, jobName, transformationName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TransformationsClient) GetPreparer(resourceGroupName string, jobName string, transformationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "transformationName": autorest.Encode("path", transformationName), + } + + 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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TransformationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TransformationsClient) GetResponder(resp *http.Response) (result Transformation, 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 transformation under an existing streaming job. +// This can be used to partially update (ie. update one or two properties) a +// transformation without affecting the rest the job or transformation +// definition. +// +// transformation is a Transformation object. The properties specified here +// will overwrite the corresponding properties in the existing transformation +// (ie. Those properties will be updated). Any properties that are set to null +// here will mean that the corresponding property in the existing +// transformation will remain the same and not change as a result of this PATCH +// operation. 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. jobName is the name of the streaming job. transformationName +// is the name of the transformation. ifMatch is the ETag of the +// transformation. Omit this value to always overwrite the current +// transformation. Specify the last-seen ETag value to prevent accidentally +// overwritting concurrent changes. +func (client TransformationsClient) Update(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (result Transformation, err error) { + req, err := client.UpdatePreparer(transformation, resourceGroupName, jobName, transformationName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TransformationsClient) UpdatePreparer(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "transformationName": autorest.Encode("path", transformationName), + } + + 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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters), + autorest.WithJSON(transformation), + 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 TransformationsClient) 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 TransformationsClient) UpdateResponder(resp *http.Response) (result Transformation, 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/streamanalytics/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/version.go new file mode 100644 index 000000000..80212843b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/streamanalytics/version.go @@ -0,0 +1,28 @@ +package streamanalytics + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.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.2.0-beta arm-streamanalytics/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..332f0addc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..cb88fa57c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/endpoints.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..a70d07036 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..b1e2859d9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/profiles.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c5360bace --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-trafficmanager/2015-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100755 index 000000000..4515b48bc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/apps.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..c6a681b09 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appservicecertificateorders.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..54f9f9bcb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceenvironments.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..d4e362875 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceplans.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..19628ccd8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/certificates.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..379919c74 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/client.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..7ea24e8ab --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/deletedwebapps.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..fba3c1d1f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/domains.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..005ade8c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..b2c75d21f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/provider.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..3cd70e2f8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/recommendations.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..ea9b2ff91 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/topleveldomains.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..0e17bf6be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-web/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/buildTerraform.sh b/vendor/github.com/Azure/azure-sdk-for-go/buildTerraform.sh new file mode 100644 index 000000000..9c622dfdf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/buildTerraform.sh @@ -0,0 +1,36 @@ +# This script tries to build Terraform related packages, +# and find possible breaking changes regarding the Azure +# SDK for Go + +set -x + +# This should only run on cronjobs +if [ "cron" != $TRAVIS_EVENT_TYPE ]; then + exit 0 +fi + +# Only meant to run on latest go version +if [ "go version go1.8 linux/amd64" != "$(go version)" ]; then + exit 0 +fi + +go get github.com/kardianos/govendor +REALEXITSTATUS=0 + +packages=(github.com/hashicorp/terraform + github.com/terraform-providers/terraform-provider-azurerm + github.com/terraform-providers/terraform-provider-azure) + +for package in ${packages[*]}; do + go get $package + cd $GOPATH/src/$package + + # update to latest SDK + govendor update github.com/Azure/azure-sdk-for-go/... + + # try to build + make + REALEXITSTATUS=$(($REALEXITSTATUS+$?)) +done + +exit $REALEXITSTATUS 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 new file mode 100755 index 000000000..4648982f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/client.go @@ -0,0 +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, + } +} 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 new file mode 100755 index 000000000..a7f559c68 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/filesystemgroup.go @@ -0,0 +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 +} 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 new file mode 100755 index 000000000..517f86119 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/models.go @@ -0,0 +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"` +} 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 new file mode 100755 index 000000000..e6855e194 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-filesystem/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100644 index 000000000..c20b4e4c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/client.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..842246227 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/models.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..868404d72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/version.go @@ -0,0 +1,28 @@ +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.1.0.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.2.0-beta arm-keyvault/2016-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.2.0-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 new file mode 100644 index 000000000..395f533c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/glide.lock @@ -0,0 +1,63 @@ +hash: bdeb606eca05304f80e5577159227ae4f00a002213f353e304066c593419a31b +updated: 2017-07-31T15:32:36.5529621-07:00 +imports: +- name: github.com/Azure/go-autorest + version: f6e08fe5e4d45c9a66e40196d3fed5f37331d224 + subpackages: + - autorest + - autorest/adal + - autorest/azure + - autorest/date + - autorest/to + - autorest/validation +- name: github.com/dgrijalva/jwt-go + version: a539ee1a749a2b895533f979515ac7e6e0f5b650 +- name: github.com/howeyc/gopass + version: bf9dde6d0d2c004a008c27aaee91170c786f6db8 +- name: github.com/mattn/go-colorable + version: 040dd0b833b34b4182673409ada4df2853b26537 +- 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: 3c692774ac4c47c7a296ec96e553719dba1a68fc +- name: golang.org/x/crypto + version: 558b6879de74bc843225cde5686419267ff707ca + subpackages: + - pkcs12 + - pkcs12/internal/rc2 + - ssh/terminal +- name: golang.org/x/sys + version: 0f826bdd13b500be0f1d4004938ad978fcc6031e + 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: 25c4ec802a7d637f88d584ab26798e94ad14c13b diff --git a/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml b/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml new file mode 100644 index 000000000..bae18484c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml @@ -0,0 +1,13 @@ +package: github.com/Azure/azure-sdk-for-go +import: +- package: github.com/Azure/go-autorest + version: ~8.1.1 + 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 new file mode 100644 index 000000000..7a1abb35a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/README.md @@ -0,0 +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). 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 new file mode 100644 index 000000000..3f6f240a3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..7ce588264 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/entities.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..155674a68 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..798594543 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/errors.go @@ -0,0 +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 + +} 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 new file mode 100644 index 000000000..9ee32be4e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go @@ -0,0 +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) + } + } +} 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 new file mode 100644 index 000000000..a9c7063a2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..f540fa9f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/entities.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..5760f51ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/http.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..721f3f607 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/location/client.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..8a2501583 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/location/entities.go @@ -0,0 +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(), ", ") +} 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 new file mode 100644 index 000000000..8e8eea4da --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..2c6f75757 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/entities.go @@ -0,0 +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 = "*" +) 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 new file mode 100644 index 000000000..4f6acb217 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/operations.go @@ -0,0 +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) + } +} 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 new file mode 100644 index 000000000..e9af16e9b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/client.go @@ -0,0 +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) + +} 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 new file mode 100644 index 000000000..25577c16e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/entities.go @@ -0,0 +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" +) 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 new file mode 100644 index 000000000..17505536c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/publishSettings.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..970c3f644 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/sql/client.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..bed6a05bd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/sql/entities.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..dad87e6db --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/client.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..2401298aa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..3f02f5beb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go @@ -0,0 +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) + } +} 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 new file mode 100644 index 000000000..426e20dcc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/testutils/managementclient.go @@ -0,0 +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) + } + } +} 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 new file mode 100644 index 000000000..72601757e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/util.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..a81c9f5ae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/version.go @@ -0,0 +1,5 @@ +package management + +var ( + sdkVersion = "v10.2.0-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 new file mode 100644 index 000000000..a9fe82755 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..a826541a7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..3118e6c5a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go @@ -0,0 +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) + } + +} 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 new file mode 100644 index 000000000..25320447e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..b4ec2a769 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go @@ -0,0 +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) + } + } +} 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 new file mode 100644 index 000000000..90f8d6561 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..1359381b8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/entities.go @@ -0,0 +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" +) 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 new file mode 100644 index 000000000..11c8848a7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..4a1df3119 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..b0d5bbe6f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go @@ -0,0 +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) + } +} 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 new file mode 100644 index 000000000..9d27ab7fd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/client.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..0cb8913e7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/entities.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..0ed3bd018 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/configurationset.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..06fcf852d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/datadisks.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..8ac5398de --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/deployment.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..751fd6a6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions.go @@ -0,0 +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{} 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 new file mode 100644 index 000000000..17a46563d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go @@ -0,0 +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)) + } +} 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 new file mode 100644 index 000000000..a0e79065a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..bf2331c7b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/network.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..bedd702fb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolesize.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..e3f21285c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolestate.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..1845663c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..675594020 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go @@ -0,0 +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)) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh b/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh new file mode 100644 index 000000000..92e3d4df8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh @@ -0,0 +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+$?)) +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 new file mode 100644 index 000000000..c13d409b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go @@ -0,0 +1,72 @@ +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 CreateBlockBlobFromReader for more info on creating blobs. +// +// 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 new file mode 100644 index 000000000..23f2a6e08 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob_test.go @@ -0,0 +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...)) +} 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 new file mode 100644 index 000000000..608bf3133 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..420868acf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..12f61ac2a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go @@ -0,0 +1,629 @@ +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 { + if br.End == 0 { + return fmt.Sprintf("bytes=%d-", br.Start) + } + 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 the GetRange method for use with a Range header. +// +// 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.writeProperties(resp.headers, true); 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 + } + // Content-Length header should not be updated, as the service returns the range length + // (which is not alwys the full blob length) + if err := b.writeProperties(resp.headers, false); 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() + if options.GetRangeContentMD5 { + headers["x-ms-range-get-content-md5"] = "true" + } + } + 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.writeProperties(resp.headers, true) +} + +func (b *Blob) writeProperties(h http.Header, includeContentLen bool) error { + var err error + + contentLength := b.Properties.ContentLength + if includeContentLen { + 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 new file mode 100644 index 000000000..9009b37c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go @@ -0,0 +1,545 @@ +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: 0, + End: 0, + }, + }, + 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:], + }, + { + options: GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 3, + End: 0, + }, + }, + expected: body[3:], + }, + } + + err := b.GetProperties(nil) + c.Assert(err, chk.IsNil) + + // 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 length left untouched? + c.Assert(b.Properties.ContentLength, chk.Equals, int64(len(body))) + } +} + +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 new file mode 100644 index 000000000..43173d3a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go @@ -0,0 +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") +} 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 new file mode 100644 index 000000000..ac2b6b1c5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri_test.go @@ -0,0 +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") +} 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 new file mode 100644 index 000000000..450b20f96 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..5258f24fd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go @@ -0,0 +1,258 @@ +package storage + +import ( + "bytes" + "encoding/xml" + "fmt" + "io" + "net/http" + "net/url" + "strconv" + "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 CreateBlockBlobFromReader for more info on creating blobs. +// +// 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. +// +// Any headers set in blob.Properties or metadata in blob.Metadata +// will be set on the blob. +// +// 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. +// +// To create a blob from scratch, call container.GetBlobReference() to +// get an empty blob, fill in blob.Properties and blob.Metadata as +// appropriate then call this method. +// +// 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"] = "0" + var n int64 + var err error + if blob != nil { + type lener interface { + Len() int + } + // TODO(rjeczalik): handle io.ReadSeeker, in case blob is *os.File etc. + if l, ok := blob.(lener); ok { + n = int64(l.Len()) + } else { + var buf bytes.Buffer + n, err = io.Copy(&buf, blob) + if err != nil { + return err + } + blob = &buf + } + + headers["Content-Length"] = strconv.FormatInt(n, 10) + } + b.Properties.ContentLength = n + + 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 new file mode 100644 index 000000000..d10bd3a22 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob_test.go @@ -0,0 +1,152 @@ +package storage + +import ( + "bytes" + "encoding/base64" + "io" + "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) + + length := 8888 + data := content(length) + err := b.CreateBlockBlobFromReader(bytes.NewReader(data), nil) + c.Assert(err, chk.IsNil) + c.Assert(b.Properties.ContentLength, chk.Equals, int64(length)) + + 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) 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) +} + +func (s *BlockBlobSuite) TestPutBlockWithLengthUsingLimitReader(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) + + length := 512 + data := content(length) + + lr := io.LimitReader(bytes.NewReader(data), 256) + c.Assert(b.PutBlockWithLength("0000", 256, lr, nil), chk.IsNil) +} 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 new file mode 100644 index 000000000..a701c4b2c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go @@ -0,0 +1,668 @@ +// 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" + "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) { + rr := autorest.NewRetriableRequest(req) + for attempts := 0; attempts < ds.RetryAttempts; attempts++ { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = c.HTTPClient.Do(rr.Request()) + 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 odataErrorWrapper +} + +// 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"` + Lang string + StatusCode int + RequestID string + Date string + APIVersion string +} + +type odataErrorMessage struct { + Lang string `json:"lang"` + Value string `json:"value"` +} + +type odataError struct { + Code string `json:"code"` + Message odataErrorMessage `json:"message"` +} + +type odataErrorWrapper struct { + Err odataError `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 a body was provided ensure that the content length was set. + // http.NewRequest() will automatically do this for a handful of types + // and for those that it doesn't we will handle here. + if body != nil && req.ContentLength < 1 { + if lr, ok := body.(*io.LimitedReader); ok { + req.ContentLength = lr.N + snapshot := *lr + req.GetBody = func() (io.ReadCloser, error) { + r := snapshot + return ioutil.NopCloser(&r), nil + } + } + } + + for k, v := range headers { + req.Header[k] = append(req.Header[k], v) // Must bypass case munging present in `Add` by using map functions directly. See https://github.com/Azure/azure-sdk-for-go/issues/645 + } + + resp, err := c.Sender.Send(&c, req) + if err != nil { + return nil, err + } + + if resp.StatusCode >= 400 && resp.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 { + storageErr := AzureStorageServiceError{ + StatusCode: resp.StatusCode, + RequestID: requestID, + Date: date, + APIVersion: version, + } + // response contains storage service error object, unmarshal + if resp.Header.Get("Content-Type") == "application/xml" { + errIn := serviceErrFromXML(respBody, &storageErr) + if err != nil { // error unmarshaling the error response + err = errIn + } + } else { + errIn := serviceErrFromJSON(respBody, &storageErr) + 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, storageErr *AzureStorageServiceError) error { + 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 err + } + return nil +} + +func serviceErrFromJSON(body []byte, storageErr *AzureStorageServiceError) error { + odataError := odataErrorWrapper{} + if err := json.Unmarshal(body, &odataError); err != nil { + storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(body)) + return err + } + storageErr.Code = odataError.Err.Code + storageErr.Message = odataError.Err.Message.Value + storageErr.Lang = odataError.Err.Message.Lang + return 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 new file mode 100644 index 000000000..d7459c047 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go @@ -0,0 +1,528 @@ +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{}) + +func setHeaders(haystack http.Header, predicate func(string) bool, value string) { + for key := range haystack { + if predicate(key) { + haystack[key] = []string{value} + } + } +} + +func deleteHeaders(haystack http.Header, predicate func(string) bool) { + for key := range haystack { + if predicate(key) { + delete(haystack, key) + } + } +} +func getHeaders(haystack http.Header, predicate func(string) bool) string { + for key, value := range haystack { + if predicate(key) && len(value) > 0 { + return value[0] + } + } + return "" +} + +// 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... + + getHeaderMatchPredicate := func(needle string) func(string) bool { + return func(straw string) bool { + return strings.EqualFold(needle, straw) + } + } + + isUserAgent := getHeaderMatchPredicate("User-Agent") + isAuthorization := getHeaderMatchPredicate("Authorization") + isDate := getHeaderMatchPredicate("x-ms-date") + deleteHeaders(requestHeaders, isUserAgent) + deleteHeaders(requestHeaders, isAuthorization) + deleteHeaders(requestHeaders, isDate) + + deleteHeaders(cassetteHeaders, isUserAgent) + deleteHeaders(cassetteHeaders, isAuthorization) + deleteHeaders(cassetteHeaders, isDate) + + isCopySource := getHeaderMatchPredicate("X-Ms-Copy-Source") + srcURLstr := getHeaders(requestHeaders, isCopySource) + if srcURLstr != "" { + srcURL, err := url.Parse(srcURLstr) + if err != nil { + return false + } + modifiedURL := modifyURL(srcURL) + setHeaders(requestHeaders, isCopySource, 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_" + + isContentType := getHeaderMatchPredicate("Content-Type") + + contentTypeRequest := getHeaders(requestHeaders, isContentType) + contentTypeCassette := getHeaders(cassetteHeaders, isContentType) + if !(strings.HasPrefix(contentTypeRequest, ctPrefixBatch) && + strings.HasPrefix(contentTypeCassette, ctPrefixBatch)) { + return false + } + + deleteHeaders(requestHeaders, isContentType) + deleteHeaders(cassetteHeaders, isContentType) + } + + 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 nonexisting resources + cli := getBasicClient(c) + rec := cli.appendRecorder(c) + defer rec.Stop() + + // XML response + blobCli := cli.GetBlobService() + cnt := blobCli.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.RequestID, chk.Not(chk.Equals), "") + c.Assert(v.Date, chk.Not(chk.Equals), "") + c.Assert(v.APIVersion, chk.Not(chk.Equals), "") + + // JSON response + tableCli := cli.GetTableService() + table := tableCli.GetTableReference(tableName(c)) + err = table.Delete(30, 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, "ResourceNotFound") + c.Assert(v.RequestID, chk.Not(chk.Equals), "") + c.Assert(v.Date, chk.Not(chk.Equals), "") + c.Assert(v.APIVersion, 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 new file mode 100644 index 000000000..c2c9c055b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go @@ -0,0 +1,453 @@ +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) + for i := range out.Blobs { + out.Blobs[i].Container = c + } + 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 new file mode 100644 index 000000000..e7317473c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/container_test.go @@ -0,0 +1,554 @@ +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 _, b := range resp.Blobs { + seen = append(seen, b.Name) + c.Assert(b.Container, chk.Equals, cnt) + } + + 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 new file mode 100644 index 000000000..f14342618 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go @@ -0,0 +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 the GetURL 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 the GetURL 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 new file mode 100644 index 000000000..60a50c8b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..57053efd1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go @@ -0,0 +1,224 @@ +package storage + +import ( + "encoding/xml" + "net/http" + "net/url" + "sync" +) + +// 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, + mutex: &sync.Mutex{}, + } +} + +// 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 new file mode 100644 index 000000000..ffe5f25c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..13e947507 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..22f95bd75 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity_test.go @@ -0,0 +1,550 @@ +package storage + +import ( + "encoding/json" + "fmt" + "strings" + "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(strings.Contains(err.Error(), "Etag didn't match"), chk.Equals, true) + + // 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(strings.Contains(err.Error(), "Etag didn't match"), chk.Equals, true) + + // 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 new file mode 100644 index 000000000..27dbdd1fc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go @@ -0,0 +1,462 @@ +package storage + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "sync" +) + +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 + mutex *sync.Mutex +} + +// 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.updateEtagAndLastModified(headers) + f.FileCopyProperties.ID = headers.Get("X-Ms-Copy-Id") + f.FileCopyProperties.Status = headers.Get("X-Ms-Copy-Status") + 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 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 + } + // it's perfectly legal for multiple go routines to call WriteRange + // on the same *File (e.g. concurrently writing non-overlapping ranges) + // so we must take the file mutex before updating our properties. + f.mutex.Lock() + f.updateEtagAndLastModified(headers) + f.mutex.Unlock() + 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 new file mode 100644 index 000000000..4993f302f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..81217bdfa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..415b74018 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..cd4528be7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..3ededcd42 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..ea3e675a0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/message_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..41d832e2b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go @@ -0,0 +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" +) 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 new file mode 100644 index 000000000..468b3868a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go @@ -0,0 +1,191 @@ +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 CreateBlockBlobFromReader for more info on creating blobs. +// +// 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 new file mode 100644 index 000000000..de009cfe0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..c2c7f742c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..dbed7cacd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..19b44941c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go @@ -0,0 +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, + } +} 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 new file mode 100644 index 000000000..eaaf6c6c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlob.yaml @@ -0,0 +1,148 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SG090WhJVyQwKnG4uGAqpRhUdoarskCPM9Qdif+XKYI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C88674D2"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dcc-0001-0009-18b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9xVE3h4gC5cBkjBhsNILU1JPS1JnP24poqE4Yt9+nWg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe/blob/33appendblobsuitetestputappendblob + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8E59F41"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dd0-0001-0009-1ab0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:WtY4UtjKEfOXFj056H2DzKkwYt/y2uI+Lw9fAI8y2oI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8E59F41"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612dd1-0001-0009-1bb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RlkZgPwZSxhRAVIiIERdt9S7hO+vwHJ4hb9p9l4NRmQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dd2-0001-0009-1cb0-01ca46000000 + 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 new file mode 100644 index 000000000..d5e435ead --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlobAppendBlocks.yaml @@ -0,0 +1,341 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:beFu17HY2hWcGvLuGRs9+6f2pmSpZqAl87ViaqbejAU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C890FE4B"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dd4-0001-0009-1eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GrbdWcG/3Szoi5jGHhIIvNcZd9XqIGo57Dspquiuadk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8EDB705"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dd6-0001-0009-1fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:HjxCSD8uk4ABhtv57Bufa1NLF94i/3YWdYkS2IPQQbk= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8EF3DE7"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612dd8-0001-0009-21b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:c7IaA0dgWHn2eBWJrCHwcxvHAWsUBgafE39LVT11yd8= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8EF3DE7"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612dd9-0001-0009-22b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + 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:kqYe2AmOiFbK4TNd98nmpeiBvUeSvQoJ2Ir12V72dnQ= + Content-Length: + - "512" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8F2249E"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612dda-0001-0009-23b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LYdivrAnQs8j8vQr0Z7Loz0llJMiDZ8WCSQ+7g+caVw= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8F2249E"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612ddb-0001-0009-24b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1+EQAh17h1Lea64FEJOjlXFBuLWk15xpVkaiVdIh+GA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ddc-0001-0009-25b0-01ca46000000 + 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 new file mode 100644 index 000000000..421026798 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AuthorizationSuite/Test_allSharedKeys.yaml @@ -0,0 +1,302 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:OzZHjyBdURd4XnnjeNmV1a6eHZON1dHNwnuIIextZJg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-137authorizationsuitetestall?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C89D83FB"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ddd-0001-0009-26b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eOi6xDQa7jIK3zStNE0trtEQzYfzP7pKJiecP4mNOZc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-137authorizationsuitetestall?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ddf-0001-0009-27b0-01ca46000000 + 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:VyGmfpovlo4aAZgyVK0UsMuJCxDx5aUMslNvvZMZ/6c= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 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: + - 875b7d34-0002-0036-21b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:Rmtgvv4EZZRmeQof135rusnVNTui2QF7F5hPkhakDig= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b7d3a-0002-0036-25b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKeyLite golangrocksonazure:s+3Aw0qSAZKp1tRxjPULXWQg3A9fsJLXj5pW0B0LlsA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-237authorizationsuitetestall?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8B444F4"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612de5-0001-0009-2db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKeyLite golangrocksonazure:H9/Kb+3HgZIdKzk8zL7T735iqhdMPwZ27H/IyY8c6TU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-237authorizationsuitetestall?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612deb-0001-0009-32b0-01ca46000000 + 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:IflASiOabU40iodgWdZ4pWyMFKDmRdokoEnV8UHIeJc= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 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: + - 875b7d3b-0002-0036-26b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKeyLite golangrocksonazure:qCzKfKZucx9oXNXSxh9YWqaNoBpsVHLUazqqc+03mXY= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b7d3d-0002-0036-27b0-0102e5000000 + 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 new file mode 100644 index 000000000..6e5c9d195 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlobSASURISuite/TestBlobSASURICorrectness.yaml @@ -0,0 +1,145 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qFrXoSDc+iV3H6nRHRlB4c3hOKZLmLOxJzzBrQgm3LI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C957D263"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e9e-0001-0009-4eb0-01ca46000000 + 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:vveUGDYJVbo6lH70ChXDIpQtM/+J28sWPfXMBOQSM1Q= + Content-Length: + - "100" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9B4859C"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ea0-0001-0009-4fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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=7saT6XpIoyYFSJqzV6abtEcWMcRYOUI3suzPBIOcXEE%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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9B4859C"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612ea2-0001-0009-51b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:q6DVJbMDCnOP2Tzxld1EdyIuH1jmXwcEfneKl90hKj0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ea4-0001-0009-53b0-01ca46000000 + 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 new file mode 100644 index 000000000..46d6a2053 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlob.yaml @@ -0,0 +1,140 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7Ta5OgN4KzvI2Aph7iQ5/7/WyPhPQd67+uk7dUp/av4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C960D4EB"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ea8-0001-0009-57b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rDGqAm7+8+mEzKvfTSKtqebwXRrwzF1u/jWZlsZ2f0g= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9BD87E5"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612eaa-0001-0009-58b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NbDop29fFMH2nP8wTv1E/u39WsRnrPg09GWJiYiPPEs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9BD87E5"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "0" + X-Ms-Request-Id: + - 7d612eac-0001-0009-5ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EJe1ZMGvlqWjP/vTJx7MMhsn+eVCN0CB0BJMLsOTw60= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612eae-0001-0009-5cb0-01ca46000000 + 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 new file mode 100644 index 000000000..773e27f49 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReader.yaml @@ -0,0 +1,374 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eU9sUTEqzJsjYwxiqGQmtRHvHOLX5jla2QGapRQIsvI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9698944"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612eb1-0001-0009-5fb0-01ca46000000 + 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:wEJ9I3344/qdC/tYkH+FYbGY+VqfEOXE0+gXqdANQaQ= + Content-Length: + - "8888" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9C63C00"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612eb3-0001-0009-60b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GPth2THSEC9poZrPXz4gqdlQ39kZcH1uPBXn3gUPYoM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9C63C00"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612eb6-0001-0009-63b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HhFiY3iciM7XCGGmMWDMw/BCy++bFGklA9CohI19Dys= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612eb9-0001-0009-66b0-01ca46000000 + 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 new file mode 100644 index 000000000..60a3bf594 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestGetBlockList_PutBlockList.yaml @@ -0,0 +1,272 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6k86FFyeA9CSA29hzURkNQyyMhSxiTJURJq9bv+iblg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9721684"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ebd-0001-0009-6ab0-01ca46000000 + 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:T1xX49r5e4UGIjHMx4xV4vzFmsMcXqdZaspAcq6XAzQ= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ec1-0001-0009-6db0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:sVvehTfDpYbLpLnl88qpZK+yQ08iryWDBfMfa+YLdXo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ec5-0001-0009-71b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JbCMZD/A9BHE6jOSn+q4SqEbJ0BM8+AwCWhRjiNVl/s= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ec8-0001-0009-74b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: bG9s + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bjFqd9t4vcQ3E/9STDVSwdATSrUCrrnQl8iHxPGXV+8= + Content-Length: + - "92" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9D2C158"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ec9-0001-0009-75b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GuHPPAlzlUR7uVNVyEajh7Uu/SEZ5aw0Os1kByIjGTs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9D2C158"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "1024" + X-Ms-Request-Id: + - 7d612eca-0001-0009-76b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:x4cFSiZeJARh8Th1GFGGyT9P1NxodobgxLyKDtr+4YM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ecc-0001-0009-78b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/FrOs4MSQ8Z8gboQSYTis+ln+SvrDA6shIZjz7eeW8I= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ece-0001-0009-7ab0-01ca46000000 + 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 new file mode 100644 index 000000000..32dc430a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlock.yaml @@ -0,0 +1,110 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SjDrtrnC27Y8ETYeFIiBPvAdK+p3lUxNswaO+d9SbeY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C97FADD8"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ed0-0001-0009-7cb0-01ca46000000 + 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:0lm4gND0vWL+Gx+IKeUNo0DFS2BQFmoQDltK8uhvFCw= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ed3-0001-0009-7eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wgGkAGuYEkIASGDfiePPGbcYv7H70u1Wv+37OkfhOGU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ed5-0001-0009-80b0-01ca46000000 + 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/TestPutBlockWithLengthUsingLimitReader.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlockWithLengthUsingLimitReader.yaml new file mode 100644 index 000000000..553a1530e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlockWithLengthUsingLimitReader.yaml @@ -0,0 +1,101 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FIcZtUbULA8fE5CmkoaW33GCPQW1MwoBTJq/+YjD1sk= + User-Agent: + - Go/go1.8.3 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Fri, 28 Jul 2017 22:46:50 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53blockblobsuitetestputblock?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Fri, 28 Jul 2017 22:46:49 GMT + Etag: + - '"0x8D4D60A8919817B"' + Last-Modified: + - Fri, 28 Jul 2017 22:46:50 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 36facf81-0001-00a7-24f3-076d37000000 + 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, dapi + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3ReHF2C9N8W7jNATKW7fh7++oO8buWUDGZUhUKySRDU= + Content-Length: + - "256" + User-Agent: + - Go/go1.8.3 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Fri, 28 Jul 2017 22:46:50 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53blockblobsuitetestputblock/blob/53blockblobsuitetestputblockwithlengthusinglimitreader?blockid=0000&comp=block + method: PUT + response: + body: "" + headers: + Content-Md5: + - jaHQUBZ1PVeS/42MY6S64Q== + Date: + - Fri, 28 Jul 2017 22:46:49 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 36facf90-0001-00a7-2ef3-076d37000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B2hVRHg94wX3A9JGambw0VCy3deB73Dq5u7zGkDHon0= + User-Agent: + - Go/go1.8.3 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Fri, 28 Jul 2017 22:46:50 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53blockblobsuitetestputblock?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Fri, 28 Jul 2017 22:46:49 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 36facfa2-0001-00a7-3ef3-076d37000000 + 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 new file mode 100644 index 000000000..1e944bb46 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutEmptyBlockBlob.yaml @@ -0,0 +1,152 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XC6tfbcMYZulsChx5iHILAB2TVr7oTnQhWOiQDHATGw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:55 GMT + Etag: + - '"0x8D4CFC7C9863EE5"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ed8-0001-0009-03b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fuz+19bJ5b1r1oY4GaDVcqGD8RATfI081I4EKIxPzeg= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:55 GMT + Etag: + - '"0x8D4CFC7C9E2F0DB"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612edb-0001-0009-05b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TNvsTEDV0VQSMXUfuC5MFWeOlxNaR4XCSBYYHvIP0Ps= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:55 GMT + Etag: + - '"0x8D4CFC7C9E2F0DB"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612edd-0001-0009-07b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lSll7DkULNKYjRyPXDJRXcqgBDLpdapC+wU/RNd4hpY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ee0-0001-0009-0ab0-01ca46000000 + 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 new file mode 100644 index 000000000..69a7104c2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestContainerExists.yaml @@ -0,0 +1,128 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DIo7xJY1ZzNbrmyX1TM36MDmixKzkDEVtIc7/i70oe4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-134containersuitetestcontain?restype=container + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ae-0001-0009-30b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Cjy5Rd/Nh+xL68wCxsKa0TN7LmZQMiSd9+04k8ivvpc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDCC90E3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130b1-0001-0009-32b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zECm6ZSUCeVy2I1K2JJr+wLGOJiaoj47oEXIqEufBgw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDCC90E3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 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: + - 7d6130b4-0001-0009-34b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CwxdH6a6YFGl1ZwIb4fxPhNSyPFFWph3d3czikyiAMk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130b6-0001-0009-36b0-01ca46000000 + 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 new file mode 100644 index 000000000..71fdd7db2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerDeleteContainer.yaml @@ -0,0 +1,64 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ljooR7LImc5WQBJDLa+N1xN034+NlAFE3gHv4jwBAkw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49containersuitetestcreateco?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDD2858B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130bb-0001-0009-3bb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lbrJpVloeJSxylJiXhV5LUxxY3iLgup6HB1EIOTsyVQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49containersuitetestcreateco?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130bd-0001-0009-3cb0-01ca46000000 + 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 new file mode 100644 index 000000000..14fe7e6e3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfExists.yaml @@ -0,0 +1,36 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eWrklKxNeVrX7QxJyMnyI4oqVzwUTrEFBxLr7+4AoDE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x37\x64\x36\x31\x33\x30\x63\x31\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x33\x66\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x32\x2E\x35\x30\x34\x30\x34\x33\x35\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130c1-0001-0009-3fb0-01ca46000000 + 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 new file mode 100644 index 000000000..e60ac36c0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfNotExists.yaml @@ -0,0 +1,64 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:s8bnkl/2XprzAPW4LBQFuPgITRj48kbjHpUT2rfREmA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45containersuitetestcreateco?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDDC99BC"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130c9-0001-0009-45b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BC/NJeuEnyr0tRZ5wiQuFHG48DWJTJjo4PPYeNQrg1o= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45containersuitetestcreateco?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130cb-0001-0009-46b0-01ca46000000 + 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 new file mode 100644 index 000000000..ad777eed7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestDeleteContainerIfExists.yaml @@ -0,0 +1,124 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8xtEZVLqz/I20fkXYQ2lnqHPzuI/pnMY8FMy6+6ROek= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-142containersuitetestdeletec?restype=container + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130cc-0001-0009-47b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:61G/KYbr9qVbNc18ejvkaXx3YytLBpDf/CpdHDqePjE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x37\x64\x36\x31\x33\x30\x63\x65\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x34\x38\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x32\x2E\x35\x37\x30\x30\x39\x36\x34\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ce-0001-0009-48b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PNECJ0qO370tEDttU1AvwqacHp2xgpHBxjU+pK8SV/k= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-242containersuitetestdeletec?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDE3EE3C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130cf-0001-0009-49b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yAfY+UNN5+1luQd0dYRg9T7z5tK9VEZx8iyp152S7n0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-242containersuitetestdeletec?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130d1-0001-0009-4ab0-01ca46000000 + 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 new file mode 100644 index 000000000..d78b91209 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsPagination.yaml @@ -0,0 +1,354 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0zD6u3EEWn038NVMgGElhN6blOjXuPKkFcDgYqwKdRc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDE8F858"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130d2-0001-0009-4bb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NCWL4NmjhKj1lXVY4TRDDAbes2DUdJbmWcl87FhUmK8= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE456435"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130d4-0001-0009-4cb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:us45IJy9ydXR2+xATNsVyBz1NHsZlG45+DCK/M7pFi4= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE471231"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130d6-0001-0009-4eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NQzBuyidorW8QJCuZJbidFKB5lTEeCVnwGnwcEJhSfg= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE4A9545"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130d9-0001-0009-51b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dHiREVjPqOUC2mnoOIbKo8n9JwD/qKJUEEY96WJzPrY= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE4C6A5C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130da-0001-0009-52b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:n7isxxYGMw9TbDwvmCsJs/k1BgFMsVuFlLFX9clqvqQ= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE4E3F67"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130de-0001-0009-56b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:i+ryxAdVVaB7KBx+m92wNqHV+BdJjdUs94G/iwHkOBE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x34\x35\x36\x34\x33\x35\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\x74\x72\x75\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x34\x37\x31\x32\x33\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130df-0001-0009-57b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:z1txIWGlsQs5n8IioEkZ5ujOw8dNln2CmtnvsoR5MI4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x34\x41\x39\x35\x34\x35\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\x74\x72\x75\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x34\x43\x36\x41\x35\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e0-0001-0009-58b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ipncg+sKo+Z+K+bgfRs4qyZUT6Q8nLe+Z3JEDok6ya0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x34\x45\x33\x46\x36\x37\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e2-0001-0009-5ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:omuZ+zjm0QwnfHSEi4xBBroqlkctmGSFXmW8JMLb4NU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e3-0001-0009-5bb0-01ca46000000 + 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 new file mode 100644 index 000000000..2a1f0e282 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsTraversal.yaml @@ -0,0 +1,414 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mFvbPPtlxCNYZBoDRHvgQFNSix1ZR2ojhoCUm226b0E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CDFCF99D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e4-0001-0009-5cb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Vma3iqx4ieg3lpgUz4MS/VW9SvpQYV21AtenjOnck7g= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE598C0C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e6-0001-0009-5db0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0tUD4UtsVl65lwBMzYldVgX26+CR6pMQQ1dofC0zwRg= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE5B12ED"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e7-0001-0009-5eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9zHscMDnFGABDNeJF/K8X+ZN5w1/SkjUkL+yILiUL1k= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE5DD28E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130e9-0001-0009-60b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9nPkMm5DCiu/RmJbV1bSKnYpVJ+uoonG4euVBybG7PQ= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE5F5973"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ea-0001-0009-61b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kaz9PuWlhHUJga7jYVEyYDnTr/tIcfALXiDsbF0YD1o= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE612E86"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130eb-0001-0009-62b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hAUCHq3ZrWuyDk1dQKt3p+9KCxDtyKjMnEpjqQ59tWM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ed-0001-0009-64b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:I5d11QeJZ2QZjuxWR+cVqpNBEc6pOSHp8QX9FoGRNDQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x35\x46\x35\x39\x37\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ee-0001-0009-65b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fsUz9uLiVHBaT5wc3U4tS4Lf1lcwfPgjwJ+/8YogTaw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x36\x31\x32\x45\x38\x36\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ef-0001-0009-66b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EC/wuLQDHVFf3LjV6E2JZTrCX0vYUPpKHIeptZMWIj8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130f0-0001-0009-67b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ktmFpJaDmiSNn2LGV6wpJbshqKNJDCYCy97sauTRakw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x35\x42\x31\x32\x45\x44\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\x74\x72\x75\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x35\x39\x38\x43\x30\x43\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130f2-0001-0009-69b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0npJtUjiZQheCECoa77Xn6DLe/2dNnNWNYf8syoYafc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130f3-0001-0009-6ab0-01ca46000000 + 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 new file mode 100644 index 000000000..6b13c65f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsWithMetadata.yaml @@ -0,0 +1,598 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wYYyoeuJX/GsY475TnbRYi9oQGZZGalA6+Df1xruA7s= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE16EF8E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130fa-0001-0009-6db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:m/EhM3mL3fUer3sYoguXC09Nx0k59tDVXrY2YFFN96w= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE738146"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130fc-0001-0009-6eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/yEYzOcoB5eWRQJ1C8mXj4JbbYb1uDlCunK32QUGvDE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE752F46"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130fd-0001-0009-6fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wyeksXKIql/EiNvUB1y/aPOGSyoGstQBYRyX2B8l7W4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE76DD3E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130fe-0001-0009-70b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:34:03.5420478Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3vsKs8KVpfoYxIN5vF0H9MI+J+jE6B6f9LAorcb9bsw= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE788B36"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6130ff-0001-0009-71b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kKnOEPp31Fn3oJvlL01nbvQ9x48Y9jnThJEv5fmoWiM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE7A121B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613100-0001-0009-72b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UplQinC1XxnekvEhOfjxsyjrZdsfYxg+Er9GFnX07ak= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE7B9901"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613101-0001-0009-73b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:34:03.5730689Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KpleWmcSoMvd0rjVXDQ1jU9FdDodTwjqR2kw06dVVJA= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE7D6E14"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613103-0001-0009-74b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4cloJnojw+OiymusuRKCqhf4qyzRaSzuVPxKLZa2GfQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE81183E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613104-0001-0009-75b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NbPjJk5+PrEinaNoJ5Cuidzn3uzQOELwSrcCucNouww= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE831468"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613105-0001-0009-76b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:34:03.6221032Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dFr4SojaT4Zhtg/eFiwqQM70sN5fsnwdQjb0kcyzer4= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE84C265"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613106-0001-0009-77b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NgrB3zRgFV54t3f9jY79Kt7cB+zLEWtBdNk5bRi+9Hs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE86494A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613107-0001-0009-78b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CvHO/ws7uVEJz+NO3hZJov+LiWgCRciHYT+EvNTt0CU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE87F742"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613109-0001-0009-7ab0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:34:03.6541250Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZDWK227lH/ljPswukQy6YebbpouqSB+HL0H7/c4uwcc= + Content-Length: + - "13" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE89A542"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61310b-0001-0009-7cb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zgJbQY9h4WCekkTNf6Jj2Tffp02bpw4ufCkFZGlcq4k= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x33\x2E\x35\x34\x32\x30\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x37\x36\x44\x44\x33\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x37\x35\x32\x46\x34\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x33\x2E\x35\x37\x33\x30\x36\x38\x39\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x37\x42\x39\x39\x30\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\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x37\x41\x31\x32\x31\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x33\x2E\x36\x32\x32\x31\x30\x33\x32\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x38\x33\x31\x34\x36\x38\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x38\x31\x31\x38\x33\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x33\x2E\x36\x35\x34\x31\x32\x35\x30\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x38\x37\x46\x37\x34\x32\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x38\x36\x34\x39\x34\x41\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\x74\x72\x75\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\x42\x41\x5A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x42\x41\x5A\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x38\x39\x41\x35\x34\x32\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\x74\x72\x75\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61310d-0001-0009-7eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PYgTLNiAI6ewMaOhOyUOVHgHGyjoWYe2uI2L2bwGTx4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61310f-0001-0009-80b0-01ca46000000 + 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 new file mode 100644 index 000000000..9f61fea29 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListContainersPagination.yaml @@ -0,0 +1,394 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lWfb07+AnZ4xiqQOTG2T6+DyKL9z+tx95cuEOha82sY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-043containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE38AF47"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613114-0001-0009-05b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yqi4UgPgIESHJa65e/5eq3HSkMjARZAFxLcvqRpkJJg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-143containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE3AF9B0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613117-0001-0009-07b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kGzlIm4tFlyBE3cIa4Ye9Qm9YDlxbhocFyhZ6E8N5NI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-243containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE3C80A0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613119-0001-0009-08b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:l+62OjN5/AKK9C0suEwMQfX120mE6uHS18YZWhi5EQA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-343containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE3E2EA8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61311c-0001-0009-0ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LbycXy+7nQ5zwTD9T+AuIHBs3xgLT1PNUqQpEAK8vkk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-443containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Etag: + - '"0x8D4CFC7CE4003DD"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61311e-0001-0009-0bb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2dsNbfGgJ9EoIgVL7vPwz3km/zU3zx/1ODTVXjNbKLw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x33\x38\x41\x46\x34\x37\"\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x33\x41\x46\x39\x42\x30\"\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613121-0001-0009-0db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SbsopwtHMiegOsLgwfLQB4ouQRFt+oz1RAEhK0v3wVE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x33\x43\x38\x30\x41\x30\"\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x33\x45\x32\x45\x41\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\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613122-0001-0009-0eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UR1EQqz84oR/H14BhxPAhGQDH+u3QnwV3vwfopG0ZUs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x33\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\x43\x46\x43\x37\x43\x45\x34\x30\x30\x33\x44\x44\"\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: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613123-0001-0009-0fb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lQYdwz584dqYoVCwThCUkFxNnzyMefiwn8CiCg/wFAI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-443containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613124-0001-0009-10b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+NYcW2vobi6EjkOxFtcuP4zKyelGMmYB+3Lroz5zsuE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-343containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613125-0001-0009-11b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0C32lydCCh26dI753mCjUyVGf5eWWxuOF2UgQdDrgBk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-243containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613127-0001-0009-13b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3gW7e1lucY8i+FWDDDTrNN+TdvUCR1cuFCjCapCnA3s= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-143containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613128-0001-0009-14b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:u0Ae5Bw+RQeg7PIMZH2q6f9KNaII4tUdsaD7wuiMKS8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-043containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61312a-0001-0009-16b0-01ca46000000 + 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 new file mode 100644 index 000000000..6750414e5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsOnlySuccessfully.yaml @@ -0,0 +1,100 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xwW9Yl+jCjK7Bq7wUXzzs7z1qkn/W/m69F7JljlREHU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE4EACC8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61312b-0001-0009-17b0-01ca46000000 + 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:1WYq6akw3g2PxZDCz94w/ETr7y7uENNQOERZdtshqH4= + Content-Length: + - "232" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:03 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEDE694B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61312d-0001-0009-18b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ScwoOpkGiKh/d+DWzbhvBm1UVd91aU0hN+pBwozPL7w= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613132-0001-0009-1db0-01ca46000000 + 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 new file mode 100644 index 000000000..dcc66a988 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsSuccessfully.yaml @@ -0,0 +1,100 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:w3zCmpiXsnAtfRi1DN2Ovmvg/BlGB7RHEm5OuGn3dh0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE5F5201"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613133-0001-0009-1eb0-01ca46000000 + 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:y/ergJbuJASc3GqZbhdR2t65YgE3m6t+HpN+BlgXmTk= + Content-Length: + - "232" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEE5485F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613138-0001-0009-20b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ryM+7DiXwHc69MMlTVdjIlciGoniauPg2K+HY2wjfIQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613139-0001-0009-21b0-01ca46000000 + 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 new file mode 100644 index 000000000..66c4d00e9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsWithTimeoutSuccessfully.yaml @@ -0,0 +1,100 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:di8lwPEbTZ45atEteWsZ8n4fUggDkyBthUMfq7Kpmvk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE651F91"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61313b-0001-0009-23b0-01ca46000000 + 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:mDAnQr9HmsAfaAfsSeFK1NDtVnfKyGxE3WSscOZxoLo= + Content-Length: + - "232" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEEB3CE0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61313e-0001-0009-25b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pe5Qr250sLsC+q3DW5EtP77J8gZT1sNNF7QfXTyIA4I= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61313f-0001-0009-26b0-01ca46000000 + 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 new file mode 100644 index 000000000..8ba9a81c2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsOnlySuccessfully.yaml @@ -0,0 +1,136 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GV/fdm0f6q1kCSRK4kpqQMxbk/whZef+Q0fcuhhH+eA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE6B3B52"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613141-0001-0009-28b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:iuHZLVzOBNUfZ2RdNCysL7ukpE+XdZFvKSUh2Dypeuk= + Content-Length: + - "39" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEF1316A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613143-0001-0009-29b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8E3WY9MEIGNEQ+Aub+VQ443bRT+xbZ4uSJ3JPHB6148= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEF1316A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Public-Access: + - blob + X-Ms-Request-Id: + - 7d613144-0001-0009-2ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZG1cOUtW99fbadqswzk1FvJKOIiLpkETeUzYTT9zXK4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613147-0001-0009-2db0-01ca46000000 + 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 new file mode 100644 index 000000000..db33923fe --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsSuccessfully.yaml @@ -0,0 +1,136 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Mtj+R4Ckw8JZEVYWC90vvqKKG8BwxCQXgunDgOIIrMg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE75EBE2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61314a-0001-0009-2fb0-01ca46000000 + 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:DZCaX3tsteRAyWCEEJvEq178Q/Qb6XjZEAt/PwfcqHc= + Content-Length: + - "424" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEFBE1B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61314c-0001-0009-30b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:p/5wgteu9gf6wLuDYRbU9v0giyxBaA2Pdh5IJXHydps= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEFBE1B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Public-Access: + - blob + X-Ms-Request-Id: + - 7d61314e-0001-0009-32b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yJ3UHkxdTIwQzc5ZDNFinb/56WzxWPrbq2SeH4VDc0g= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61314f-0001-0009-33b0-01ca46000000 + 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 new file mode 100644 index 000000000..0187a7f58 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestAbortBlobCopy.yaml @@ -0,0 +1,274 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZXis6DaX4/CQJUW2gsXztNWUdi+G4gdTeX1WdhN/xEU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE7DDCC2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613150-0001-0009-34b0-01ca46000000 + 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:nbRc/oC/O+hFFelyZKIJl7fGeAN886bXdys4oi7E0VI= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEDA92B6"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613152-0001-0009-35b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VXT4ATNMwbtPEA9Mt35d2Idg9TIDMjgKVSgvxIiymgg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-copy-source: + - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEDC8EE4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 22a6f9de-ebd3-47d3-9bf8-6168d9b93adb + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 7d613153-0001-0009-36b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ecECsDVwKacz3MBUWrlurHlRI7p6MgLybLLnVqrX8UQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEDC8EE4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Copy-Completion-Time: + - Thu, 20 Jul 2017 23:34:03 GMT + X-Ms-Copy-Id: + - 22a6f9de-ebd3-47d3-9bf8-6168d9b93adb + 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: + - 7d613154-0001-0009-37b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0pIWSN7uwcobNu6dUjZwdQ6MK0cnJMYlA7Wgn/1ZXdc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-copy-action: + - abort + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy?comp=copy©id=22a6f9de-ebd3-47d3-9bf8-6168d9b93adb + 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\x37\x64\x36\x31\x33\x31\x35\x35\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x33\x38\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x33\x2E\x36\x37\x33\x39\x37\x39\x35\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: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613155-0001-0009-38b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 409 There is currently no pending copy operation. + code: 409 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RUHs2H6RV0xmLIfBOHEZvySE6ucd3rxlDowZOuXHzSg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613156-0001-0009-39b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:q1e4BVjvle4BWSZa0lnaJ2Mya1LTzD/6aqJ8fIwkFfA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613157-0001-0009-3ab0-01ca46000000 + 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 new file mode 100644 index 000000000..c63438849 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestBlobCopy.yaml @@ -0,0 +1,338 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eHDMEsHglaETeL/j0fsSu2YjKFJccQw3t0V2MB1Gl7g= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CE90CC63"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613158-0001-0009-3bb0-01ca46000000 + 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:VQCiLR34KzTA0Qm8b5GP0y0oSih+VtgiODtexC9FDkI= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEED81D5"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61315b-0001-0009-3db0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:uHionnufhFkjQXG3A6hgM+BczlxnhJOPxhCxg4zfzzs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-copy-source: + - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEF104E0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 9d10d88a-a47f-4ecd-a554-fe569787c348 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 7d61315c-0001-0009-3eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+s1kEcOCTMK+wjnbLMBfdroTv136GeLYw0KFxVXkAAI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEF104E0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Copy-Completion-Time: + - Thu, 20 Jul 2017 23:34:03 GMT + X-Ms-Copy-Id: + - 9d10d88a-a47f-4ecd-a554-fe569787c348 + 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: + - 7d61315d-0001-0009-3fb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nOIuPvp9Kux7FtjJLGAmyQBz+9YKh1BAx7vW5NKA61Y= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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: + - Thu, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEF104E0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Copy-Completion-Time: + - Thu, 20 Jul 2017 23:34:03 GMT + X-Ms-Copy-Id: + - 9d10d88a-a47f-4ecd-a554-fe569787c348 + 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: + - 7d61315e-0001-0009-40b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L6OzS37rG2m1cZIYycgphr5+oYo8S2XiXbgVR7GzWog= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61315f-0001-0009-41b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TUp18AWqHtZ5t/PeYNMc7TE0FuaTilWuzhJLGleV1x8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613160-0001-0009-42b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CkkbtBgzQyqVEty0B3epGRZm6ZQqtLSqaKUdNaFxUec= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613161-0001-0009-43b0-01ca46000000 + 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 new file mode 100644 index 000000000..559e9602b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobNoTimeout.yaml @@ -0,0 +1,178 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:brDiGzRZV1pQZ36JrnPGbcb/7vcmf4yLINNYHqfQTCs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEA0AE24"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613162-0001-0009-44b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nmqg4Bzufr7p+4QhevpuzHwiwmEhE3n5iGvBD6eGItU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEFD14F8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613165-0001-0009-46b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:e0imCXoNW0IwVMZnylJoJiud1fpn+P/hBIki6F2PKR4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEFD14F8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613166-0001-0009-47b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:34:04.4336655Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8269W24WbPClDcjpAN++B8BEvDFS5+UojO5BditQm3M= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-copy-source: + - https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout?snapshot=2017-07-20T23:34:04.4336655Z + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CF38F00F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 1bdc758b-82db-4f88-a165-a088fa830f29 + X-Ms-Copy-Status: + - pending + X-Ms-Request-Id: + - 7d613167-0001-0009-48b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gs2HvFGQ9vpvMHDME6WYAK+5mj5pZnz7wrD9CCk+Ynw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613187-0001-0009-61b0-01ca46000000 + 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 new file mode 100644 index 000000000..0f2a5cd96 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobWithTimeout.yaml @@ -0,0 +1,178 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oxKuFpuLlrGp0xypMJ5XgidXh7huFueR99Odhz8fLVg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-public-access: + - blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CEE42D97"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61318b-0001-0009-64b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ev1WQw1MAYDa1a7jn2YbHGClpFxJ1Fg59YoOTvF2SQk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:03 GMT + Etag: + - '"0x8D4CFC7CF40E0B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61318e-0001-0009-66b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dt2BsuUEhl/Ivs/fLRMgDdh1vI4RNOw5ZCMmRMMy0Yc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CF40E0B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61318f-0001-0009-67b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:34:04.8769720Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GQ3DH7p1l5zsPjVZCMtPrX7GMYzFICpcpTF850VE8tg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-copy-source: + - https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout?snapshot=2017-07-20T23:34:04.8769720Z + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CF44D910"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 73451673-d51a-4c34-89f5-e3a60e57cff1 + X-Ms-Copy-Status: + - pending + X-Ms-Request-Id: + - 7d613191-0001-0009-69b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:A4LpeSYico7jkkKS6+1c+hsya1ei7kwpkoxcWLss4kU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 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, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613193-0001-0009-6bb0-01ca46000000 + 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 new file mode 100644 index 000000000..363d3370a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestStartBlobCopy.yaml @@ -0,0 +1,182 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Eznb11WxpN8BbjZhtbOvoqT1ZqEASGd0REPwIMhZDig= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:04 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CEEF2C57"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613194-0001-0009-6cb0-01ca46000000 + 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:M4xc/6abvTHYgp2lQlV+GiqwQnpAnNb6PIgLnYYig9Y= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CF4B9101"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61319a-0001-0009-71b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pG3ACGobUWPtUlvPLarAcBSUhn2tr7PIpusy2gR0ZYI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-copy-source: + - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/dst31copyblobsuiteteststartblobcopy + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CF4E026F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - d36298e0-d277-4a23-8b42-80bfd9cc515a + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 7d61319e-0001-0009-75b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fqJ7hiEywYSMTbeSK8kprZVRFAQAFVheS5h92Rn62Ug= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6131a0-0001-0009-77b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3t03Xyd9J962VwWR+fpXSZpnFIo3ifISARsAulHFjYo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6131a1-0001-0009-78b0-01ca46000000 + 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 new file mode 100644 index 000000000..026b01141 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireInfiniteLease.yaml @@ -0,0 +1,144 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qa+NkzBJtQv7DxWurttMB69vUnYtB7LAvsFuX8zphag= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0814240"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613227-0001-0009-6eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YkJduVype+IGMPpxoER+Tni9aR0gvHnHvFja5uvebR8= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0DE3829"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613229-0001-0009-6fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1s7c96rOPm1OSca9L6ndgGNZYws6wGMZ2OspVthlhD8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0DE3829"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d61322a-0001-0009-70b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zaCsxQ8QK7m6ReKvvOLnXJRcU2o/h06cPHVnFEpDa08= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61322b-0001-0009-71b0-01ca46000000 + 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 new file mode 100644 index 000000000..970c95d07 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithBadProposedLeaseID.yaml @@ -0,0 +1,142 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:d2koi5lJ/+VtkHbfQHXW4b/bOrN4ndjCaPybROGEpK8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D089F698"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61322c-0001-0009-72b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9JmOq6aN96nNpuuCmIH2VhQdpzdFaKCZdDmPIV10HNs= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0E67704"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61322e-0001-0009-73b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5vQ+lOEL6XcoZMXuUgKzw/9r3HWAHkPGNjWIOltLCQg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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\x37\x64\x36\x31\x33\x32\x32\x66\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x37\x34\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x37\x2E\x30\x34\x34\x36\x37\x36\x35\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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61322f-0001-0009-74b0-01ca46000000 + 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:2msiZ5cw1jPZY6CjM7ArXsFwTJOQKj+94X0yzxbCsns= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613230-0001-0009-75b0-01ca46000000 + 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 new file mode 100644 index 000000000..e8ef775df --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithNoProposedLeaseID.yaml @@ -0,0 +1,142 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BYrk074DvQczP1WrfNmD+0VLKxAvCqEEsgy7suj1e6s= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D091E77D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613231-0001-0009-76b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qvENWQ3NhNiHqLB2rcT3b1A9ukDobUSa42zNx6YqEVk= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0EE67A8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613233-0001-0009-77b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mRmsL0/9j5LbXJEygBN/sy+MYCz7g9jq+4SUf33x0To= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34: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-52leaseblobsuitetestacquirel/blob/52leaseblobsuitetestacquireleasewithnoproposedleaseid?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0EE67A8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - 6a773895-63d2-4d3b-a64b-5174f4fd58b1 + X-Ms-Request-Id: + - 7d613234-0001-0009-78b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:u09lrSvWlhQFp7ZrndF5KbPH0e0mw2EfGY9jvMN+z18= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613235-0001-0009-79b0-01ca46000000 + 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 new file mode 100644 index 000000000..67f4b2704 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithProposedLeaseID.yaml @@ -0,0 +1,144 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:P7lU9cCuUDDE/FDeNrlpU11glVwpVksAAq/JfYh3sF4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D09A74B9"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613236-0001-0009-7ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:OAUn5nunGqLliikeMERe5ikWa4lb/HX5SkVlSvAeZYQ= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0F6F4B0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613239-0001-0009-7cb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QzN+uow+JDyH4Ci2Pfrb7PPO8bghQWOMhJtRhRnD19o= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0F6F4B0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d61323a-0001-0009-7db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TiRg3+IwEBTDczQk0sbhm5jtA9RnGIKACvJzRXETH0c= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61323b-0001-0009-7eb0-01ca46000000 + 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 new file mode 100644 index 000000000..76949ef08 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestBreakLeaseSuccessful.yaml @@ -0,0 +1,180 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZmhVnsUYAMryZI26oTcgY03aCd3ED2Ft+YrKVA1fgV0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0A2B3C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61323d-0001-0009-80b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PlxtEVlcZfFTSd1IzmyJM5Ec1CZeuAZpKqPxUqRbjNY= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0FF3382"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61323f-0001-0009-01b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ex6mGkHnZFQxNmK89UCw/DPirdajvGPP+U5z0I3rtnE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0FF3382"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d613241-0001-0009-03b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8zLJLAbxwL5ZnDCB4im30NuNLBBnPp9tDZUzwPJlsjA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0FF3382"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Time: + - "29" + X-Ms-Request-Id: + - 7d613242-0001-0009-04b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L7bt2IiNNOaxrarxbdV8RPTHtsLtvjqgyuP2cmGgfic= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613243-0001-0009-05b0-01ca46000000 + 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 new file mode 100644 index 000000000..391baa761 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseNotSuccessfulbadProposedLeaseID.yaml @@ -0,0 +1,182 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vOSIw7uIQahGhsChMPrh4uaNrkxmss+ss5JXzbIqPpU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0AC52B2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613245-0001-0009-07b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FmuEVtTgDZtj/8bqwichXNIh+BIfVgP0MQA2S7+Dv0w= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D108D22A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613249-0001-0009-0ab0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:o4C81oVPZ9APU1K+qXMwee18LpEnW7mSJQEhfkGcjP0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D108D22A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d61324b-0001-0009-0cb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:S6lUX7kgVUgQxk62sVP+AaLKwGVMOCgeSllKiJ8/4so= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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\x37\x64\x36\x31\x33\x32\x34\x63\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x30\x64\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x37\x2E\x32\x37\x39\x38\x36\x34\x32\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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61324c-0001-0009-0db0-01ca46000000 + 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:ZLFttOf0qNIEq5KSzAKIDBX93lCaxLv/QbZHMyG0GPc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61324d-0001-0009-0eb0-01ca46000000 + 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 new file mode 100644 index 000000000..9ca49866f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseSuccessful.yaml @@ -0,0 +1,184 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+aMHMi7CYG477J5NlUkNYVS6zPD1on8q78Rhwo3SzMI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D0B5A36A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61324e-0001-0009-0fb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cpnFwW5/JXotYFt52d5PkUpJX8AVJ/2uLHlMu09E/RQ= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D112229D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613252-0001-0009-12b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6OeXzRg5oSk1Dl6ZvKs6HJvBrIkY35Hf4dgtPC8H/vg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D112229D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d613257-0001-0009-17b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GC6KlYm4Aah1NWx4N34L7GW65CbPWV77Rp9WZmFOlC8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D112229D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fbb + X-Ms-Request-Id: + - 7d61325a-0001-0009-1ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B++lS/ge8V7/jRXS9jSPAeCmzAoNaxOQ32F1oJhCDr0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61325c-0001-0009-1cb0-01ca46000000 + 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 new file mode 100644 index 000000000..42de96006 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseNotSuccessfulBadLeaseID.yaml @@ -0,0 +1,180 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pK72z+SH3LJB72r0t5XAyyqCmn6sckrpVIAZ1jyCt34= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D0BEA5F3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61325e-0001-0009-1eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pIlro2WAhY4Dt6NaReSITqnMJyuuyrDEk3lQI889Rbs= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D11AFDD3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613262-0001-0009-21b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zr3CyHKnPHP8dCdMOihyBTyuMQe6aJqciXDAq65z780= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D11AFDD3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d613265-0001-0009-24b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:r17Cjwsw7NLJNXNEqD1rNHumhoKBITZQ7Xr8vyXQqcQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x37\x64\x36\x31\x33\x32\x36\x37\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x32\x36\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x37\x2E\x34\x31\x32\x39\x37\x30\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\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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613267-0001-0009-26b0-01ca46000000 + 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:ogpv6gFzEohSkIXmBeAqqs9olw0gFtcGfCIO6wJN2Mw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613268-0001-0009-27b0-01ca46000000 + 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 new file mode 100644 index 000000000..8aec91be7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseSuccessful.yaml @@ -0,0 +1,180 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MRQup9M+bkWk3L7etSFYvYJr1f0UgCX70eSv74sFKis= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D0C97D9B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61326c-0001-0009-2bb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PxUnAwjgZUvUHSKt/B4TLX8p7Y/Wwbn2dc9sFQSyWkc= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D125FC46"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613271-0001-0009-2fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:r6u/kMYYT6ioKrdTtgCltskroJF7xKfjjbGwymAn70s= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D125FC46"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d613274-0001-0009-32b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HDEbprzAxghqc0YKRL/vm3/ZY3gziHPM8NvNp8+wnCE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D125FC46"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613275-0001-0009-33b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IsiKPlMy+QdvsZLTjJwTDuLxw7crVdnqZoIWAPaA21U= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613276-0001-0009-34b0-01ca46000000 + 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 new file mode 100644 index 000000000..c541563bb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseAgainstNoCurrentLease.yaml @@ -0,0 +1,140 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:p/ca25KAUMVOV8e5wt/bkZ8UtcejQ55UwOuwjgkqQQA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D0D2A73B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613277-0001-0009-35b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CvrTtr8Cijws4baGBrNloHdNSC6TxtFm1QyIJ0DLidE= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D12EFE8E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613279-0001-0009-36b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wATpEGfy5cs+Esjq2moShx/5BiuWLJdhJm1UiG+iPqg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x37\x64\x36\x31\x33\x32\x37\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x33\x38\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x37\x2E\x35\x31\x39\x30\x35\x35\x35\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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61327b-0001-0009-38b0-01ca46000000 + 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:5BE/G56VXiUYc3FskwMJUumfGhvjXuoX3tkOOrLRElo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61327c-0001-0009-39b0-01ca46000000 + 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 new file mode 100644 index 000000000..b1b09ba31 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseSuccessful.yaml @@ -0,0 +1,182 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DS2YuPHupx72v7dKfpYPjhUiFuuNTqdpxiWGX4qZKiU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D0D9AD8C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61327d-0001-0009-3ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:17FRJmvcYKi/+PYe7uX7cqTh5J4gUatp1PVhcFVY1lA= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1362BC4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61327f-0001-0009-3bb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kb2zHNRz/qrICaP9n502PF5TYeAYggnCkvF7KD8Hiqo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1362BC4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d613281-0001-0009-3db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VX0/SbwH/FHm9Ffd0NSrRinlVxBruqvkeAWRK7Ae4gM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1362BC4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 7d613283-0001-0009-3fb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BaYDo8wom1JfKfvpR+3O2FqXPNkS+e6Po7Q8Kr6VvbU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d613284-0001-0009-40b0-01ca46000000 + 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 new file mode 100644 index 000000000..815566ba2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestGetPageRanges.yaml @@ -0,0 +1,454 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cWyuyel7vYJVSVOHnCtYskI4MsMRw9jSpXCmF4BQL6U= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D119348E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d61329e-0001-0009-57b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jog1/HUitmwUUrejKWJTV8iZbpHHu5pk/eb3kLb0qW8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/131pageblobsuitetestgetpageranges + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D175B102"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132a2-0001-0009-59b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yYpXBazf+gdPin1ucfxbrpVVkhOwhtw+cZCDoJl+Xmw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D175B102"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Request-Id: + - 7d6132a4-0001-0009-5ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:E4wltKjVWxfYg75EaP7pT7tsGcMh9/Ewz5sX6kYkiZU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D17897B5"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132a5-0001-0009-5bb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:PeuBGbm0+0j3FUfaKWxWm4v250IOxop7RgYiL7LS/hg= + Content-Length: + - "512" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D17A45B1"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132a6-0001-0009-5cb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9YOE1Q7+aIfzjIP11kyY4z0OHZQuH8FfjRaaHhDxCv0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D17A45B1"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Request-Id: + - 7d6132a7-0001-0009-5db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1qKhrKHM3PsabHR+aZye2vVFecg6ajQL5RK8Urr0Qwg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D17D537C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132a8-0001-0009-5eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:rRMpjndhupcuCjnYJnTKoDmuZ3ABtKJsttebIkNmOIc= + Content-Length: + - "512" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D17FC4EB"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132ac-0001-0009-62b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:AVPieUTUTJcwF9P2w3qWKbkG0nQpJmGtXBCxNv8oJR4= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1814BD0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132ad-0001-0009-63b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eKwPYWQtq7MXon0SrSeoEZRVObM/oxm8eS1ye6hociQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1814BD0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Request-Id: + - 7d6132ae-0001-0009-64b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:P+q5yxUVvaaLVj6HZyCgKjOjMi4IBhT6v+fWJfYmDOE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132af-0001-0009-65b0-01ca46000000 + 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 new file mode 100644 index 000000000..fecdcde16 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPageBlob.yaml @@ -0,0 +1,152 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:AJPuUMRb6sKRJzckXn0+SU1qPX+hwj14Vke3wyJ1Kb8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D12D5CEF"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132b1-0001-0009-67b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:d7PWi1H4BDfoyvi6p5nbk7nn/+PjEUET0kS/FiQiQP0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl/blob/29pageblobsuitetestputpageblob + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D189FFEB"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132b6-0001-0009-6ab0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SVLULhPpi3dxPdbI2DKEEe1pyHAY2CqdINoSBxX1kck= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D189FFEB"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 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: + - 7d6132b7-0001-0009-6bb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:W9iYBKgm6iRV6vE57FZlYcrj09wyatDqmSmvg/rdw+Y= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132b8-0001-0009-6cb0-01ca46000000 + 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 new file mode 100644 index 000000000..c221dfe04 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesClear.yaml @@ -0,0 +1,288 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yPYXP+302vVox+Yq7JiQrd8/FCvG2dRKHt6yCB4S26A= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1368690"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132b9-0001-0009-6db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+v8tWdKRZv/sv6m54V3wNjDoohU2uSNt5UbsWtxvBuY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D193294F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132bb-0001-0009-6eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:DsSNQn0ZhjtL5T5tAUYEjhPylWel6Y3RsVXd33qBFuU= + Content-Length: + - "2048" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D194D747"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132bc-0001-0009-6fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Kt/WsevYB+bnEwLPmqXoelZ0AF+qZfb+aOxgSYq4rsw= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1965E30"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132be-0001-0009-71b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Ifxpmck7bxhzAWgX25vZkK+njpw9IMWiKuWQ0ywuLFY= + Range: + - bytes=0-2047 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1965E30"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 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: + - 7d6132c0-0001-0009-72b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5OYZ7MWPd/XjwmfTnjqU09/rarYo7PHdAPntR0vBaeQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132c1-0001-0009-73b0-01ca46000000 + 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 new file mode 100644 index 000000000..57aebcf14 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesUpdate.yaml @@ -0,0 +1,408 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TNtnEajjV4G6W4TN2Qaob/JFOqdIM5HQEBY4kN9usqQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D14296F8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132c2-0001-0009-74b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Tf7GD+ujgJ0E7a1oKpYUK4qKGY0NV9tH7W1d4PwvyE0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D19F1247"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132c4-0001-0009-75b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:g1GP5Is+ToNz6eWtv3UANUp9MuYNEjsQnMv25mxcnjw= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1A0C048"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132c5-0001-0009-76b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + 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:Jzpdo9+maSE6mIVCGNahQDY/2wmUdmkll2jqhK6Yup8= + Content-Length: + - "512" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1A2472D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132c8-0001-0009-78b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NcrJQabSZwJfbfKZb5kieTPgloOA656cddHW3VTQ7oM= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D1A2472D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 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: + - 7d6132ca-0001-0009-79b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + 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:e4PHV2+Tm7qHgUSoEjNoMDWA+5sQd1ZElMmeOKxxtdc= + Content-Length: + - "512" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - PageBlob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:08 GMT + Etag: + - '"0x8D4CFC7D1A554F3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 7d6132cb-0001-0009-7ab0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NcrJQabSZwJfbfKZb5kieTPgloOA656cddHW3VTQ7oM= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + 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: + - Thu, 20 Jul 2017 23:34:08 GMT + Etag: + - '"0x8D4CFC7D1A554F3"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:08 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: + - 7d6132cc-0001-0009-7bb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:s3/nls5+o59CLZkHJu+1J3WBCRsPOollGemHjIcyI+E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d6132cd-0001-0009-7cb0-01ca46000000 + 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 new file mode 100644 index 000000000..57500ae08 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestBlobExists.yaml @@ -0,0 +1,212 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LtktYx49HQHbREUYbKP9bPqV77mTn9+aeA0Sg+5xRhg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8BCF951"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612def-0001-0009-34b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1eV2X2cZEUsQQRIxBVObkbBjyXxqwztvd13LIMgT7Gs= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C91989B5"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612df2-0001-0009-36b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dxTwnd8FjmbCJDNIPgKpjFgT+BRJoNt3itQoPP8b+Qk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C91989B5"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612df4-0001-0009-38b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6+UfYBojLQg2g4XkmpIUFvkfDRJJRs115pOKFcMRegk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612df5-0001-0009-39b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nJB/KDLz9UAWcnlc+cdq9o5eb9MWZESWZU/tnC0JBVc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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\x37\x64\x36\x31\x32\x64\x66\x36\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x33\x61\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x33\x2E\x39\x37\x37\x32\x32\x32\x31\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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612df6-0001-0009-3ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aNL0oLtjGb31Mt0c2jt/+C337VPutveoW0py08Zx26U= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612df7-0001-0009-3bb0-01ca46000000 + 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 new file mode 100644 index 000000000..e913e849b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobIfExists.yaml @@ -0,0 +1,128 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DSnXI458eNOj/0d5aze21bK/s5zPSfyxE93lwPvQ0IA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8C7D0F1"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612df9-0001-0009-3db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4PKCg7ceT5jEESrQ8sGrs935sdiAFCSK38C/RuVgMbA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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\x37\x64\x36\x31\x32\x64\x66\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x33\x65\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x34\x2E\x30\x32\x33\x32\x35\x38\x35\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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dfb-0001-0009-3eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4PKCg7ceT5jEESrQ8sGrs935sdiAFCSK38C/RuVgMbA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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\x37\x64\x36\x31\x32\x64\x66\x64\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x34\x30\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x34\x2E\x30\x33\x31\x32\x36\x35\x33\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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dfd-0001-0009-40b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hUD5N8nBKQ8yuRlkDdERtXTPjKMnCN4oc3fmcvHGMs8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612dff-0001-0009-42b0-01ca46000000 + 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 new file mode 100644 index 000000000..fbfcc8add --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobWithConditions.yaml @@ -0,0 +1,264 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Y4bx6JhLEhMPRZPx4OUo0zErudO4tFf44/481WJF2/Q= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8CFE8ED"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e00-0001-0009-43b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8ghQDQzOrLWjXCKcvSoIuSu2lmf/4tMujgL5BQr5OHk= + Content-Length: + - "0" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C92D8A70"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e02-0001-0009-44b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XFOLJXZM7Va/Jqc6XtfLXVpKxlDvJieZ8L7Rb1H6Yzg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C92D8A70"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e03-0001-0009-45b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QCPANAZowDscqEe2qLjqX9h0R6QHf39Fh00VsZSzKiA= + If-Match: + - GolangRocksOnAzure + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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\x37\x64\x36\x31\x32\x65\x30\x34\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x34\x36\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x34\x2E\x30\x39\x36\x33\x31\x37\x38\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: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e04-0001-0009-46b0-01ca46000000 + 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:XFOLJXZM7Va/Jqc6XtfLXVpKxlDvJieZ8L7Rb1H6Yzg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C92D8A70"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e07-0001-0009-49b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kKKaZy0Hp8jFYRC3spwDsfqrgO4KMAvaIbwbAc+RvNo= + If-Match: + - '"0x8D4CFC7C92D8A70"' + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e09-0001-0009-4bb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:O+PJi/3gcijtQUb442XErxlBJLaW0iQvKs8dJ8dCMz0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e0e-0001-0009-4fb0-01ca46000000 + 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 new file mode 100644 index 000000000..b656b747c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetAndSetBlobMetadata.yaml @@ -0,0 +1,250 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:J68MDG5QV9kdGRHiQkwExlIMKVkwJXgalrlYxE89Cc0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8DC6E9E"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e10-0001-0009-50b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eBTBMuRq82r/P5l7Mt6UZDe+ZT8ay2Hhe4dzHA74fcY= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C9392543"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e12-0001-0009-51b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:g3AIVgOrDTh93VYiw1B96Tk09AyRVEWbtpj2XjEweYY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C9392543"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e13-0001-0009-52b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:a+yy8RnvR2beeVL63ipFGzF4GMTQuIcW1wD4buwu1js= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C93C5A20"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e14-0001-0009-53b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aZLc0AKSO5q0ac7HkO8EoIWUtwA3FWK1+8PyEtQNtoY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C93DE10A"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e17-0001-0009-56b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DCWOArW9kfyM12j9EzmALH1tUyOjKL52Vn+vaoU6EAY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C93DE10A"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e18-0001-0009-57b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4pGWsLkBKhAVjOXB9yiHFlFKM6ezirdb+7LPDsr5CWA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e19-0001-0009-58b0-01ca46000000 + 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 new file mode 100644 index 000000000..1cfd5a911 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobProperties.yaml @@ -0,0 +1,180 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lu+5TrwqyirbvmI85j9llU2tTOh/YTh9l3Y8PUGjP8c= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Etag: + - '"0x8D4CFC7C8E8F44E"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e1c-0001-0009-5bb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2Kkpp+kB1Z91H9UeTbt5NPCkt2wr/tyQbWHTXlBlfn4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/138storageblobsuitetestgetblobproperties + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:53 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e1e-0001-0009-5cb0-01ca46000000 + 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:U9MvtH9GUi0UJg3gtK1WgWjnGgKNJ98edgMKE+2rSNY= + Content-Length: + - "64" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9470A65"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e20-0001-0009-5eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jmJzmquMZcrT3SgK+I9ZXulNO763P/fEFEpiM8Kemdo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9470A65"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e24-0001-0009-60b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8GEaCheC6J2kwydMK6CEhEsRpLpleIaQCgQANlsXFVI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e25-0001-0009-61b0-01ca46000000 + 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 new file mode 100644 index 000000000..037a05ded --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobRange.yaml @@ -0,0 +1,440 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:y489XcM/ZfoodPa50VKvpYSdqo9JgW/2Kwxu7KtldhU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C8F1F6DB"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e26-0001-0009-62b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "0123456789" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gP1RpQUV4ECYpidFB4CsORNjWgcNFuJwArRPg2LiXnk= + Content-Length: + - "10" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e29-0001-0009-64b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:M8WyAP6KYMI4MHnHxw7lmJzG5e1ycH/UCgd2bztFaOE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "10" + Content-Md5: + - eB5eJF1ptWaXm4bijSPyxw== + Content-Type: + - application/octet-stream + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e2c-0001-0009-67b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9FP4SHfEKjyKrr7wmO9SfhDC1r+10cMk3bV5+e2Rrso= + Range: + - bytes=0-10 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e2e-0001-0009-69b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:q/AeARNby4xxMcrynmhhliu365BpO4eHP3zko80qw5I= + Range: + - bytes=0- + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e2f-0001-0009-6ab0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qRNUQUTtEaGOTJ6YraJRakQ+4IQwrUaaKVqJf+8Etm4= + Range: + - bytes=1-3 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:54 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e31-0001-0009-6cb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bwmyzg23ZYAfRVazeBvW/wi2bOAmB9e3nBIGpOTdliI= + Range: + - bytes=3-10 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e32-0001-0009-6db0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RVGMIFRZQqwLJ7Vwromt1RzaoClIrzunIAlClybI8Co= + Range: + - bytes=3- + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94E85C9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 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: + - 7d612e33-0001-0009-6eb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1wUoKbcq7sShcG1fWTklja6HhwEETsoupuOcrklqlUg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e36-0001-0009-70b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EMjQYzzW7DlBHN2sk3SYjFhbjEiUJA+YJvEphkU92L0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e38-0001-0009-72b0-01ca46000000 + 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 new file mode 100644 index 000000000..f797e810a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestMetadataCaseMunging.yaml @@ -0,0 +1,178 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:U8Q56rYW251/PtRhkIFQgT9ICwdNX/RcMhjLIPoZYs4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9018A67"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e39-0001-0009-73b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:z/PEKH6dHRcIpv/HlsaBq5EVLwMZSdzNV0lFKBBV5bs= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C95E4002"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e3c-0001-0009-75b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Q5RoYxTGL4IbcqRNROcctf9UrbR1QtocY9wGnFkO5SQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C95FEDFE"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e3e-0001-0009-77b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vBKY9GhUQv2lmZNDGeSqR+utA7oM6gUyZYMR09DWDdg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C95FEDFE"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e3f-0001-0009-78b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:WSj2Ye0J+M6HJEChyxo3UB2lc2lDafnM51vmuZ74H5o= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e40-0001-0009-79b0-01ca46000000 + 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 new file mode 100644 index 000000000..2aae74f94 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestPutAppendBlobSpecialChars.yaml @@ -0,0 +1,389 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oXYiJ7wXkb7EPor8+HcgyJnhEAvEPYdKIojxWn1qE+w= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C90B2950"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e41-0001-0009-7ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1o9dSDnMm5y6tFTBX16VCTRDW81gyeFasUsL+iGqixE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C967DEA7"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e44-0001-0009-7cb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XoM8BErD87KPFxjH4851u/GJj51n74DTWoLuJvceTow= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C967DEA7"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e47-0001-0009-7eb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + 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:TTuuN6GPK1P4HG8+GuKnCDZIeRie9PSq5PQ1aVplTy4= + Content-Length: + - "1024" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C96CE8A0"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e48-0001-0009-7fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ON+urlM4U5hZnRBnT6Alg5g0kb0Q/yKl7jcUm/kWvR4= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C96CE8A0"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e49-0001-0009-80b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + 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:YsW5RHTXCo03nzY6/6aHshNrMJvIgejLcdLWZBWK3SE= + Content-Length: + - "512" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9706BB0"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e4b-0001-0009-02b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cu/arkAYACUailB6vMMFnJk1XpOtSJgFnSMjI2CbWKk= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9706BB0"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e4c-0001-0009-03b0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gHAygTumxAxy2dePSksYhGzJvhxGpRs0hi3c4bqn9xA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e4e-0001-0009-05b0-01ca46000000 + 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 new file mode 100644 index 000000000..1ed30bed7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetBlobProperties.yaml @@ -0,0 +1,200 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Ddn2u71ha6PWMI3OQN9hX80lVW/XEMok9udvXwsIPEk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C91B5941"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e51-0001-0009-08b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JE1ZnkFOzZf+9sAzOyDWAkIY6fELb+SgeB6Bwn5Jbso= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C977E70E"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e55-0001-0009-0bb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UOs98TeUhSAvMU0f8e6Y8qCttopu3ddIXAOuZHGJ6s4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C97AF4D9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e56-0001-0009-0cb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zJqjzFwjvPvHvMYF0R3qk9BZELkT8fTNuW8A3IuW01o= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C97AF4D9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e58-0001-0009-0eb0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:b+6DqQPpZFExyE9G1xd7cYHX2YurGA5eBkOK7uHVbow= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e5b-0001-0009-11b0-01ca46000000 + 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 new file mode 100644 index 000000000..78a2a639e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetMetadataWithExtraHeaders.yaml @@ -0,0 +1,230 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0tAPF4u2NnSgOu+ClFyTtB8K315bIX9+e7sm5E+y15E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9267F19"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e61-0001-0009-17b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nrEXNQSVWzlpjt5noqihGqoB6/MSQq0T21j2CVAkUFA= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9830C98"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e64-0001-0009-19b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:euJeFPB1yk+thH8Kb+UeAG96pKpSZckLO/REUP9GpS4= + If-Match: + - incorrect-etag + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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\x37\x64\x36\x31\x32\x65\x36\x36\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x31\x62\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x34\x2E\x36\x34\x37\x37\x35\x38\x35\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: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e66-0001-0009-1bb0-01ca46000000 + 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:3VhVfDcf0e9eqqZQ7DobLrj1N2F1LZJlPALvt/NQ/qc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9830C98"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 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: + - 7d612e68-0001-0009-1db0-01ca46000000 + X-Ms-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Egt6QqfrTahsIh2X2bHhcRcS06fQwU9orLPtAeJI5sk= + If-Match: + - '"0x8D4CFC7C9830C98"' + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C987531E"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e69-0001-0009-1eb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rpdWEEUuU7UDbOc1bOeb/kPalqwHEHh+et5NwPIp7U0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e6b-0001-0009-20b0-01ca46000000 + 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 new file mode 100644 index 000000000..4a72df9d7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlob.yaml @@ -0,0 +1,138 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:X84LMkDEns41Z+ShCdeNZ0xIagMrKFiqwu61PzgBcTc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C932DDB1"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e70-0001-0009-25b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1Sw1tBukIvomdE1xBU+YuXq5TqRos2Rv6sER6OjpuXg= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C98F6AD9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e72-0001-0009-26b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Ug7IJZfw8vPrpIP5uXP71gvKT8Uiksif6ylkdXw4ie4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C98F6AD9"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e74-0001-0009-28b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:33:55.3253589Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9EmR6OGiCMHTs/YO6DPh9q9olqqzBu804QwioviXNrw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e78-0001-0009-2cb0-01ca46000000 + 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 new file mode 100644 index 000000000..9c39611de --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithInvalidLease.yaml @@ -0,0 +1,176 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YGNXGzm2av6AjbL36HWuf2ysc60gEvu3P/h7ptVFgkY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C93C0756"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e7f-0001-0009-33b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L+/253Ak05gn9eByP8E+LxZIZB1K8wcbQFQlPkaTy70= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C998BB4F"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e82-0001-0009-35b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0K/nH0Fi3NA9/6+uIcse2E9GEehZCGuHbGcn0OsuXtQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C998BB4F"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - f95cb056-a719-4aa7-be8c-3d95addd0570 + X-Ms-Request-Id: + - 7d612e86-0001-0009-39b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Nu8RaDWJ4W66RgUtdFAR3nc5kosdFUvRMQbrwH1b5dE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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\x37\x64\x36\x31\x32\x65\x38\x37\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x33\x61\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x34\x2E\x37\x39\x39\x38\x38\x30\x32\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: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e87-0001-0009-3ab0-01ca46000000 + 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:e0gp6NAy/7yiB5dRgPg04zqrRWNW2JKQGkQm5ZldsI4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e89-0001-0009-3cb0-01ca46000000 + 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 new file mode 100644 index 000000000..540753a72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithTimeout.yaml @@ -0,0 +1,138 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:e3hSap+a90UTM63Gv4ShbEVd4EaRDHy6pL2isKDfqMk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94509DA"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e8b-0001-0009-3eb0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SJbBYgoU0Cj31NxVu3fYkpjgS2CZYDxHeCheFE49SVE= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9A19681"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e8d-0001-0009-3fb0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TkXwHwoaTh6/d85LkYlPlXAdDBVoBXByspjmNFqd8S4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9A19681"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e8e-0001-0009-40b0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:33:55.4444413Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/tk0dONACX0uAfE0cK1FQcCho6WcRLd1fapQlKSB1e0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e90-0001-0009-42b0-01ca46000000 + 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 new file mode 100644 index 000000000..e314d644b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithValidLease.yaml @@ -0,0 +1,178 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ge4VTYxVdoQdIcd5dbhjGDRIqoVHI1rVZC/Q8xmruhQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C94D21D3"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e91-0001-0009-43b0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tkOFSuu1jVl2uOxtoDzr+iogAaUTvIQpTeJR4mMXAO0= + Content-Length: + - "6" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9A9D557"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e96-0001-0009-46b0-01ca46000000 + X-Ms-Request-Server-Encrypted: + - "true" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mf0xhtGzGx3OkO4rt9S8uAP1RHN2iifa3TPCd804548= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9A9D557"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - 7287f72b-9170-4baf-802e-dba5bc3cb6e7 + X-Ms-Request-Id: + - 7d612e9a-0001-0009-4ab0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aw2f38bFLy1RgtzoOuGyeIEWK6ryQU0lmg//yHrEUR0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-lease-id: + - 7287f72b-9170-4baf-802e-dba5bc3cb6e7 + 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: + - Thu, 20 Jul 2017 23:33:54 GMT + Etag: + - '"0x8D4CFC7C9A9D557"' + Last-Modified: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e9b-0001-0009-4bb0-01ca46000000 + X-Ms-Snapshot: + - 2017-07-20T23:33:55.5094868Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ilbVoDn98st9RLgBJ6YtIa9m7Mnw35JpgcF9a5U42QE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:33:54 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612e9d-0001-0009-4db0-01ca46000000 + 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 new file mode 100644 index 000000000..33ada3ebb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError.yaml @@ -0,0 +1,75 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:A1ZOmzVTuIrTSkoPugUOap/LD5Lu/+RQnSozqiKY4HI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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\x37\x64\x36\x31\x32\x65\x65\x33\x2D\x30\x30\x30\x31\x2D\x30\x30\x30\x39\x2D\x30\x64\x62\x30\x2D\x30\x31\x63\x61\x34\x36\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x33\x3A\x35\x35\x2E\x33\x30\x35\x32\x38\x34\x35\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: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612ee3-0001-0009-0db0-01ca46000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:dlDesROZri+Wvj7gLcKDElewzeZxmldp0HJ561R7nWM= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table49storageclientsuitetestret%27%29?timeout=30 + method: DELETE + response: + body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:875b7d61-0002-0036-47b0-0102e5000000\nTime:2017-07-20T23:33:55.9363970Z"}}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b7d61-0002-0036-47b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 404 Not Found + 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 new file mode 100644 index 000000000..abd54e98c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError_withoutResponseBody.yaml @@ -0,0 +1,32 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qhGZiaCHNiYsRfaoTtCYO77QlFb5n7sHmR132syWtto= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + blob + x-ms-date: + - Thu, 20 Jul 2017 23:33:55 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: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 7d612eea-0001-0009-14b0-01ca46000000 + 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 new file mode 100644 index 000000000..47381b15f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/Test_doRetry.yaml @@ -0,0 +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:875b7d62-0002-0036-48b0-0102e5000000\nTime:2017-07-20T23:33:55.9834316Z"}}}' + headers: + Content-Length: + - "202" + Content-Type: + - application/json + Date: + - Thu, 20 Jul 2017 23:33:55 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b7d62-0002-0036-48b0-0102e5000000 + 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:875b7d91-0002-0036-74b0-0102e5000000\nTime:2017-07-20T23:33:57.0061650Z"}}}' + headers: + Content-Length: + - "202" + Content-Type: + - application/json + Date: + - Thu, 20 Jul 2017 23:33:56 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b7d91-0002-0036-74b0-0102e5000000 + 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:875b7dd8-0002-0036-31b0-0102e5000000\nTime:2017-07-20T23:33:59.0156064Z"}}}' + headers: + Content-Length: + - "202" + Content-Type: + - application/json + Date: + - Thu, 20 Jul 2017 23:33:58 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b7dd8-0002-0036-31b0-0102e5000000 + 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 new file mode 100644 index 000000000..345d5cc31 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectory.yaml @@ -0,0 +1,152 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:E0WSw7N6AWnym9SFrhEj77r0kjB15KsaocqkV2Npd7c= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CF60D2E9"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ccc-001a-00eb-73b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1gixvkuzZOBJ7MMwp+3K4RjqNigMX8mJUXMhWt60isA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CDF8BA96"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ccf-001a-00eb-74b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Fi9gp6dOyo14rRcTF6hhDje66RghlI3u5rxySHJQckM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cd1-001a-00eb-75b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jqmpYnAGiyNL+UydUnU+V8qpvKfLboMYX+nDE5x7Eyo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cd2-001a-00eb-76b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:iAqY+dpV5NNLakX3KzCHw2NtMlnlXY3a5SNEXhQ8Xoo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cd3-001a-00eb-77b0-01f767000000 + 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 new file mode 100644 index 000000000..7c3bcf316 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfExists.yaml @@ -0,0 +1,96 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gpxFHnyAaC6GgnT2NMNnQU/pSeJelt4zD7zM0C8ytSA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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\x66\x32\x37\x64\x35\x63\x64\x37\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x37\x61\x62\x30\x2D\x30\x31\x66\x37\x36\x37\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x35\x2E\x31\x36\x39\x33\x39\x33\x37\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: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cd7-001a-00eb-7ab0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 409 The specified resource already exists. + code: 409 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CbgxhqBc6nG/ILaH5ohNJO4TPqRk66JV7vPMJTKFxTY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - '"0x8D4CFC7CE0231F8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cd8-001a-00eb-7bb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6pAxS6am1Phqlvx1MVi28WYyN7BHaFqCoFBPJik54yw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cd9-001a-00eb-7cb0-01f767000000 + 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 new file mode 100644 index 000000000..5daf46e04 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfNotExists.yaml @@ -0,0 +1,152 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ErRm8clwrQsGFLoPAGc/gz0+YvTlt23pyfzqjhLras4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CF760C87"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cdb-001a-00eb-7eb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1KsutpjSzYqUqDkKUFHoqWJZqqK5XueUg75lOteAbkI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CE0CBAFE"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cdd-001a-00eb-7fb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fw02ik6f/xOhe8fr0tIY7hP8HA78DTgUxE0VsvIo5KI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cde-001a-00eb-80b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VTIvHpsd6GzoA4Pfj3LconUefvhx/X681MK+cnVXO90= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cdf-001a-00eb-01b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6UxghcOjMccyi2FkdUcnobH1OVqru8Vp2FAPKeh2btI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce0-001a-00eb-02b0-01f767000000 + 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 new file mode 100644 index 000000000..aee14421f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestDirectoryMetadata.yaml @@ -0,0 +1,168 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CQQmxDZoUsesGytUKxHryivPOlnfXUmtfUJ0EIFkwYs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CF7E999C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce1-001a-00eb-03b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SkI6Qoy5QmdaSQ1RRzJCgTMRK4x3eCKXQXCUIYory20= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CE156EF0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce3-001a-00eb-04b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4lDxiD8feNavkwaNfPEuhfzB0g54/8aogwUFqgYlxmk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CE21A5EF"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce4-001a-00eb-05b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RIE5PdlG56ASKbeUTsGbNebSo58UbCIiNF+JGcmVXqM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CE21A5EF"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:02 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: + - f27d5ce5-001a-00eb-06b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2Q6md5/MFa1cjJcmyZxc0Tmq7W9CZbU8YEC3gsRUwNE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce6-001a-00eb-07b0-01f767000000 + 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 new file mode 100644 index 000000000..ae1ab9bce --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListDirsAndFiles.yaml @@ -0,0 +1,218 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:leMnKnq9PMcVaTU5OyOq/n+be5Mo211X3TI1KgjXrQc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CF935DF0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce7-001a-00eb-08b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:G/8IhVD68Eu3GBXKInBgwuy9mFZLOannemjhUglI7O4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CE2A0BB0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ce9-001a-00eb-09b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1CFK2VXRQRKPXeK4SuOxJ1ee3cu6C3u/VjqGAq4zMq0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "512" + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CE2BB9AA"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cea-001a-00eb-0ab0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Rj1on5W8KveBOqY192lIFPQSDSAGzLISVPzreIpcKKc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ceb-001a-00eb-0bb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3fengX3QTZBIAZV9wXytqIa1eXzvGnMDnD+gRlUtju0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cec-001a-00eb-0cb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vdjxnV/URgZiVIGyBS/oqVQv26Iu8rUskok0xgBy268= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5ced-001a-00eb-0db0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DFVyYmUmWHoviAFnENm3hCRizqUplxVLr3lnaMfDJII= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cee-001a-00eb-0eb0-01f767000000 + 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 new file mode 100644 index 000000000..fb4c8b625 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListZeroDirsAndFiles.yaml @@ -0,0 +1,94 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZlvAfWx14clTLFU5ofiLdq7M+sqNvv1CEBJvbQcoxcU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - '"0x8D4CFC7CF9F9537"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cef-001a-00eb-0fb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rFmif9aA3CZd6+cBYqUuZLic3WmHmgzbGeyH1tXHrFI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf1-001a-00eb-10b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5dbfBpR6WNfGXUH0BusG29kAjK5Af4PyHNfaVtG2Oqo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf2-001a-00eb-11b0-01f767000000 + 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 new file mode 100644 index 000000000..4c9f359c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestDelete.yaml @@ -0,0 +1,315 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table29storageentitysuitetestdel"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:EZbr90rtN7p5TmCd/xfA3tm6NyuGDRnetLfXXOuS8g0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 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: + - 875b81af-0002-0036-56b0-0102e5000000 + 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:6p3vO/gSyANM7ODnI7G8sLaqD35pMaNot3w03ZrGIPU= + Content-Length: + - "43" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.616343Z''\"","odata.editLink":"table29storageentitysuitetestdel(PartitionKey=''pkey1'',RowKey=''rowkey1'')","PartitionKey":"pkey1","RowKey":"rowkey1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.616343Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.616343Z'" + 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: + - 875b81b1-0002-0036-57b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:VRhrHYGNU+UA0QTsP7GBHIS3cYumNbuvBXmESIHFsN4= + If-Match: + - W/"datetime'2017-07-20T23%3A34%3A05.616343Z'" + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81b3-0002-0036-59b0-0102e5000000 + 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:6p3vO/gSyANM7ODnI7G8sLaqD35pMaNot3w03ZrGIPU= + Content-Length: + - "43" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.6363591Z'" + 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: + - 875b81b4-0002-0036-5ab0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:t7T32NPW6eFvJArSHI7At9hBkr5aDgZzRt4e6xyrj9I= + If-Match: + - GolangRocksOnAzure + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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:875b81b5-0002-0036-5bb0-0102e5000000\nTime:2017-07-20T23:34:05.6553710Z"}}}' + headers: + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81b5-0002-0036-5bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 400 Bad Request + code: 400 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:t7T32NPW6eFvJArSHI7At9hBkr5aDgZzRt4e6xyrj9I= + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81b6-0002-0036-5cb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:3d7PNy4U2GmhKomLD1O1tD8spXx9GeVbuArWtbHiJFU= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81bb-0002-0036-61b0-0102e5000000 + 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 new file mode 100644 index 000000000..d1ac8599c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestExecuteQueryNextResults.yaml @@ -0,0 +1,459 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table46storageentitysuitetestexe"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:EZbr90rtN7p5TmCd/xfA3tm6NyuGDRnetLfXXOuS8g0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:04 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: + - 875b81c1-0002-0036-65b0-0102e5000000 + 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:XgAFhnNhoaF6lUGEvhiAZ0dl+eJEwSCqcw6ycoY8crc= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.7064077Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","PartitionKey":"pkey","RowKey":"r0","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7064077Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.7064077Z'" + 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: + - 875b81c3-0002-0036-66b0-0102e5000000 + 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:XgAFhnNhoaF6lUGEvhiAZ0dl+eJEwSCqcw6ycoY8crc= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.7164148Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","PartitionKey":"pkey","RowKey":"r1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7164148Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.7164148Z'" + 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: + - 875b81c4-0002-0036-67b0-0102e5000000 + 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:XgAFhnNhoaF6lUGEvhiAZ0dl+eJEwSCqcw6ycoY8crc= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.726422Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","PartitionKey":"pkey","RowKey":"r2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.726422Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.726422Z'" + 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: + - 875b81c8-0002-0036-6bb0-0102e5000000 + 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:XgAFhnNhoaF6lUGEvhiAZ0dl+eJEwSCqcw6ycoY8crc= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.7354285Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","PartitionKey":"pkey","RowKey":"r3","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7354285Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.7354285Z'" + 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: + - 875b81ca-0002-0036-6db0-0102e5000000 + 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:XgAFhnNhoaF6lUGEvhiAZ0dl+eJEwSCqcw6ycoY8crc= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.7454357Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","PartitionKey":"pkey","RowKey":"r4","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7454357Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.7454357Z'" + 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: + - 875b81cd-0002-0036-70b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:1rFMXgyzKxIYvrKSPG8sLSiM0QbHXmkSFrBts/7dP5Q= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.7064077Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","PartitionKey":"pkey","RowKey":"r0","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7064077Z"},{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","odata.etag":"W/\"datetime''2017-07-20T23%3A34%3A05.7164148Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","PartitionKey":"pkey","RowKey":"r1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7164148Z"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 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: + - 875b81ce-0002-0036-71b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:1rFMXgyzKxIYvrKSPG8sLSiM0QbHXmkSFrBts/7dP5Q= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.726422Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","PartitionKey":"pkey","RowKey":"r2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.726422Z"},{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","odata.etag":"W/\"datetime''2017-07-20T23%3A34%3A05.7354285Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","PartitionKey":"pkey","RowKey":"r3","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7354285Z"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:04 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: + - 875b81d0-0002-0036-73b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:1rFMXgyzKxIYvrKSPG8sLSiM0QbHXmkSFrBts/7dP5Q= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.7454357Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","PartitionKey":"pkey","RowKey":"r4","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.7454357Z"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81d4-0002-0036-75b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:7kLM103T06YElqGv9d3TDcjGoJ7Y0Z4LcgxfHm8aPw4= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81d6-0002-0036-77b0-0102e5000000 + 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 new file mode 100644 index 000000000..784ee5dc8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestGet.yaml @@ -0,0 +1,259 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table26storageentitysuitetestget"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:EZbr90rtN7p5TmCd/xfA3tm6NyuGDRnetLfXXOuS8g0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b81dc-0002-0036-7db0-0102e5000000 + 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:QjaoU3ULO2w0cvSbOxaXelRkwqEye3ETT3g6oudzBZA= + Content-Length: + - "323" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.8324981Z'" + 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: + - 875b81df-0002-0036-7fb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:n4L7oJ+L2DiE/USRE/mIW1bwQ1XogOx2ml+lDyvZixE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.8324981Z''\"","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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.8324981Z'" + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81e1-0002-0036-01b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:n4L7oJ+L2DiE/USRE/mIW1bwQ1XogOx2ml+lDyvZixE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.8324981Z''\"","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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.8324981Z'" + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81e3-0002-0036-03b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:n4L7oJ+L2DiE/USRE/mIW1bwQ1XogOx2ml+lDyvZixE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.8324981Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.8324981Z","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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.8324981Z'" + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81e4-0002-0036-04b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:1y0duhMkjc4p89TOsMCE01kYsEIo1cED7qhlBD1/IFA= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81e5-0002-0036-05b0-0102e5000000 + 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 new file mode 100644 index 000000000..85be38fec --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsert.yaml @@ -0,0 +1,195 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table29storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:EZbr90rtN7p5TmCd/xfA3tm6NyuGDRnetLfXXOuS8g0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b81e7-0002-0036-07b0-0102e5000000 + 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:nJTyk/VW6pkVp0p0EWBNHYn1igE0AKbYBFl372P7shQ= + Content-Length: + - "323" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.9075516Z'" + 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: + - 875b81ee-0002-0036-0cb0-0102e5000000 + 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:nJTyk/VW6pkVp0p0EWBNHYn1igE0AKbYBFl372P7shQ= + Content-Length: + - "325" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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-07-20T23%3A34%3A05.9165584Z''\"","odata.editLink":"table29storageentitysuitetestins(PartitionKey=''mypartitionkey2'',RowKey=''myrowkey2'')","PartitionKey":"mypartitionkey2","RowKey":"myrowkey2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:05.9165584Z","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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.9165584Z'" + 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: + - 875b81f3-0002-0036-11b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:Xl7hSM6u8Fa4PpN2e3is1y9XlRgnAZAmKpBY8RF94xs= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81f5-0002-0036-13b0-0102e5000000 + 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 new file mode 100644 index 000000000..613f366d4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrMerge.yaml @@ -0,0 +1,189 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table36storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:EZbr90rtN7p5TmCd/xfA3tm6NyuGDRnetLfXXOuS8g0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:05 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b81f9-0002-0036-16b0-0102e5000000 + 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:sOJjzh//8e89L5IXHeSJFJzR4lWEElAb15cSZDWICG0= + Content-Length: + - "92" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.4985019Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81fc-0002-0036-18b0-0102e5000000 + 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:sOJjzh//8e89L5IXHeSJFJzR4lWEElAb15cSZDWICG0= + Content-Length: + - "87" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.5085092Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81fd-0002-0036-19b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:2ucLelpLBmlJ45KnxKsHBJsYQdD6gg5dQDFUJlNVd7Q= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b81ff-0002-0036-1bb0-0102e5000000 + 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 new file mode 100644 index 000000000..068736c84 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrReplace.yaml @@ -0,0 +1,189 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table38storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:AI3ePSpVLqD19g+mXulm9H31qjWddHbgztLq37YCVjU= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b8205-0002-0036-21b0-0102e5000000 + 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:wZoJdszhaWBx5PQf/22Be2fnWwDT3t18brijN39GT7k= + Content-Length: + - "114" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.5515385Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b820a-0002-0036-25b0-0102e5000000 + 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:wZoJdszhaWBx5PQf/22Be2fnWwDT3t18brijN39GT7k= + Content-Length: + - "112" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A05.5605446Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8210-0002-0036-2bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:JnnM/BD/EWVpimroWVWrozLd9kOWr/i3ogxlZofitR4= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8212-0002-0036-2db0-0102e5000000 + 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 new file mode 100644 index 000000000..a6d6fd440 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestMerge.yaml @@ -0,0 +1,288 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table28storageentitysuitetestmer"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:AI3ePSpVLqD19g+mXulm9H31qjWddHbgztLq37YCVjU= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b8216-0002-0036-31b0-0102e5000000 + 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:/b1RTRDghnk+AFnNi7JYZjrxKf9eGRU5mK/0JDvrxcY= + Content-Length: + - "100" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.0616656Z''\"","odata.editLink":"table28storageentitysuitetestmer(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.0616656Z","Country":"Mexico","MalePoet":"Nezahualcoyotl"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.0616656Z'" + 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: + - 875b821b-0002-0036-35b0-0102e5000000 + 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:jZYSxroXBs+RjeymYDVURDvZ5FfQEKvjzMTxEcvV94g= + Content-Length: + - "94" + Content-Type: + - application/json + If-Match: + - W/"datetime'2017-07-20T23%3A34%3A06.0616656Z'" + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.0626656Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b821d-0002-0036-37b0-0102e5000000 + 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:jZYSxroXBs+RjeymYDVURDvZ5FfQEKvjzMTxEcvV94g= + 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.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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:875b821f-0002-0036-39b0-0102e5000000\nTime:2017-07-20T23:34:06.0896827Z"}}}' + headers: + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b821f-0002-0036-39b0-0102e5000000 + 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:jZYSxroXBs+RjeymYDVURDvZ5FfQEKvjzMTxEcvV94g= + Content-Length: + - "112" + Content-Type: + - application/json + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.0636656Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8223-0002-0036-3db0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:Z4CanwAtmar+XP1JYdwk9wndIDoXz9+vfoK0uhVfFno= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8227-0002-0036-41b0-0102e5000000 + 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 new file mode 100644 index 000000000..b73f89216 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestUpdate.yaml @@ -0,0 +1,288 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table29storageentitysuitetestupd"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:AI3ePSpVLqD19g+mXulm9H31qjWddHbgztLq37YCVjU= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b8229-0002-0036-43b0-0102e5000000 + 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:OBwP+zofvIfL1l1WKfLqEJBuXVRR5S/jOGvSWmMnrac= + Content-Length: + - "323" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.1417196Z''\"","odata.editLink":"table29storageentitysuitetestupd(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.1417196Z","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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.1417196Z'" + 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: + - 875b822b-0002-0036-44b0-0102e5000000 + 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:zd7GlSbW43COv1K+UDx55rf6KiuDJKsron3WF+ihLio= + Content-Length: + - "114" + Content-Type: + - application/json + If-Match: + - W/"datetime'2017-07-20T23%3A34%3A06.1417196Z'" + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.1427196Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b822f-0002-0036-48b0-0102e5000000 + 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:zd7GlSbW43COv1K+UDx55rf6KiuDJKsron3WF+ihLio= + 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.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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:875b8231-0002-0036-4ab0-0102e5000000\nTime:2017-07-20T23:34:06.1607332Z"}}}' + headers: + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8231-0002-0036-4ab0-0102e5000000 + 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:zd7GlSbW43COv1K+UDx55rf6KiuDJKsron3WF+ihLio= + Content-Length: + - "112" + Content-Type: + - application/json + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.1437196Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8232-0002-0036-4bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:aZmUvOVKai8L2/VkhLEnxCY9Nao6PCqJktue5/muzac= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8234-0002-0036-4db0-0102e5000000 + 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 new file mode 100644 index 000000000..86e745d6a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndDeleteEntities.yaml @@ -0,0 +1,307 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table47storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:AI3ePSpVLqD19g+mXulm9H31qjWddHbgztLq37YCVjU= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b8235-0002-0036-4eb0-0102e5000000 + 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:lF4Gbw3Vx6M2AoIj7k/WYDyQ3bi9Tbp9e8vD4eaE1VQ= + Content-Length: + - "98" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.2097688Z'" + 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: + - 875b8238-0002-0036-50b0-0102e5000000 + 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:lF4Gbw3Vx6M2AoIj7k/WYDyQ3bi9Tbp9e8vD4eaE1VQ= + Content-Length: + - "98" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.219776Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.219776Z","FamilyName":"Skywalker","Name":"Luke","Number":1}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.219776Z'" + 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: + - 875b823a-0002-0036-52b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:OyTw86alN+gEQcOhCSkxmb55f79jXn0lsY35yf2bVc0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.219776Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.219776Z","FamilyName":"Skywalker","Name":"Luke","Number":1}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b823b-0002-0036-53b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:rkPZo4uU/vhEmtJiJgzVlLnJWX0G5oJ3/p6VbMmaSk8= + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b823c-0002-0036-54b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:OyTw86alN+gEQcOhCSkxmb55f79jXn0lsY35yf2bVc0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.2097688Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","PartitionKey":"mypartitionkey","RowKey":"100","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.2097688Z","FamilyName":"Skywalker","Name":"Luke","Number":3}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b823d-0002-0036-55b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:dj0mJIUUue6UdDG0npDXFiMqHNPb0og8f70Ih3WoLvc= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b823e-0002-0036-56b0-0102e5000000 + 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 new file mode 100644 index 000000000..00a9d4643 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndExecuteQuery.yaml @@ -0,0 +1,233 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table45storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:AI3ePSpVLqD19g+mXulm9H31qjWddHbgztLq37YCVjU= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b8240-0002-0036-58b0-0102e5000000 + 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:2mQ+/toNV4Zej2Tj+dMXZvteNPWITD1yX+ejVvJukt0= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.2918277Z'" + 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: + - 875b8242-0002-0036-59b0-0102e5000000 + 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:2mQ+/toNV4Zej2Tj+dMXZvteNPWITD1yX+ejVvJukt0= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.3028356Z'" + 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: + - 875b8243-0002-0036-5ab0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:1PCHlLdFTrZfuJL4aBAVviq75FBLgDdZVWZtev+5adE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.3028356Z''\"","odata.editLink":"table45storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.3028356Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8244-0002-0036-5bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:2np4hn/jbawvF+iCaf6ACraiW0fIVKDb/2wDtqWiv4k= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8245-0002-0036-5cb0-0102e5000000 + 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 new file mode 100644 index 000000000..460ae0170 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndGetEntities.yaml @@ -0,0 +1,231 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table44storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:AI3ePSpVLqD19g+mXulm9H31qjWddHbgztLq37YCVjU= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 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: + - 875b8246-0002-0036-5db0-0102e5000000 + 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:e7D5WTbpCj3NgfdPedQdWq5EzxzhrZMR9EF+2GAmPP4= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.3538744Z'" + 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: + - 875b8248-0002-0036-5eb0-0102e5000000 + 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:e7D5WTbpCj3NgfdPedQdWq5EzxzhrZMR9EF+2GAmPP4= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.3628783Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.3628783Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Etag: + - W/"datetime'2017-07-20T23%3A34%3A06.3628783Z'" + 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: + - 875b824a-0002-0036-60b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:B6g/FdUzBvzmwMaGlafNvqTYGjV3VkZO4sof/A8EdNI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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-07-20T23%3A34%3A06.3538744Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","PartitionKey":"mypartitionkey","RowKey":"100","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.3538744Z","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-07-20T23%3A34%3A06.3628783Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:06.3628783Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b824c-0002-0036-62b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:oAWNszrMw6w3gjDAt0MDfoSjfk5UNPU+h9XJuz4XJPk= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b824d-0002-0036-63b0-0102e5000000 + 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 new file mode 100644 index 000000000..f1a5ecf1e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileMissingFile.yaml @@ -0,0 +1,132 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GyRZyJ1olThBlfQuns73LC2z2DgAoGE9PdRstNLHrpA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D01F6430"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf4-001a-00eb-13b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fVQazF0IzLmXqUwHFfiuwAKKdXRPHgOFVBHqRJXZKgY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEB6359F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:03 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf6-001a-00eb-14b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZbKJ71Z1Q73OKM3QziunVvmpjdcc4L1IWh9/jxxDGQI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-copy-source: + - "" + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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\x66\x32\x37\x64\x35\x63\x66\x37\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x31\x35\x62\x30\x2D\x30\x31\x66\x37\x36\x37\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x36\x2E\x33\x34\x38\x32\x34\x36\x31\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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf7-001a-00eb-15b0-01f767000000 + 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:JjTKG8NtkNkghpDsl6weTK4mDjEEsGfTqTTnCOJLoRQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf8-001a-00eb-16b0-01f767000000 + 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 new file mode 100644 index 000000000..2da3aa19d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountNoMetaData.yaml @@ -0,0 +1,298 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hQ6GFhyDCr4lAgmc6bk3WFhADtPE8Qsz7YbwOXILXo0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D02706B5"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cf9-001a-00eb-17b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SfC5VmD39ktaHT1wzj9kj+fiVPRzKTgGhbazEtmD96U= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEBDD7F9"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cfb-001a-00eb-18b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0lMWubSKhNAbjNBob0Zb1Ip1bXapKBscUp1u4ssJKsA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEBF5ED8"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cfc-001a-00eb-19b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/VVB8VxieOI34bpn5Sm/aKECcmf7BpHPgSmtR/kNnlY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "1024" + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEC0E5B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cfd-001a-00eb-1ab0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:97mM8zws7azG0smgyCaWDzLwPf0xx81YFGSjK2JcQm0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEC0E5B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5cfe-001a-00eb-1bb0-01f767000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:WD6H5A5NW7f1Qv3yKyj/luAbjsekyQBXvhJAqXp5nMI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEE7ADD4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 7f8ae449-ceb7-4f0e-8e86-9c7c2467ac7b + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - f27d5cff-001a-00eb-1cb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:R3nlPOmKB1hr30n8ZH/NvQCk2+baSTksLoG55oyn2l4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d02-001a-00eb-1db0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Sd6pcOzqZI2z28nWCvmpMj7Eul3KjewOMj2/9cd9o8w= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d03-001a-00eb-1eb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BD9VAe0twWA61vaS936sXu1LeeqPkOTjtwdqE6Atmoo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d04-001a-00eb-1fb0-01f767000000 + 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 new file mode 100644 index 000000000..81d9b360a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountTimeout.yaml @@ -0,0 +1,260 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eMKZCvORmdLpl9wrSrrwpw/AXNJHpQMbIQ/G79RSGio= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D05C0338"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d05-001a-00eb-20b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:t7pVwF/oo5AlbbYRmSZ/ZVHIa84gDOmanHeEeip7slw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEF2D32F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d07-001a-00eb-21b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TLd8shZt+jJccIeLrPBV/BLlW+O7QmTozpLBjYVNVNY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEF45A0E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d08-001a-00eb-22b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:b0yiCz9rwmkMddgIDD3RylTiJaSp40xJrvO3X4uoN6c= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "1024" + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEF5E0F1"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d09-001a-00eb-23b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eZop3aeIqh/vRRFDWy8SD4FYPw29SqL+ePeTX35eq9g= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CEFA4E6E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - c1323121-9cec-4e77-8dd5-0fd74b964393 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - f27d5d0a-001a-00eb-24b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:l8N0ePEnMiYqjBHA8Hf07EIkCUK8LGSTSGlgSBUR/qI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d0b-001a-00eb-25b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KoqVbL1c8hiXQcz4Vs1EB5qo4IOyPWmYIzjUN25fBBA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d0c-001a-00eb-26b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QsIV+zDFcBsfXow3AUm7pWnXUvI+AJvteoauxbdcp4Q= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d0d-001a-00eb-27b0-01f767000000 + 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 new file mode 100644 index 000000000..67ed17de9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCreateFile.yaml @@ -0,0 +1,248 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:motutuf86COMWnYutk3gbxReBL9U7KsrsIQdRm2qI8w= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D06E562E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d0f-001a-00eb-29b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1/zmjsju0wIa4AlQkr1lC+Ic8twMaALh0kqbdNBY1Vw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF0525A1"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d11-001a-00eb-2ab0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:AEtf+N9gzYmo3XZHkt6S2cUXg19N9B6/XT2JqlMI5jM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:06 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF06AC80"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d12-001a-00eb-2bb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YvCMCvFEVaTZ/sBt3TMl2ta/F+kK6/rfnJWCfsxjh1E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d13-001a-00eb-2cb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:a2syXpi8dIrxWypN0DD+qDFSspeh/AdcHqvw7pmDbCo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "1024" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF099327"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d14-001a-00eb-2db0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:g0dZIvufzyQK00tglozrFFmQ9QNsBGoCATEA6Y+RQ2Y= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d15-001a-00eb-2eb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YvCMCvFEVaTZ/sBt3TMl2ta/F+kK6/rfnJWCfsxjh1E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d16-001a-00eb-2fb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XLOTUr/0eAqgjwohCNW/4pzVFLXZGkHmRxfGGhZ7vCU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d17-001a-00eb-30b0-01f767000000 + 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 new file mode 100644 index 000000000..c1758a02c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMD5.yaml @@ -0,0 +1,230 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9JHT4PJ5bCFr9ivjH2zQpPyrjPAgGH7HQjbmF8qSH7M= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D07C6272"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d18-001a-00eb-31b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yczEHnO16dsS8Fhf/wP4UI3yMfCoP/merrMAKE702fY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "1024" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF130A8D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d1a-001a-00eb-32b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ///////////////////////////////////w== + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:X6gk6VwKaD937ABpb6Tdlgw0bm4OgBTDSivThnc1YsQ= + Content-Length: + - "1024" + Content-MD5: + - mokYsRh42lBvdhvBycTOFw== + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF152DC5"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d1b-001a-00eb-33b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fsSIZ0yIuNrHjmcb5H6EV1vcSkr6412M73dwluxIUig= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF152DC5"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d1c-001a-00eb-34b0-01f767000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EvsZinaVQY352dqbPc4L8iEpb2haYM2OfljrF0ZndbE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d1d-001a-00eb-35b0-01f767000000 + 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 new file mode 100644 index 000000000..44eee0c61 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMetadata.yaml @@ -0,0 +1,178 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nVrBOhx5myE8weznA/SRtZKxrUm5iDc6k96LApyVrUA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D087D645"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d1e-001a-00eb-36b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IPxrY/JjXRHcuHC1uKV8EEDl2SwpAwX3Jc/K5u/BHfk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "512" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF1EA52B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d20-001a-00eb-37b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7RbVv0w8PECnLsDwPKK4UxJP7j6Jr2zKGX5NSiPBtNI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF229D6A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d21-001a-00eb-38b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:o4UcyeQ8hGLaBGZrREIjLD40m7JhGs/Ztnd1Ztyu+B8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF229D6A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 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: + - f27d5d22-001a-00eb-39b0-01f767000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xv8lFthGufdIy7nXWs1mB5EO1o+vZtce6joImV2D3oY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d23-001a-00eb-3ab0-01f767000000 + 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 new file mode 100644 index 000000000..eb03b8ce7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileProperties.yaml @@ -0,0 +1,190 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kLntv6v7VpYoec9DXGJq38Nkfgoh72vt3dwUP1zWiEw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D0934A14"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d24-001a-00eb-3bb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:smoHW72Nt/+JwSlSkCuGxFERTg5VN7wYhK4bwEmeW4c= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "512" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF29F19C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d26-001a-00eb-3cb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6zV0FSrP+OZlhOgnfKUhLPXis6LlPGlK+JQoX1awiDw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 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: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF2C14D0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d27-001a-00eb-3db0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8xTAEMUCNTQDG/EL3WG3qS/Cqd4enqhKd7TITH2w758= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF2C14D0"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d28-001a-00eb-3eb0-01f767000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RK6wnIB/Xh7rzaqD+n1E1Av9bhUN9VCGi+abvmHsYX8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d29-001a-00eb-3fb0-01f767000000 + 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 new file mode 100644 index 000000000..225ebb9b0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileRanges.yaml @@ -0,0 +1,1033 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BHvrG/EK/K7GGRqxkQMe+qzmNyideRiSLvocdjGu6vc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7D09D0FE7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d2a-001a-00eb-40b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:G4muL8zFdaEgqWv9yGyAg/vnGNA25RgUwrk/T2n3N18= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "4096" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF33DE44"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d2c-001a-00eb-41b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:S7yP0Fs1TCXDDMW/TT7hR9DSsYof6K+/jBnJI8I0VBw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:06 GMT + Etag: + - '"0x8D4CFC7CF33DE44"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - f27d5d2d-001a-00eb-42b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GfHbhgAXUpJZG3Wa2+ahkHQiNpjFy0s+MkMoTA7yEf0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "4096" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF373A2B"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d2e-001a-00eb-43b0-01f767000000 + 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:La4WppocUWd/McPM3WqWw/ZhCzFsM7Qi0+eZnD/BbnE= + Content-Length: + - "4096" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF38E824"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d2f-001a-00eb-44b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L07PxfHuDN8inEZnobOPR4WRQtCFfUSKgY71lQ8toAw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF38E824"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - f27d5d30-001a-00eb-45b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yjGyk8R+YwYJQDPN91mVQ8X6UF6H5xka/yWUKQXuvvo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "4096" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF3BA7B5"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d31-001a-00eb-46b0-01f767000000 + 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:BGY1bnqKCB8JNU2lg8xZglocI6T9KbpQeSILnUJrcOQ= + Content-Length: + - "4096" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF3D55AA"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d32-001a-00eb-47b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZRRvpz6xFtqwKdl9Lp1q8fs/SFfML5oJgmW/67Hoh18= + Content-Length: + - "0" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF3EDC89"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d33-001a-00eb-48b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:it/deg01RcUSLZPATw0hKpRU4bvsCMAMTkGJ1H6pVow= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF3EDC89"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - f27d5d34-001a-00eb-49b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:b+9bd+qCS+r6x30YhhAe5XEyNueuRyHadjzH+WDzA1E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "4096" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF417504"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d35-001a-00eb-4ab0-01f767000000 + 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:BfEUadiDRdo3BGGahhGTlq2dizFsWyEfIo3wsRU/8pw= + Content-Length: + - "512" + Range: + - bytes=0-511 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF45E28A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d36-001a-00eb-4bb0-01f767000000 + 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:9BqVvxkzS++oWVgGxHnoEKp5zNTLV0I+M17OiFCEFBc= + Content-Length: + - "512" + Range: + - bytes=1024-1535 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF476965"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d37-001a-00eb-4cb0-01f767000000 + 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:nl0C5eUplvIa8k4+CP81B7ElFf1MBB5r6+NdqnSSV5A= + Content-Length: + - "512" + Range: + - bytes=2048-2559 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF48C932"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d38-001a-00eb-4db0-01f767000000 + 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:tx3l0evEgiK0zIjwDAWP/eIKKYDkcZQ4TqfXgVWpeXQ= + Content-Length: + - "512" + Range: + - bytes=3072-3583 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF4A500C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d39-001a-00eb-4eb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lvMLntfGvJps0/mKdJwEj33Ay4ie3PmpLYsCpD6ipZk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF4A500C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - f27d5d3a-001a-00eb-4fb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:j8M7j6+fu7r11WLeQLd+RmWghzEPdzx/yKna/Mfk+64= + Range: + - bytes=1000-3000 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF4A500C"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - f27d5d3b-001a-00eb-50b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:knph8Nd35EoOcG0jcRasSstys61OVbX/H3VHK04vrsM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "4096" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF4E4854"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d3c-001a-00eb-51b0-01f767000000 + 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:88UOW5dThadCasEPg8YZXJKDgS49JVt02oh0rZbRneM= + Content-Length: + - "4096" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF4FCF2F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d3d-001a-00eb-52b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0tmtiuyJbxdoMsEHitDDCDzA8RtACxgCC+6hFfuraJk= + Content-Length: + - "0" + Range: + - bytes=0-511 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF515612"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d3e-001a-00eb-53b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:P3A3MD7IbwFMsHUrV0Y1q1Iu5v0DEJbk0T+V1xAdQm0= + Content-Length: + - "0" + Range: + - bytes=2048-2559 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF52B5D6"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d3f-001a-00eb-54b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VLjhybdtDrj9X++XqR/ITsMDGcO5+hYEj8k4CxLVzKc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF52B5D6"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:04 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - f27d5d40-001a-00eb-55b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GbVOENpWX/iXjTEQukj8NOm69qbUULijR7XBeGXYDt8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d41-001a-00eb-56b0-01f767000000 + 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 new file mode 100644 index 000000000..7946eb1a9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestGetFile.yaml @@ -0,0 +1,322 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oPc5TtIrPZ+M4eYmhvgTP8VtGK7Cq1zPoLjF3jAdrIk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7D0C6234D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d42-001a-00eb-57b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GrQPtTsSWr/pV17ZhkNbVUfdxB24C3AxnSqOPfv59cQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-content-length: + - "1024" + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF5CF0B4"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d44-001a-00eb-58b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ///////////////////////////////////w== + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rWRYOFsKIuUvYQ4QYXJOXAOJor8QtUBkVlwqjCWMfPw= + Content-Length: + - "1024" + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF5EC5BB"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d45-001a-00eb-59b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZbW+y8LlkrljA+PyRV+AVDE1NcIIEwji1VGpEofkG8E= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF604CA2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d46-001a-00eb-5ab0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:o362WjGyM0dLiK7wOE2+126eknuQXNmpD8v2H59XKSU= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF604CA2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 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: + - f27d5d47-001a-00eb-5bb0-01f767000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5+ea0lx8tVGIVo75Lp+6DH0U1shTx49hu1JFLyU04zo= + Range: + - bytes=512-1023 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Etag: + - '"0x8D4CFC7CF604CA2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:05 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: + - f27d5d48-001a-00eb-5cb0-01f767000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0JeUjGcy7az99KkNdvCrcz1M5JADVXLQdl+2O7VBhT8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:07 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d49-001a-00eb-5db0-01f767000000 + 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 new file mode 100644 index 000000000..1209e3e52 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestDeleteMessages.yaml @@ -0,0 +1,156 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CxNO+XQHohFt9Nm5GPbtRZFA0gtaHdgEElf712z2Fs8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b1f5-0003-00da-25b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:500gzyuE0YAtK4k0YsByKoCCYf3/Pg+JQwgg0mDKYS8= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x34\x34\x61\x31\x66\x64\x64\x38\x2D\x66\x33\x39\x32\x2D\x34\x62\x31\x64\x2D\x61\x33\x35\x62\x2D\x38\x66\x37\x63\x65\x66\x65\x31\x33\x32\x33\x62\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x53\x4B\x2B\x2F\x72\x72\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b1fa-0003-00da-27b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MPVo9MTJIFtV5tL3ANEF15P0E8M4szXvc4EZvXyyJNs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x34\x34\x61\x31\x66\x64\x64\x38\x2D\x66\x33\x39\x32\x2D\x34\x62\x31\x64\x2D\x61\x33\x35\x62\x2D\x38\x66\x37\x63\x65\x66\x65\x31\x33\x32\x33\x62\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x76\x76\x4E\x5A\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\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\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, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b1fb-0003-00da-28b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:sabzrxbFg5432ZRs6zNkzlX4mOZyUcE7M9TxoM3I6WE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages/44a1fdd8-f392-4b1d-a35b-8f7cefe1323b?popreceipt=AgAAAAMAAAAAAAAAvvNZr7AB0wE%3D + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b1fc-0003-00da-29b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0TSUWfMLL/XtqHjs/H9C6yB31P5XBjTMpx8mjl8j7v4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b1fd-0003-00da-2ab0-011674000000 + 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 new file mode 100644 index 000000000..72a89c6e9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek.yaml @@ -0,0 +1,951 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7fGgJXKBO+YkZObVOH/vBTq5tHk65J2k+KosI1gIS/8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b201-0003-00da-2cb0-011674000000 + 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:EFTQet/AiEUuKy4KYmhYWEKSGIP3MYd9h3/cnmVeRfI= + Content-Length: + - "65592" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x35\x61\x63\x65\x32\x30\x62\x35\x2D\x65\x65\x34\x32\x2D\x34\x39\x34\x30\x2D\x61\x31\x63\x33\x2D\x34\x31\x33\x31\x66\x61\x33\x62\x61\x66\x39\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x49\x55\x72\x4C\x72\x72\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b204-0003-00da-2eb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IEnb1NeFZ79FzPkG/O/teIrO0/H/t3O+aPDRNaOqzuM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x35\x61\x63\x65\x32\x30\x62\x35\x2D\x65\x65\x34\x32\x2D\x34\x39\x34\x30\x2D\x61\x31\x63\x33\x2D\x34\x31\x33\x31\x66\x61\x33\x62\x61\x66\x39\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b205-0003-00da-2fb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jSyfMN+X6jsKMzV0w+S5vMlT/kofeJOhe7zt2s8/Rhs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b207-0003-00da-31b0-011674000000 + 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 new file mode 100644 index 000000000..5c64efc55 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek_Update_Delete.yaml @@ -0,0 +1,1049 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:I1xH0S4p/e7xmT+ggMEgdHIlBB4QgFpi4R+xHFHHyXI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b208-0003-00da-32b0-011674000000 + 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:FeGGR6nTVzaEWBSO3VWDXEHxJEpe/6QY1hfRyNihm20= + Content-Length: + - "65592" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x63\x37\x64\x33\x32\x66\x61\x34\x2D\x64\x37\x65\x61\x2D\x34\x39\x32\x64\x2D\x62\x36\x30\x66\x2D\x32\x30\x33\x61\x39\x37\x37\x35\x39\x64\x36\x32\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x6D\x71\x54\x5A\x72\x72\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b20a-0003-00da-33b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: and other message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0Md/1GExVeFSgprp15Z2Z/eo19RmtuwWmgmngbQ9GII= + Content-Length: + - "73" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x32\x32\x66\x35\x61\x38\x64\x33\x2D\x31\x31\x62\x66\x2D\x34\x65\x62\x65\x2D\x61\x65\x64\x36\x2D\x33\x35\x34\x39\x65\x36\x39\x33\x35\x63\x36\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x67\x53\x76\x62\x72\x72\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b20c-0003-00da-35b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Sb+JAXEHlmeHxu8eEmomEDpimqy9jPEmxu06kpQi4Ts= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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\x63\x37\x64\x33\x32\x66\x61\x34\x2D\x64\x37\x65\x61\x2D\x34\x39\x32\x64\x2D\x62\x36\x30\x66\x2D\x32\x30\x33\x61\x39\x37\x37\x35\x39\x64\x36\x32\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x55\x62\x67\x4E\x73\x4C\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x31\x30\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\x32\x32\x66\x35\x61\x38\x64\x33\x2D\x31\x31\x62\x66\x2D\x34\x65\x62\x65\x2D\x61\x65\x64\x36\x2D\x33\x35\x34\x39\x65\x36\x39\x33\x35\x63\x36\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x55\x62\x67\x4E\x73\x4C\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x31\x30\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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b20d-0003-00da-36b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: updated message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/zBWRSCWPJXAou6el3tbMJ1Gvgi1p9t7cyAaePJ7ZKE= + Content-Length: + - "71" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages/c7d32fa4-d7ea-492d-b60f-203a97759d62?popreceipt=AgAAAAMAAAAAAAAAUbgNsLAB0wE%3D&visibilitytimeout=2 + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Popreceipt: + - AwAAAAMAAAAAAAAAxtcRsLAB0wEBAAAA + X-Ms-Request-Id: + - 3fb9b20f-0003-00da-38b0-011674000000 + X-Ms-Time-Next-Visible: + - Thu, 20 Jul 2017 23:34:10 GMT + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yCeguGFNIS3iBA5538UfTR1OMQ3WpRW/hz0wXBA4vLI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages/22f5a8d3-11bf-4ebe-aed6-3549e6935c60?popreceipt=AgAAAAMAAAAAAAAAUbgNsLAB0wE%3D + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b210-0003-00da-39b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:z7bCCcQ8CwKKZVjHH8YUBa6uAPzkFxOzJ21xIF7W5vI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 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: + - Thu, 20 Jul 2017 23:34:07 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b211-0003-00da-3ab0-011674000000 + 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 new file mode 100644 index 000000000..37ae9b77a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestCreateQueue_DeleteQueue.yaml @@ -0,0 +1,62 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LmqdjlmtmJxNNkfm+K/Zsx8eeraNq1wBRMKc5NSOfXE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:08 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-45storagequeuesuitetestcreatequeuedeletequeue + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b21b-0003-00da-44b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:anhJBkMKfpfX0nhPVo08mbBWI7rKvzeWB+JUMW5ocoE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b21d-0003-00da-45b0-011674000000 + 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 new file mode 100644 index 000000000..b9d394544 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestDeleteMessages.yaml @@ -0,0 +1,156 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ugIl0tLStGE9ieq+m/qBHSO66Ake5Hq0mm4//lea2BI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b21e-0003-00da-46b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xb88RifYn2ijQMQNpWnk6fuAGNILvIAb6dtlI0ydK3M= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x37\x66\x34\x30\x64\x64\x36\x37\x2D\x33\x39\x36\x31\x2D\x34\x35\x32\x37\x2D\x62\x33\x61\x35\x2D\x62\x39\x66\x39\x62\x66\x37\x36\x64\x34\x66\x64\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x76\x31\x6B\x70\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b220-0003-00da-47b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:x1/yWzeg4Ayk9mBzVKbSEVrshG/pyDMb8y7TJf6xP1A= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x37\x66\x34\x30\x64\x64\x36\x37\x2D\x33\x39\x36\x31\x2D\x34\x35\x32\x37\x2D\x62\x33\x61\x35\x2D\x62\x39\x66\x39\x62\x66\x37\x36\x64\x34\x66\x64\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x44\x31\x44\x44\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\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\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b221-0003-00da-48b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zv03oSuSJZTBDKnIwVYdbsSvF28KUXFQPwV7IGtupoM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages/7f40dd67-3961-4527-b3a5-b9f9bf76d4fd?popreceipt=AgAAAAMAAAAAAAAAD1DDr7AB0wE%3D + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b222-0003-00da-49b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KagvDaaqCBL5vxPiV07KPlc90EUcd6fBK1Cp2GTLCFU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b223-0003-00da-4ab0-011674000000 + 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 new file mode 100644 index 000000000..155860ec8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestGetMessages.yaml @@ -0,0 +1,222 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IXhGHNEs+yP+lsGT9pNFwDUn0XV214OfL6WvQFWzfEw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b225-0003-00da-4cb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xpC5dATmVZXo7EAtdpSza/Se8/I3Xx9YeMkT2Emf57k= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x33\x38\x36\x33\x33\x38\x64\x33\x2D\x36\x63\x62\x30\x2D\x34\x37\x62\x66\x2D\x38\x31\x37\x66\x2D\x32\x38\x37\x66\x61\x31\x37\x66\x64\x61\x66\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x30\x75\x59\x78\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b227-0003-00da-4db0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xpC5dATmVZXo7EAtdpSza/Se8/I3Xx9YeMkT2Emf57k= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x62\x61\x66\x30\x61\x35\x35\x2D\x65\x34\x61\x35\x2D\x34\x62\x33\x65\x2D\x61\x36\x36\x65\x2D\x39\x30\x31\x64\x39\x65\x31\x39\x30\x32\x64\x65\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x6F\x6B\x59\x7A\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b229-0003-00da-4fb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xpC5dATmVZXo7EAtdpSza/Se8/I3Xx9YeMkT2Emf57k= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x30\x66\x62\x38\x39\x66\x37\x38\x2D\x39\x39\x65\x66\x2D\x34\x35\x33\x36\x2D\x39\x38\x65\x63\x2D\x65\x61\x33\x36\x31\x62\x34\x33\x38\x61\x38\x62\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x63\x71\x59\x30\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b22a-0003-00da-50b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xpC5dATmVZXo7EAtdpSza/Se8/I3Xx9YeMkT2Emf57k= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x64\x37\x31\x37\x32\x61\x30\x36\x2D\x38\x36\x39\x36\x2D\x34\x38\x63\x65\x2D\x62\x62\x32\x31\x2D\x37\x38\x61\x31\x33\x34\x66\x66\x65\x34\x38\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x57\x53\x30\x32\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b22b-0003-00da-51b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EIiX/z3W0SlaAs+UWi0J3PpgyESuvQnyT69Sg9jF9NE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x33\x38\x36\x33\x33\x38\x64\x33\x2D\x36\x63\x62\x30\x2D\x34\x37\x62\x66\x2D\x38\x31\x37\x66\x2D\x32\x38\x37\x66\x61\x31\x37\x66\x64\x61\x66\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x44\x67\x6B\x5A\x77\x62\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x33\x38\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\x62\x61\x66\x30\x61\x35\x35\x2D\x65\x34\x61\x35\x2D\x34\x62\x33\x65\x2D\x61\x36\x36\x65\x2D\x39\x30\x31\x64\x39\x65\x31\x39\x30\x32\x64\x65\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x44\x67\x6B\x5A\x77\x62\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x33\x38\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\x30\x66\x62\x38\x39\x66\x37\x38\x2D\x39\x39\x65\x66\x2D\x34\x35\x33\x36\x2D\x39\x38\x65\x63\x2D\x65\x61\x33\x36\x31\x62\x34\x33\x38\x61\x38\x62\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x44\x67\x6B\x5A\x77\x62\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x33\x38\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\x64\x37\x31\x37\x32\x61\x30\x36\x2D\x38\x36\x39\x36\x2D\x34\x38\x63\x65\x2D\x62\x62\x32\x31\x2D\x37\x38\x61\x31\x33\x34\x66\x66\x65\x34\x38\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x38\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\x44\x67\x6B\x5A\x77\x62\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x33\x38\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b22c-0003-00da-52b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:X+tEDdm3XtKov6vkWXiLr0KCeHsGjiHoAgl8ueTHcbo= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b22d-0003-00da-53b0-011674000000 + 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 new file mode 100644 index 000000000..21674f722 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestQueueExists.yaml @@ -0,0 +1,126 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:o8zz2ZlF6Ioo7wNTXkr2OUeS57WlHwX4j1VOi5mfprA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x33\x66\x62\x39\x62\x32\x32\x65\x2D\x30\x30\x30\x33\x2D\x30\x30\x64\x61\x2D\x35\x34\x62\x30\x2D\x30\x31\x31\x36\x37\x34\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x30\x38\x2E\x38\x36\x34\x39\x33\x38\x31\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b22e-0003-00da-54b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified queue does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:W6e8noq098jGyVgb97xobI0JFX3EoPlvQNBCbt251ns= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b230-0003-00da-55b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:paM55KP/FhD9vXFO4TsU6zAmdn3R1CX/T5sNQ48sEb4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "0" + X-Ms-Request-Id: + - 3fb9b233-0003-00da-57b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DkKvuzd7MoS6AFWNIlM/mBgUS+6IWo28HzaegMHYmII= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b234-0003-00da-58b0-011674000000 + 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 new file mode 100644 index 000000000..d00393eee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetMetadata_GetApproximateCount.yaml @@ -0,0 +1,280 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9JN+nRwe2PqLaVx4Ni9qQ0FkxwJvu2wOpGt+2y9Z+w8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b236-0003-00da-5ab0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fI2wimqrN97/396LtIZ3IkscZFFgf63WUmAoD4PoWuU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "0" + X-Ms-Request-Id: + - 3fb9b238-0003-00da-5bb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6TevVkCDKGyOJRTE40R2UapnUpeoBWKDjbCAwSWt19k= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b239-0003-00da-5cb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: lolrofl + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:piHm7RP9HDbQbgHwvnGDB9g0f4P/RGF9bDfrgQaly9c= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x62\x62\x32\x34\x38\x35\x62\x33\x2D\x62\x34\x37\x36\x2D\x34\x37\x63\x62\x2D\x62\x36\x63\x39\x2D\x36\x30\x37\x66\x35\x35\x36\x65\x39\x36\x63\x62\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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\x36\x67\x70\x49\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b23b-0003-00da-5db0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: lolrofl + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:piHm7RP9HDbQbgHwvnGDB9g0f4P/RGF9bDfrgQaly9c= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x37\x30\x34\x35\x65\x63\x38\x2D\x39\x30\x30\x32\x2D\x34\x30\x30\x62\x2D\x39\x65\x65\x33\x2D\x31\x63\x63\x31\x66\x61\x36\x38\x62\x63\x35\x65\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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\x6D\x70\x4A\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b23c-0003-00da-5eb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: lolrofl + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:piHm7RP9HDbQbgHwvnGDB9g0f4P/RGF9bDfrgQaly9c= + Content-Length: + - "63" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:09 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\x65\x36\x65\x30\x33\x63\x63\x61\x2D\x36\x64\x34\x39\x2D\x34\x64\x35\x65\x2D\x39\x65\x37\x36\x2D\x36\x61\x37\x66\x32\x36\x64\x63\x61\x32\x31\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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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\x32\x37\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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\x68\x73\x70\x4B\x72\x37\x41\x42\x30\x77\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\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\x3A\x30\x39\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, 20 Jul 2017 23:34:08 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b23d-0003-00da-5fb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:V4hC3XWOpzuTJ0n1OQYvIEJO+vfpfbN7hNvKd7Dlm1M= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "3" + X-Ms-Request-Id: + - 3fb9b258-0003-00da-75b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qCEGcM0AZiqgRR7eThfKi1Hczme8JWjGb7oepuAVXOY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b25b-0003-00da-78b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RFXlpS6SqnjwwFGwZa6/ieVZjl6sYM/ZifnrKS9fdEA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b25c-0003-00da-79b0-011674000000 + 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 new file mode 100644 index 000000000..72fddb11d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueNoTimeout.yaml @@ -0,0 +1,126 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FpnSgxgtFtI4QfhpcwrcQRtNJ150pFwdDjJuayjbdi8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b25e-0003-00da-7bb0-011674000000 + 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:mghqO8BSzGSq4KR9nTBHLIsy1CdNlmeunz8b/Et8gJs= + Content-Length: + - "233" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b260-0003-00da-7cb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PJk5OjFrLzlq1nOgVw05F88VGmp3AYMYg/QQUKcp8XA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b266-0003-00da-02b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QhnZhQyESB5/utsPU6oqvTOHwQpg1rTt0vwg5nU8gac= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b268-0003-00da-04b0-011674000000 + 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 new file mode 100644 index 000000000..a0a96e86d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueWithTimeout.yaml @@ -0,0 +1,126 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nw2BNblfgEcqwXJ20lMqrcW20HMRo79DhzkFM25HTEk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b26a-0003-00da-06b0-011674000000 + 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:6PPCwdSNLQWa9H8rlgXNYbDK/1jwVKXxoNMK7ApYq+s= + Content-Length: + - "233" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b26c-0003-00da-07b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0VXgWN8R0O6IiNNoIYpokNxyZt33+GQrZYy5KryuuRc= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b26d-0003-00da-08b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vzeYJNsUqXfKF+sMPyw/uO5h1585l7/4ia0zRzkvMeg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b26f-0003-00da-0ab0-011674000000 + 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 new file mode 100644 index 000000000..b73bf85b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAlternateTrueNoTimeout.yaml @@ -0,0 +1,126 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:uWYQOood5qLKK/KddxvLA9wt0d37uyoKQSxE0PQf/7A= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b270-0003-00da-0bb0-011674000000 + 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:b/NKUbITlMKRYFFWyCuj5hZ4jjWYa4uiAP2TMdD3Ua4= + Content-Length: + - "231" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b272-0003-00da-0cb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9/8kpC54+bDIVc4CL1nD3+JjFPevf2p/Tqxnps2XIqA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b273-0003-00da-0db0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5L51GqyfZw2ENOpgHD3jPOLgLnCVN6ocbiwfIXc2Zdg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b274-0003-00da-0eb0-011674000000 + 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 new file mode 100644 index 000000000..3cc8af806 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetMetadataGetMetadata_Roundtrips.yaml @@ -0,0 +1,132 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wW2mq+bRrBkNb/viGXY64Q+HBpzMzwlDYed0A+i1Z9o= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b276-0003-00da-10b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0f8oIYmwtp3sL3tj67D7+MmV15h+iE6vmiojpyY8XJQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b279-0003-00da-12b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eMYJj5oZLQZ9kR8YPVirnhCazGDsghNQi7Pp0lbhB70= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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, 20 Jul 2017 23:34:09 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: + - 3fb9b27a-0003-00da-13b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UaFMPGSqFewLfR7UjMp+z+rSEhcWgseEWGQqPl5WqJs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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, 20 Jul 2017 23:34:09 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b27b-0003-00da-14b0-011674000000 + 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 new file mode 100644 index 000000000..4cff51d30 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueNoTimeout.yaml @@ -0,0 +1,94 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:u/BG+m0RVjnnj+HLYpphZODYs/1TTWqlwol+XBDhYtg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b27d-0003-00da-16b0-011674000000 + 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:JZ8kCf0S+XzWk5vqaINV3YSNnfGRiDOC4R0qSGIHZHY= + Content-Length: + - "233" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b27f-0003-00da-17b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pHK1DHcE4+Y9k4T9DYfpsD/XA9GkvRIhBh5Ox9p5DaE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b280-0003-00da-18b0-011674000000 + 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 new file mode 100644 index 000000000..6904bda56 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueWithTimeout.yaml @@ -0,0 +1,94 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PyCCVuSqqSiOuGAUcvm+dXto/HmTrJqEu8XY7PwDZ0U= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b281-0003-00da-19b0-011674000000 + 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:2hdsDJo9HiC1qmjORJyDjqg3kOnos+Ic++htuQ2zgXc= + Content-Length: + - "233" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b283-0003-00da-1ab0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0A0pMHv+1XKIabCwC5zOFTxZIBem/FVZj9DYUtapcRw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b284-0003-00da-1bb0-011674000000 + 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 new file mode 100644 index 000000000..8f4561f14 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueNoTimeout.yaml @@ -0,0 +1,94 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8DSXfFvvBYuUC0GtyJhgnlazuDySvrshqStUHMhDOwE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b285-0003-00da-1cb0-011674000000 + 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:m8gvGlAYjv+dLLBxSUnpx7p7Gqx+ALuiiQlopc9iO18= + Content-Length: + - "231" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b288-0003-00da-1eb0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NA1h+3hsRccVexsFNhoj2+kZAJ0Tdeco4p0Gklbw10c= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b289-0003-00da-1fb0-011674000000 + 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 new file mode 100644 index 000000000..1cbdf13ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueWithTimeout.yaml @@ -0,0 +1,94 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LSzLOqSNC284OfeGGMP+vOXAdriXz1yGBOf0VQWvxUA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b28b-0003-00da-21b0-011674000000 + 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:M2JsqJFXrUzGiL4gQdwWNXarr36FnjNHdA4FSsK9rS8= + Content-Length: + - "231" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b28d-0003-00da-22b0-011674000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6BZhOOiB/dUrtLpSkRiNAhGGVNMITECq9AhWbl6s+6I= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + queue + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3fb9b28e-0003-00da-23b0-011674000000 + 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 new file mode 100644 index 000000000..3ad355ce6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareDeleteShare.yaml @@ -0,0 +1,64 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cYkgkonlaTDWbe9dbmIhY843BnVUNSrQged2b/K7FRI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-44storagesharesuitetestcreatesharedeleteshare?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2C670D2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d4c-001a-00eb-5eb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GPOA8ohsEVRnay2qxggkp/Jg5uByDgQVF2aYzmNlIKM= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-44storagesharesuitetestcreatesharedeleteshare?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d4e-001a-00eb-5fb0-01f767000000 + 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 new file mode 100644 index 000000000..aaef4931f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfExists.yaml @@ -0,0 +1,70 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZU1eQxdXLz2AhaYDNZnxUlDTWphQzBcfHUhFMGI91e4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 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\x66\x32\x37\x64\x35\x64\x35\x31\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x36\x31\x62\x30\x2D\x30\x31\x66\x37\x36\x37\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x31\x30\x2E\x38\x31\x36\x34\x37\x37\x30\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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d51-001a-00eb-61b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 409 The specified share already exists. + code: 409 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:r791oY8lCRJM2FH4ncgHbVvKXC83nVUY/4XZMfS8rfw= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-exists41storagesharesuitetestcreateshareifexists?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2CB2CA7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d52-001a-00eb-62b0-01f767000000 + 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 new file mode 100644 index 000000000..2eae91454 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfNotExists.yaml @@ -0,0 +1,64 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RSob1DYq7Bwjd5643+KwiVH64Zic71Gc8PBhSR+YE98= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-notexists44storagesharesuitetestcreateshareifnotexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2D1BD8A"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d54-001a-00eb-64b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4CiFOhEjA8ngwbXNpUFR8rDUQT5gabq0cbPAw1YPn6w= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:10 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-notexists44storagesharesuitetestcreateshareifnotexists?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d56-001a-00eb-65b0-01f767000000 + 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 new file mode 100644 index 000000000..68bc255ce --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestDeleteShareIfNotExists.yaml @@ -0,0 +1,96 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hjoYY+NksIiPIj/Y4cgop4ijSRLSCwc1a8TgxXMmTDI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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\x66\x32\x37\x64\x35\x64\x35\x37\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x36\x36\x62\x30\x2D\x30\x31\x66\x37\x36\x37\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x31\x30\x2E\x38\x37\x35\x35\x31\x39\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, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d57-001a-00eb-66b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified share does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8GoQpoU9Lm9It29JYtx33Hxe5wQoP1vt+Ua6cHnkbhI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestdeleteshareifnotexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2D715B7"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d58-001a-00eb-67b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BY3LXwOdjcUhD15lwuAYBMZYNhmOBFamIsTdKpmd4H0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestdeleteshareifnotexists?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d5a-001a-00eb-68b0-01f767000000 + 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 new file mode 100644 index 000000000..b85704166 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareMetadata.yaml @@ -0,0 +1,232 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xGXFMODU+qFQfa7JVlEXdoNYaZWLZZk8fmNBHm+5G5U= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2DBAA70"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d5b-001a-00eb-69b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Q0bjZIs6KMNFq8mRjaLiGyxIdj/d47KgkKTtbqMNd38= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2DBAA70"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d5d-001a-00eb-6ab0-01f767000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/Pk/661Q8R4D8XmsMc/P/Bey6ESwAD5IyViPiv2V8TA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2DE9125"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d5e-001a-00eb-6bb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LMeckiwd775iA+/VWURfU2Xf6c4RDX98rIxnulUiLUQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D3077A7D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d60-001a-00eb-6cb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dpnu4+CDjhXCPAHd0BADzz6BkijMTnyO+5SAWbEPOrs= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D3077A7D"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 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: + - f27d5d61-001a-00eb-6db0-01f767000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6ZVKCOl3jogi8glivkM6tfyqSNKx66oiB6fTc5NS8PY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d62-001a-00eb-6eb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CRoAuTG+Xk1yPz7SguN1WfOAFSVaMOm5ZrMSgdx01Sk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d63-001a-00eb-6fb0-01f767000000 + 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 new file mode 100644 index 000000000..045f1dc94 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareProperties.yaml @@ -0,0 +1,132 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mUjHdMzORvNR8Am7VzVTld3dmKEboC+0NTDotqxQNbU= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D2F8D4C2"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d64-001a-00eb-70b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+OV0vroc1eAoM5n0EOINbXKwsJVXyk8r0IBFAY9g6R0= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D316BF88"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d66-001a-00eb-71b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oX5Cpl/1sWXiiwVGrvmJUV6wMK12yuMfsGv8KiLv2dA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Etag: + - '"0x8D4CFC7D316BF88"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d67-001a-00eb-72b0-01f767000000 + X-Ms-Share-Quota: + - "55" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:i0EkYizemLId3iQvzVBPh3wrIK9rLFJPrtBAzdB1Fd4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d68-001a-00eb-73b0-01f767000000 + 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 new file mode 100644 index 000000000..ecfd370c5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestListShares.yaml @@ -0,0 +1,94 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hwUyuPRyBEn8JoR2AP3s8Ta1+TbmyEZUBYEFvY32JHY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-32storagesharesuitetestlistshares?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Etag: + - '"0x8D4CFC7D3061DAB"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d6a-001a-00eb-75b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mFtZkoZN/e6hvXj5MsuVxD8iHVoTZ8QpQDs/Gx7YMdg= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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\x54\x68\x75\x2C\x20\x32\x30\x20\x4A\x75\x6C\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x33\x34\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\x43\x46\x43\x37\x44\x33\x30\x36\x31\x44\x41\x42\"\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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d6c-001a-00eb-76b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cP05okd/67XBXuxDoMdIp3pYybxj/xajVGEGQGAYJZI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-32storagesharesuitetestlistshares?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d6d-001a-00eb-77b0-01f767000000 + 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 new file mode 100644 index 000000000..e032b5c81 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestMetadataCaseMunging.yaml @@ -0,0 +1,138 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8rdomzDinfP+oe8e6pPQV5ci9Rg7iYPjjgDH/vKbbOk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Etag: + - '"0x8D4CFC7D30BEB1E"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d6e-001a-00eb-78b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:OZsk/xDLUhR3HZ4+OGrlnETxCg2NWoJuCA+FJUXDVkk= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Etag: + - '"0x8D4CFC7D3254122"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d70-001a-00eb-79b0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PgZEFYxHUk1QHVpQcGOzGy50upuvftPK7S/uw5YEND4= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Etag: + - '"0x8D4CFC7D3254122"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 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: + - f27d5d71-001a-00eb-7ab0-01f767000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Rs75QTpMGKXgKIdb7IhGWyGRMCg1M1JEqOLdGgpRi7Y= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d72-001a-00eb-7bb0-01f767000000 + 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 new file mode 100644 index 000000000..af3db77af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestShareExists.yaml @@ -0,0 +1,130 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0TRVBtGEkwXlYjzb7nxxBWTABsqu8+4ahgzPoIrRwjI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-133storagesharesuitetestshareexists?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d73-001a-00eb-7cb0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified share does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:g4eyKbM5vV2/Ww/XjaYBULkZOisPK0UScIt09Y1wyn8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-233storagesharesuitetestshareexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Etag: + - '"0x8D4CFC7D316262F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d75-001a-00eb-7db0-01f767000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:f8OB0bhHPSj7pO9xnmBUWjq4SNAK0dYuEAfDQoRw+N8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-233storagesharesuitetestshareexists?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Etag: + - '"0x8D4CFC7D316262F"' + Last-Modified: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d77-001a-00eb-7eb0-01f767000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aZDcXzst80dQFi31YIv+VVwFJ+QQLPA3meUJLI33hrI= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + file + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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\x66\x32\x37\x64\x35\x64\x37\x38\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x37\x66\x62\x30\x2D\x30\x31\x66\x37\x36\x37\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x37\x2D\x32\x30\x54\x32\x33\x3A\x33\x34\x3A\x31\x31\x2E\x33\x31\x35\x38\x33\x38\x31\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, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - f27d5d78-001a-00eb-7fb0-01f767000000 + 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 new file mode 100644 index 000000000..4a2f23246 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestGetServiceProperties.yaml @@ -0,0 +1,34 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Lc5Iu8aQIcEM6scVM3h3Ofj4zDCUP+nHwPmsqFUJsz8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b8378-0002-0036-77b0-0102e5000000 + 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 new file mode 100644 index 000000000..38f04df04 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestSetServiceProperties.yaml @@ -0,0 +1,68 @@ +--- +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:Fe7IsgnehikmW/A2Lk6ZfYKu/fYlHCLJxinQFFwDP4o= + Content-Length: + - "868" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service + method: PUT + response: + body: "" + headers: + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b8379-0002-0036-78b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Lc5Iu8aQIcEM6scVM3h3Ofj4zDCUP+nHwPmsqFUJsz8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b8389-0002-0036-80b0-0102e5000000 + 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 new file mode 100644 index 000000000..cbdf3880b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestGet.yaml @@ -0,0 +1,129 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table25storagetablesuitetestget"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "48" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83aa-0002-0036-1bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:DqUkcRm63zw4TmTwylrWMEcfvZn0hr0PGTBVpCFMfbY= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83ad-0002-0036-1db0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:MzNNPvUsJ3Yvs8EMvrCpu+nw/kYLl8fcwCMTHrCCwZQ= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83ae-0002-0036-1eb0-0102e5000000 + 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 new file mode 100644 index 000000000..df12ce211 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestQueryTablesNextResults.yaml @@ -0,0 +1,345 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table044storagetablesuitetestque"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83b0-0002-0036-20b0-0102e5000000 + 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:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83b2-0002-0036-21b0-0102e5000000 + 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:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83b4-0002-0036-22b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - SharedKey golangrocksonazure:+ie5k0ENsVXuMQcRMsKBKucgFst485FsmoRa84lCmY8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Continuation-Nexttablename: + - 1!68!dGFibGUyMzdhdXRob3JpemF0aW9uc3VpdGV0ZXN0YWwBMDFkMzAxYjBhNjk0ZGM2Ng-- + X-Ms-Request-Id: + - 875b83b8-0002-0036-25b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - SharedKey golangrocksonazure:+ie5k0ENsVXuMQcRMsKBKucgFst485FsmoRa84lCmY8= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 GMT + x-ms-version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?%24top=2&NextTableName=1%2168%21dGFibGUyMzdhdXRob3JpemF0aW9uc3VpdGV0ZXN0YWwBMDFkMzAxYjBhNjk0ZGM2Ng-- + 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83b9-0002-0036-26b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:G3VjC5F0pN4rmQ3TabqrzUGbSZ3k/X9kYthgEiogG7c= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83ba-0002-0036-27b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:VOAzBykeqmnu0TU8UoC4ZOhZMuThGZ75IxkKoy6GmvM= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83bc-0002-0036-29b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:QrrZYflDOcJogkh+9FxN7sJ4oIdESsDYi+Zymh6Gs+o= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83be-0002-0036-2bb0-0102e5000000 + 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 new file mode 100644 index 000000000..cb6747652 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsSuccessfully.yaml @@ -0,0 +1,125 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table48storagetablesuitetestsetp"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83bf-0002-0036-2cb0-0102e5000000 + 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:yAXfVkGl+t0Nwk0ntZuWiXzaH4oXq+RR02AeYzb8DA0= + Content-Length: + - "233" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b83c3-0002-0036-2eb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:OpQ3mSoLXnLIf5GPw+l8rmTuYYcq1WDTDANhbazX8q0= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83c4-0002-0036-2fb0-0102e5000000 + 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 new file mode 100644 index 000000000..be6dc9ffa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsUnsuccessfully.yaml @@ -0,0 +1,41 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zraud + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TTOhdgM61gCd1KIVpfW3mTs72+fV2LWLUvYGz1VBbVk= + Content-Length: + - "233" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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:875b83c5-0002-0036-30b0-0102e5000000 + Time:2017-07-20T23:34:12.3131481Z + headers: + Content-Length: + - "316" + Content-Type: + - application/xml + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b83c5-0002-0036-30b0-0102e5000000 + 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 new file mode 100644 index 000000000..aa680eb21 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetThenGetPermissionsSuccessfully.yaml @@ -0,0 +1,155 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table55storagetablesuitetestsett"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83c6-0002-0036-31b0-0102e5000000 + 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:chL+8Y1ntGXu4CTa7IcQlwR0rdypR0jt3IJDvRlBy3Q= + Content-Length: + - "427" + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b83c9-0002-0036-33b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YYRP1w8Uf/252glfNa4xRIjURzkwmBfC6Ccte4oK7oQ= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 875b83ca-0002-0036-34b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:I5hkZTOE/6vMli0RhZYV0EPSnqWJdrezXeZUnA8mcZg= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83d2-0002-0036-3cb0-0102e5000000 + 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 new file mode 100644 index 000000000..f3959d850 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateAndDeleteTable.yaml @@ -0,0 +1,180 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table143storagetablesuitetestcre"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83d4-0002-0036-3eb0-0102e5000000 + 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:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83d6-0002-0036-3fb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:YFCX0dTjTqDMEk/ZfaaOf50KwyBNpG7C8HlgfoiMAoA= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83d9-0002-0036-41b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:DWkFD3nWcIh9MKXVFqsIqDM9HVxo9ajb87mrRm22CpM= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83dc-0002-0036-44b0-0102e5000000 + 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 new file mode 100644 index 000000000..c3ec37dd1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateTableWithAllResponsePayloadLevels.yaml @@ -0,0 +1,354 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"tableempty62storagetablesuitetes"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83de-0002-0036-46b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:xC3slrquGvAoOzBb0+T8R49ICVUjCCdr+PjNR4B0qR8= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83e3-0002-0036-4ab0-0102e5000000 + 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:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83e4-0002-0036-4bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:L15xWDK9uSSQVH5KULvyST4+ZUyNFvsUs1PRuEx5L/M= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83e6-0002-0036-4cb0-0102e5000000 + 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:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83e7-0002-0036-4db0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:umgNEV+gt+bireMnJucypufCwUYXMCMc5+5tJ27ru04= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83ea-0002-0036-4fb0-0102e5000000 + 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:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83ec-0002-0036-51b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:MXi2rIj5m0S9xgloMN5Iwi7IymShSKI/NROfTNOiZgg= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83ef-0002-0036-53b0-0102e5000000 + 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 new file mode 100644 index 000000000..c15feb3de --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertDeleteSameEntity.yaml @@ -0,0 +1,142 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table48tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:19qYKaIWscHZl0FyBetemFrlUveL2KInnVIO+UobRUI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34: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: + - 875b838c-0002-0036-03b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_ef29c3c4-6da3-11e7-98ad-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef29c3c4-6da3-11e7-98ac-6c3be5272b75\r\n\r\n\r\n--changeset_ef29c3c4-6da3-11e7-98ac-6c3be5272b75\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_ef29c3c4-6da3-11e7-98ac-6c3be5272b75\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_ef29c3c4-6da3-11e7-98ac-6c3be5272b75--\r\n\r\n--batch_ef29c3c4-6da3-11e7-98ad-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xpesUzw0nDp1bWkdipfYvyIor4UQFGDTXxLogQqC7Hk= + Content-Type: + - multipart/mixed; boundary=batch_ef29c3c4-6da3-11e7-98ad-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_c4dd3af6-4c42-4cb6-828e-243ff21e6083\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_88791cb4-6616-473a-8e2f-2166b7a8744c\r\n\r\n--changesetresponse_88791cb4-6616-473a-8e2f-2166b7a8744c\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:875b838e-0002-0036-04b0-0102e5000000\\nTime:2017-07-20T23:34:11.7237252Z\"}}}\r\n--changesetresponse_88791cb4-6616-473a-8e2f-2166b7a8744c--\r\n--batchresponse_c4dd3af6-4c42-4cb6-828e-243ff21e6083--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_c4dd3af6-4c42-4cb6-828e-243ff21e6083 + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b838e-0002-0036-04b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:MOsIZusDSZ3DMiB872Kyp2lKkkh8yZUUDVMgUBYMtQo= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b838f-0002-0036-05b0-0102e5000000 + 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 new file mode 100644 index 000000000..b76b5f02e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertMultipleEntities.yaml @@ -0,0 +1,179 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"tableme48tablebatchsuitetestbatc"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:19qYKaIWscHZl0FyBetemFrlUveL2KInnVIO+UobRUI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34: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: + - 875b8390-0002-0036-06b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_ef30a919-6da3-11e7-98ae-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef30a919-6da3-11e7-98ad-6c3be5272b75\r\n\r\n\r\n--changeset_ef30a919-6da3-11e7-98ad-6c3be5272b75\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_ef30a919-6da3-11e7-98ad-6c3be5272b75\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_ef30a919-6da3-11e7-98ad-6c3be5272b75--\r\n\r\n--batch_ef30a919-6da3-11e7-98ae-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pIYjrohstaWPRYFMNuYVUyxlUxdq9aCRNGHAjzi/zDo= + Content-Type: + - multipart/mixed; boundary=batch_ef30a919-6da3-11e7-98ae-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_7ef4657c-3d03-4124-be07-7d71bd88808d\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_ee6a4d77-21ad-4ba2-93f3-e410608d55e0\r\n\r\n--changesetresponse_ee6a4d77-21ad-4ba2-93f3-e410608d55e0\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-07-20T23%3A34%3A11.310459Z'\"\r\n\r\n\r\n--changesetresponse_ee6a4d77-21ad-4ba2-93f3-e410608d55e0\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-07-20T23%3A34%3A11.310459Z'\"\r\n\r\n\r\n--changesetresponse_ee6a4d77-21ad-4ba2-93f3-e410608d55e0--\r\n--batchresponse_7ef4657c-3d03-4124-be07-7d71bd88808d--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_7ef4657c-3d03-4124-be07-7d71bd88808d + Date: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8393-0002-0036-08b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:GqQQaMHDx7V1Tp0qG7gPxHtyxk29oBVbUBuXA3EbKOA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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-07-20T23%3A34%3A11.310459Z''\"","odata.editLink":"tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:11.310459Z","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-07-20T23%3A34%3A11.310459Z''\"","odata.editLink":"tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey2'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:11.310459Z","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: + - Thu, 20 Jul 2017 23:34:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8394-0002-0036-09b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:C2/AbzBy6EIXnncmFLw7Ihs07QehLuu4iIgB/frygq0= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8395-0002-0036-0ab0-0102e5000000 + 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 new file mode 100644 index 000000000..6b929a205 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertSameEntryMultipleTimes.yaml @@ -0,0 +1,142 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table54tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:19qYKaIWscHZl0FyBetemFrlUveL2KInnVIO+UobRUI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b8396-0002-0036-0bb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_ef3ab1db-6da3-11e7-98af-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef3ab1db-6da3-11e7-98ae-6c3be5272b75\r\n\r\n\r\n--changeset_ef3ab1db-6da3-11e7-98ae-6c3be5272b75\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_ef3ab1db-6da3-11e7-98ae-6c3be5272b75\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_ef3ab1db-6da3-11e7-98ae-6c3be5272b75--\r\n\r\n--batch_ef3ab1db-6da3-11e7-98af-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7IdD/1Tun94lauSYsUhPnbnBnMJJpivTtin34J6VmkI= + Content-Type: + - multipart/mixed; boundary=batch_ef3ab1db-6da3-11e7-98af-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_c968dcac-81f2-439a-95fb-f37fd0143b6f\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_54662dc2-48d9-4e1f-b2ac-30d400756d12\r\n\r\n--changesetresponse_54662dc2-48d9-4e1f-b2ac-30d400756d12\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:875b8398-0002-0036-0cb0-0102e5000000\\nTime:2017-07-20T23:34:11.8358056Z\"}}}\r\n--changesetresponse_54662dc2-48d9-4e1f-b2ac-30d400756d12--\r\n--batchresponse_c968dcac-81f2-439a-95fb-f37fd0143b6f--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_c968dcac-81f2-439a-95fb-f37fd0143b6f + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8398-0002-0036-0cb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:bgYxi5KDLsfPioNOqTap/xRGCPnSojDuZ2Z0a1tcZF4= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b8399-0002-0036-0db0-0102e5000000 + 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 new file mode 100644 index 000000000..ee97e7c5d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenDeleteDifferentBatches.yaml @@ -0,0 +1,253 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table58tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:19qYKaIWscHZl0FyBetemFrlUveL2KInnVIO+UobRUI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b839a-0002-0036-0eb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_ef43b2d5-6da3-11e7-98b0-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef43b2d5-6da3-11e7-98af-6c3be5272b75\r\n\r\n\r\n--changeset_ef43b2d5-6da3-11e7-98af-6c3be5272b75\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_ef43b2d5-6da3-11e7-98af-6c3be5272b75--\r\n\r\n--batch_ef43b2d5-6da3-11e7-98b0-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xjZfYClYVTJOJ1tU/NvPY6WWQtmkF5OqVS93aTyxTkQ= + Content-Type: + - multipart/mixed; boundary=batch_ef43b2d5-6da3-11e7-98b0-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_f1250f4a-401f-4ada-a9cb-c57703899695\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_b3e59e13-302f-4f87-8eeb-688f3b054e6f\r\n\r\n--changesetresponse_b3e59e13-302f-4f87-8eeb-688f3b054e6f\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-07-20T23%3A34%3A11.4335423Z'\"\r\n\r\n\r\n--changesetresponse_b3e59e13-302f-4f87-8eeb-688f3b054e6f--\r\n--batchresponse_f1250f4a-401f-4ada-a9cb-c57703899695--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_f1250f4a-401f-4ada-a9cb-c57703899695 + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b839c-0002-0036-0fb0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:ATu3YuroKjhD1Fnv6SzUC5vKGd7UmQsPNPIWL8mm7FA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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-07-20T23%3A34%3A11.4335423Z''\"","odata.editLink":"table58tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:11.4335423Z","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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b839d-0002-0036-10b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "--batch_ef4693ee-6da3-11e7-98b1-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef4693ee-6da3-11e7-98b0-6c3be5272b75\r\n\r\n\r\n--changeset_ef4693ee-6da3-11e7-98b0-6c3be5272b75\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_ef4693ee-6da3-11e7-98b0-6c3be5272b75--\r\n\r\n--batch_ef4693ee-6da3-11e7-98b1-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7QMgDil3hVjeRAmKHR//MRW2CbRt5kwFsgscp6oBexY= + Content-Type: + - multipart/mixed; boundary=batch_ef4693ee-6da3-11e7-98b1-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_25ad2038-a6df-4100-923f-f0bb6c6fc612\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_4f524076-9452-4381-a4e4-ad15fd393495\r\n\r\n--changesetresponse_4f524076-9452-4381-a4e4-ad15fd393495\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_4f524076-9452-4381-a4e4-ad15fd393495--\r\n--batchresponse_25ad2038-a6df-4100-923f-f0bb6c6fc612--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_25ad2038-a6df-4100-923f-f0bb6c6fc612 + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b839e-0002-0036-11b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:ATu3YuroKjhD1Fnv6SzUC5vKGd7UmQsPNPIWL8mm7FA= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b839f-0002-0036-12b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:faE0LSu1ImrYkrsQy7aphzNJFCVEhe+3tX8Bftglj0w= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:11 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83a0-0002-0036-13b0-0102e5000000 + 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 new file mode 100644 index 000000000..94e23c5e1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenMergeDifferentBatches.yaml @@ -0,0 +1,217 @@ +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table57tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:+tQ0CHBBr8KqtfNJZ9ipZgZ9CxD0Cuof10snosZI2GY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 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: + - 875b83a1-0002-0036-14b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_ef502eae-6da3-11e7-98b2-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef502eae-6da3-11e7-98b1-6c3be5272b75\r\n\r\n\r\n--changeset_ef502eae-6da3-11e7-98b1-6c3be5272b75\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_ef502eae-6da3-11e7-98b1-6c3be5272b75--\r\n\r\n--batch_ef502eae-6da3-11e7-98b2-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:p4aDPSDWPtWHLxL0afiP2BTiTAzqqUJJsmo/+gH51VU= + Content-Type: + - multipart/mixed; boundary=batch_ef502eae-6da3-11e7-98b2-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_0092b400-1327-4adb-898f-f4d6e46c73ac\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_5825ce38-5ad0-4180-ab9b-4a6a45daab73\r\n\r\n--changesetresponse_5825ce38-5ad0-4180-ab9b-4a6a45daab73\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-07-20T23%3A34%3A11.5165989Z'\"\r\n\r\n\r\n--changesetresponse_5825ce38-5ad0-4180-ab9b-4a6a45daab73--\r\n--batchresponse_0092b400-1327-4adb-898f-f4d6e46c73ac--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_0092b400-1327-4adb-898f-f4d6e46c73ac + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83a3-0002-0036-15b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "--batch_ef522a6a-6da3-11e7-98b2-6c3be5272b75\r\nContent-Type: multipart/mixed; + boundary=changeset_ef520338-6da3-11e7-98b2-6c3be5272b75\r\n\r\n\r\n--changeset_ef520338-6da3-11e7-98b2-6c3be5272b75\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_ef520338-6da3-11e7-98b2-6c3be5272b75--\r\n\r\n--batch_ef522a6a-6da3-11e7-98b2-6c3be5272b75--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tNel1+I2hXiwPgAE4BX1cNQDJbzRL4box0r2zilI/W0= + Content-Type: + - multipart/mixed; boundary=batch_ef522a6a-6da3-11e7-98b2-6c3be5272b75 + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + X-Ms-Date: + - Thu, 20 Jul 2017 23:34:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_f49b1e9e-5cfc-4fd2-9e82-1a380a311169\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_7f7984b9-5bac-401f-af1a-2636add0a36f\r\n\r\n--changesetresponse_7f7984b9-5bac-401f-af1a-2636add0a36f\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-07-20T23%3A34%3A11.5276068Z'\"\r\n\r\n\r\n--changesetresponse_7f7984b9-5bac-401f-af1a-2636add0a36f--\r\n--batchresponse_f49b1e9e-5cfc-4fd2-9e82-1a380a311169--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_f49b1e9e-5cfc-4fd2-9e82-1a380a311169 + Date: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83a4-0002-0036-16b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:91TdtgFChPr0gK/hnB5RCDztq97MUR2YuMLGqTbHZQE= + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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-07-20T23%3A34%3A11.5276068Z''\"","odata.editLink":"table57tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-07-20T23:34:11.5276068Z","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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83a5-0002-0036-17b0-0102e5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:9wdQsmwPzbYol+61CfE3hgAHLI+vtwG4PMjZ6VoMtZk= + Prefer: + - return-no-content + User-Agent: + - Go/go1.9beta1 (amd64-windows) azure-storage-go/10.0.2 api-version/2016-05-31 + table + x-ms-date: + - Thu, 20 Jul 2017 23:34:12 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: + - Thu, 20 Jul 2017 23:34:11 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 875b83a6-0002-0036-18b0-0102e5000000 + 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 new file mode 100644 index 000000000..e6a868081 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go @@ -0,0 +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{}) +} 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 new file mode 100644 index 000000000..2e207bdc9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/share_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..bee1c31ad --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..88700fbc9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go @@ -0,0 +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}) +} 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 new file mode 100644 index 000000000..713aeb8a2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..4eae3af9d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..7a0f0915c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go @@ -0,0 +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]))) + } +} 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 new file mode 100644 index 000000000..8b91efa0c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..fd17223db --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..895dcfded --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..d3ae9d092 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go @@ -0,0 +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", snapshot.Format("2006-01-02T15:04:05.0000000Z")) + } + 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 new file mode 100644 index 000000000..ec57f5056 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..a23fff1e2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/version.go @@ -0,0 +1,5 @@ +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 new file mode 100644 index 000000000..325986efa --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/.gitignore @@ -0,0 +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 diff --git a/vendor/github.com/Azure/go-autorest/.travis.yml b/vendor/github.com/Azure/go-autorest/.travis.yml new file mode 100644 index 000000000..583ae25d9 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/.travis.yml @@ -0,0 +1,21 @@ +sudo: false + +language: go + +go: + - 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 new file mode 100644 index 000000000..3a395ff95 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/CHANGELOG.md @@ -0,0 +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 diff --git a/vendor/github.com/Azure/go-autorest/LICENSE b/vendor/github.com/Azure/go-autorest/LICENSE new file mode 100644 index 000000000..b9d6a27ea --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (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 new file mode 100644 index 000000000..f4c34d0e6 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/README.md @@ -0,0 +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. diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md new file mode 100644 index 000000000..a17cf98c6 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md @@ -0,0 +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/ + +``` 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 new file mode 100644 index 000000000..baf4c17e7 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/cmd/adal.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go new file mode 100644 index 000000000..12375e0e4 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..e8a58809e --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config_test.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go new file mode 100644 index 000000000..6c511f8c8 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go @@ -0,0 +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) + } +} 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 new file mode 100644 index 000000000..f7bf0a79d --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken_test.go @@ -0,0 +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!") + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go new file mode 100644 index 000000000..73711c667 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..12c7ecbbb --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/persist_test.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go new file mode 100644 index 000000000..7928c971a --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go new file mode 100644 index 000000000..559fc6653 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -0,0 +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 } 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 new file mode 100644 index 000000000..9c92f4198 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token_test.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go new file mode 100644 index 000000000..7f4e3d845 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization.go @@ -0,0 +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) + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go b/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go new file mode 100644 index 000000000..d3f638880 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go @@ -0,0 +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") + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest.go b/vendor/github.com/Azure/go-autorest/autorest/autorest.go new file mode 100644 index 000000000..51f1c4bbc --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/autorest.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go b/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go new file mode 100644 index 000000000..58f650114 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go new file mode 100644 index 000000000..332a8909d --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..4c2c695fd --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async_test.go @@ -0,0 +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) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go new file mode 100644 index 000000000..3f4d13421 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go @@ -0,0 +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 + }) + } +} 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 new file mode 100644 index 000000000..ff014b518 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure_test.go @@ -0,0 +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) + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go new file mode 100644 index 000000000..1cf55651f --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..a36b34b40 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments_test.go @@ -0,0 +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) + } +} 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 new file mode 100644 index 000000000..b87e173fa --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/example/README.md @@ -0,0 +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. 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 new file mode 100644 index 000000000..f39b0a0df --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/example/main.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/client.go b/vendor/github.com/Azure/go-autorest/autorest/client.go new file mode 100644 index 000000000..b5f94b5c3 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/client.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/client_test.go b/vendor/github.com/Azure/go-autorest/autorest/client_test.go new file mode 100644 index 000000000..78a8a59ba --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/client_test.go @@ -0,0 +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) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/date.go b/vendor/github.com/Azure/go-autorest/autorest/date/date.go new file mode 100644 index 000000000..80ca60e9b --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/date.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..622f1f7ef --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/date_test.go @@ -0,0 +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") + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/time.go b/vendor/github.com/Azure/go-autorest/autorest/date/time.go new file mode 100644 index 000000000..c1af62963 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/time.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..0a7dd9eb6 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/time_test.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go new file mode 100644 index 000000000..11995fb9f --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..28f3ce213 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123_test.go @@ -0,0 +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() +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go new file mode 100644 index 000000000..e085c77ee --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..3d18fd600 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime_test.go @@ -0,0 +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() + } + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go new file mode 100644 index 000000000..207b1a240 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go @@ -0,0 +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)) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/error.go b/vendor/github.com/Azure/go-autorest/autorest/error.go new file mode 100644 index 000000000..4bcb8f27b --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/error.go @@ -0,0 +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) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/error_test.go b/vendor/github.com/Azure/go-autorest/autorest/error_test.go new file mode 100644 index 000000000..1975155ad --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/error_test.go @@ -0,0 +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()) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go new file mode 100644 index 000000000..add894605 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go @@ -0,0 +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())) +} 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 new file mode 100644 index 000000000..f726b26e5 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers_test.go @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000..dc3dd3b93 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks.go @@ -0,0 +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"` +} 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 new file mode 100644 index 000000000..f726b26e5 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks_test.go @@ -0,0 +1 @@ +package mocks diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer.go b/vendor/github.com/Azure/go-autorest/autorest/preparer.go new file mode 100644 index 000000000..afd114821 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/preparer.go @@ -0,0 +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 + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go b/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go new file mode 100644 index 000000000..1f715f9b2 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go @@ -0,0 +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) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder.go b/vendor/github.com/Azure/go-autorest/autorest/responder.go new file mode 100644 index 000000000..87f71e585 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/responder.go @@ -0,0 +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 "" +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder_test.go b/vendor/github.com/Azure/go-autorest/autorest/responder_test.go new file mode 100644 index 000000000..99b858b98 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/responder_test.go @@ -0,0 +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)) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go new file mode 100644 index 000000000..fb686de27 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go @@ -0,0 +1,73 @@ +package autorest + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" +) + +// RetriableRequest provides facilities for retrying an HTTP request. +type RetriableRequest struct { + req *http.Request + rc io.ReadCloser + br *bytes.Reader + reset bool +} + +// NewRetriableRequest returns a wrapper around an HTTP request that support retry logic. +func NewRetriableRequest(req *http.Request) *RetriableRequest { + return &RetriableRequest{req: req} +} + +// Request returns the wrapped HTTP request. +func (rr *RetriableRequest) Request() *http.Request { + return rr.req +} + +// Prepare signals that the request is about to be sent. +func (rr *RetriableRequest) Prepare() (err error) { + // preserve the request body; this is to support retry logic as + // the underlying transport will always close the reqeust body + if rr.req.Body != nil { + if rr.reset { + if rr.rc != nil { + rr.req.Body = rr.rc + } else if rr.br != nil { + _, err = rr.br.Seek(0, io.SeekStart) + } + rr.reset = false + if err != nil { + return err + } + } + if rr.req.GetBody != nil { + // this will allow us to preserve the body without having to + // make a copy. note we need to do this on each iteration + rr.rc, err = rr.req.GetBody() + if err != nil { + return err + } + } else if rr.br == nil { + // fall back to making a copy (only do this once) + b := []byte{} + if rr.req.ContentLength > 0 { + b = make([]byte, rr.req.ContentLength) + _, err = io.ReadFull(rr.req.Body, b) + if err != nil { + return err + } + } else { + b, err = ioutil.ReadAll(rr.req.Body) + if err != nil { + return err + } + } + rr.br = bytes.NewReader(b) + rr.req.Body = ioutil.NopCloser(rr.br) + } + // indicates that the request body needs to be reset + rr.reset = true + } + return err +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go new file mode 100644 index 000000000..9b88f329a --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/sender.go @@ -0,0 +1,274 @@ +package autorest + +import ( + "fmt" + "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) { + rr := NewRetriableRequest(r) + for attempt := 0; attempt < attempts; attempt++ { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = s.Do(rr.Request()) + 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) { + rr := NewRetriableRequest(r) + // Increment to add the first call (attempts denotes number of retries) + attempts++ + for attempt := 0; attempt < attempts; attempt++ { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = s.Do(rr.Request()) + 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) { + rr := NewRetriableRequest(r) + end := time.Now().Add(d) + for attempt := 0; time.Now().Before(end); attempt++ { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = s.Do(rr.Request()) + 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 new file mode 100644 index 000000000..d8e7beddb --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/sender_test.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go new file mode 100644 index 000000000..7b180b866 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go @@ -0,0 +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 +} 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 new file mode 100644 index 000000000..8c9835392 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert_test.go @@ -0,0 +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)) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go new file mode 100644 index 000000000..78067148b --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/utility.go @@ -0,0 +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() +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility_test.go b/vendor/github.com/Azure/go-autorest/autorest/utility_test.go new file mode 100644 index 000000000..99c16c97c --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/utility_test.go @@ -0,0 +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 + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utils/auth.go b/vendor/github.com/Azure/go-autorest/autorest/utils/auth.go new file mode 100644 index 000000000..5c09dbb2b --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/utils/auth.go @@ -0,0 +1,42 @@ +package utils + +import ( + "fmt" + "os" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" + "github.com/Azure/go-autorest/autorest/azure" +) + +// GetAuthorizer gets an Azure Service Principal authorizer. +// This func assumes "AZURE_TENANT_ID", "AZURE_CLIENT_ID", +// "AZURE_CLIENT_SECRET" are set as environment variables. +func GetAuthorizer(env azure.Environment) (*autorest.BearerAuthorizer, error) { + tenantID := GetEnvVarOrExit("AZURE_TENANT_ID") + + oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, tenantID) + if err != nil { + return nil, err + } + + clientID := GetEnvVarOrExit("AZURE_CLIENT_ID") + clientSecret := GetEnvVarOrExit("AZURE_CLIENT_SECRET") + + spToken, err := adal.NewServicePrincipalToken(*oauthConfig, clientID, clientSecret, env.ResourceManagerEndpoint) + if err != nil { + return nil, err + } + + return autorest.NewBearerAuthorizer(spToken), nil +} + +// GetEnvVarOrExit returns the value of specified environment variable or terminates if it's not defined. +func GetEnvVarOrExit(varName string) string { + value := os.Getenv(varName) + if value == "" { + fmt.Printf("Missing environment variable %s\n", varName) + os.Exit(1) + } + return value +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utils/commit.go b/vendor/github.com/Azure/go-autorest/autorest/utils/commit.go new file mode 100644 index 000000000..9c05f14a8 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/utils/commit.go @@ -0,0 +1,18 @@ +package utils + +import ( + "bytes" + "os/exec" +) + +// GetCommit returns git HEAD (short) +func GetCommit() string { + cmd := exec.Command("git", "rev-parse", "HEAD") + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + return "" + } + return string(out.Bytes()[:7]) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go new file mode 100644 index 000000000..d7b0eadc5 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go @@ -0,0 +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) +} 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 new file mode 100644 index 000000000..fdf822846 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation_test.go @@ -0,0 +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) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go new file mode 100644 index 000000000..a222e8efa --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/version.go @@ -0,0 +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 +} diff --git a/vendor/github.com/Azure/go-autorest/glide.lock b/vendor/github.com/Azure/go-autorest/glide.lock new file mode 100644 index 000000000..7c8ad81f3 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/glide.lock @@ -0,0 +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 diff --git a/vendor/github.com/Azure/go-autorest/glide.yaml b/vendor/github.com/Azure/go-autorest/glide.yaml new file mode 100644 index 000000000..dda283cc2 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/glide.yaml @@ -0,0 +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 diff --git a/vendor/github.com/dgrijalva/jwt-go/.gitignore b/vendor/github.com/dgrijalva/jwt-go/.gitignore new file mode 100644 index 000000000..80bed650e --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +bin + + diff --git a/vendor/github.com/dgrijalva/jwt-go/.travis.yml b/vendor/github.com/dgrijalva/jwt-go/.travis.yml new file mode 100644 index 000000000..bde823d8a --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/.travis.yml @@ -0,0 +1,8 @@ +language: go + +go: + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - tip diff --git a/vendor/github.com/dgrijalva/jwt-go/LICENSE b/vendor/github.com/dgrijalva/jwt-go/LICENSE new file mode 100644 index 000000000..df83a9c2f --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/LICENSE @@ -0,0 +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. + diff --git a/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md b/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md new file mode 100644 index 000000000..fd62e9490 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md @@ -0,0 +1,96 @@ +## 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(tokenString, request.OAuth2Extractor, req, keyLookupFunc); err == nil { + fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.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 new file mode 100644 index 000000000..00f613672 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/README.md @@ -0,0 +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:** A vulnerability in JWT was [recently published](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/). As this library doesn't force users to validate the `alg` is what they expected, it's possible your usage is effected. There will be an update soon to remedy this, and it will likey require backwards-incompatible changes to the API. In the short term, please make sure your implementation verifies the `alg` is what you expect. + + +## 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 new file mode 100644 index 000000000..b605b4509 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md @@ -0,0 +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 +* 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 new file mode 100644 index 000000000..f0228f02e --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/claims.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md new file mode 100644 index 000000000..4a68ba40a --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md @@ -0,0 +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\"} | bin/jwt -key test/sample_key -alg RS256 -sign - | bin/jwt -key test/sample_key.pub -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 new file mode 100644 index 000000000..c03711474 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/app.go @@ -0,0 +1,245 @@ +// 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") + + // Modes - exactly one of these is required + flagSign = flag.String("sign", "", "path to claims object to sign or '-' to read from stdin") + 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() { + // 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 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) + } + 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) + } + + // 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) + + 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 + } + } + } + + 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") +} diff --git a/vendor/github.com/dgrijalva/jwt-go/doc.go b/vendor/github.com/dgrijalva/jwt-go/doc.go new file mode 100644 index 000000000..a86dc1a3b --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/doc.go @@ -0,0 +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 diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go new file mode 100644 index 000000000..2f59a2223 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go @@ -0,0 +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 + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go new file mode 100644 index 000000000..753047b1e --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go @@ -0,0 +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) + } + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go new file mode 100644 index 000000000..d19624b72 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/errors.go b/vendor/github.com/dgrijalva/jwt-go/errors.go new file mode 100644 index 000000000..662df19d4 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/errors.go @@ -0,0 +1,63 @@ +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" + } + return e.Inner.Error() +} + +// No errors +func (e *ValidationError) valid() bool { + if e.Errors > 0 { + return false + } + return true +} diff --git a/vendor/github.com/dgrijalva/jwt-go/example_test.go b/vendor/github.com/dgrijalva/jwt-go/example_test.go new file mode 100644 index 000000000..ae8b788a0 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/example_test.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac.go b/vendor/github.com/dgrijalva/jwt-go/hmac.go new file mode 100644 index 000000000..c22991925 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/hmac.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go b/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go new file mode 100644 index 000000000..8fb567820 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go @@ -0,0 +1,64 @@ +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"]) + } + 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 new file mode 100644 index 000000000..c7e114f4f --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/hmac_test.go @@ -0,0 +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) +} diff --git a/vendor/github.com/dgrijalva/jwt-go/http_example_test.go b/vendor/github.com/dgrijalva/jwt-go/http_example_test.go new file mode 100644 index 000000000..82e9c50a4 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/http_example_test.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/map_claims.go b/vendor/github.com/dgrijalva/jwt-go/map_claims.go new file mode 100644 index 000000000..291213c46 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/map_claims.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/none.go b/vendor/github.com/dgrijalva/jwt-go/none.go new file mode 100644 index 000000000..f04d189d0 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/none.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/none_test.go b/vendor/github.com/dgrijalva/jwt-go/none_test.go new file mode 100644 index 000000000..29a69efef --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/none_test.go @@ -0,0 +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]) + } + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/parser.go b/vendor/github.com/dgrijalva/jwt-go/parser.go new file mode 100644 index 000000000..7020c52a1 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/parser.go @@ -0,0 +1,128 @@ +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 +} + +// 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 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 new file mode 100644 index 000000000..0c86801b9 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/parser_test.go @@ -0,0 +1,252 @@ +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}, + }, +} + +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") + } + + 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 new file mode 100644 index 000000000..c01069c98 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/doc.go @@ -0,0 +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 diff --git a/vendor/github.com/dgrijalva/jwt-go/request/extractor.go b/vendor/github.com/dgrijalva/jwt-go/request/extractor.go new file mode 100644 index 000000000..14414fe2f --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/extractor.go @@ -0,0 +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 + } +} 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 new file mode 100644 index 000000000..a994ffe58 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/extractor_example_test.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go b/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go new file mode 100644 index 000000000..e3bbb0a3e --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go b/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go new file mode 100644 index 000000000..5948694a5 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go @@ -0,0 +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"}, +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/request.go b/vendor/github.com/dgrijalva/jwt-go/request/request.go new file mode 100644 index 000000000..1807b3965 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/request.go @@ -0,0 +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 + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/request_test.go b/vendor/github.com/dgrijalva/jwt-go/request/request_test.go new file mode 100644 index 000000000..b4365cd86 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/request/request_test.go @@ -0,0 +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) + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa.go b/vendor/github.com/dgrijalva/jwt-go/rsa.go new file mode 100644 index 000000000..0ae0b1984 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/rsa.go @@ -0,0 +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 + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go b/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go new file mode 100644 index 000000000..10ee9db8a --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go @@ -0,0 +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 + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go b/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go new file mode 100644 index 000000000..9045aaf34 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go @@ -0,0 +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]) + } + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_test.go b/vendor/github.com/dgrijalva/jwt-go/rsa_test.go new file mode 100644 index 000000000..2e0f78536 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_test.go @@ -0,0 +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) +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go new file mode 100644 index 000000000..213a90dbb --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/signing_method.go b/vendor/github.com/dgrijalva/jwt-go/signing_method.go new file mode 100644 index 000000000..ed1f212b2 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/signing_method.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem new file mode 100644 index 000000000..a6882b3e5 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem @@ -0,0 +1,5 @@ +-----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 new file mode 100644 index 000000000..7191361e7 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec256-public.pem @@ -0,0 +1,4 @@ +-----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 new file mode 100644 index 000000000..a86c823e5 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec384-private.pem @@ -0,0 +1,6 @@ +-----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 new file mode 100644 index 000000000..e80d00564 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec384-public.pem @@ -0,0 +1,5 @@ +-----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 new file mode 100644 index 000000000..213afaf13 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec512-private.pem @@ -0,0 +1,7 @@ +-----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 new file mode 100644 index 000000000..02ea02203 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec512-public.pem @@ -0,0 +1,6 @@ +-----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 new file mode 100644 index 000000000..f84c3ef63 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/helpers.go @@ -0,0 +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 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/test/hmacTestKey b/vendor/github.com/dgrijalva/jwt-go/test/hmacTestKey new file mode 100644 index 000000000..435b8ddb3 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/hmacTestKey @@ -0,0 +1 @@ +#5K+~ew{Z(T(P.ZGwb="=.!r.O͚gЀ \ No newline at end of file diff --git a/vendor/github.com/dgrijalva/jwt-go/test/sample_key b/vendor/github.com/dgrijalva/jwt-go/test/sample_key new file mode 100644 index 000000000..abdbade31 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/sample_key @@ -0,0 +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----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub b/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub new file mode 100644 index 000000000..03dc982ac --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub @@ -0,0 +1,9 @@ +-----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 new file mode 100644 index 000000000..d637e0867 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/token.go @@ -0,0 +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) +} diff --git a/vendor/github.com/satori/uuid/.travis.yml b/vendor/github.com/satori/uuid/.travis.yml new file mode 100644 index 000000000..38517e2ed --- /dev/null +++ b/vendor/github.com/satori/uuid/.travis.yml @@ -0,0 +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 diff --git a/vendor/github.com/satori/uuid/LICENSE b/vendor/github.com/satori/uuid/LICENSE new file mode 100644 index 000000000..488357b8a --- /dev/null +++ b/vendor/github.com/satori/uuid/LICENSE @@ -0,0 +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. diff --git a/vendor/github.com/satori/uuid/README.md b/vendor/github.com/satori/uuid/README.md new file mode 100644 index 000000000..b6aad1c81 --- /dev/null +++ b/vendor/github.com/satori/uuid/README.md @@ -0,0 +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. diff --git a/vendor/github.com/satori/uuid/benchmarks_test.go b/vendor/github.com/satori/uuid/benchmarks_test.go new file mode 100644 index 000000000..b4e567fc6 --- /dev/null +++ b/vendor/github.com/satori/uuid/benchmarks_test.go @@ -0,0 +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() + } +} diff --git a/vendor/github.com/satori/uuid/uuid.go b/vendor/github.com/satori/uuid/uuid.go new file mode 100644 index 000000000..9c7fbaa54 --- /dev/null +++ b/vendor/github.com/satori/uuid/uuid.go @@ -0,0 +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 +} diff --git a/vendor/github.com/satori/uuid/uuid_test.go b/vendor/github.com/satori/uuid/uuid_test.go new file mode 100644 index 000000000..aa68ac94f --- /dev/null +++ b/vendor/github.com/satori/uuid/uuid_test.go @@ -0,0 +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) + } +} From 618ce115d7e6a604ff8547d8124dc1d178fa3406 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 5 Aug 2017 21:25:38 +0200 Subject: [PATCH 03/10] Azure: Use default HTTP transport --- internal/backend/azure/azure.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/backend/azure/azure.go b/internal/backend/azure/azure.go index d78c6625e..da6f21ef5 100644 --- a/internal/backend/azure/azure.go +++ b/internal/backend/azure/azure.go @@ -3,6 +3,7 @@ package azure import ( "context" "io" + "net/http" "os" "path" "strings" @@ -35,6 +36,8 @@ func open(cfg Config) (*Backend, error) { return nil, errors.Wrap(err, "NewBasicClient") } + client.HTTPClient = &http.Client{Transport: backend.Transport()} + service := client.GetBlobService() sem, err := backend.NewSemaphore(cfg.Connections) From 072b7a014e4da4da2cf2eef4b9d02f90b55c9a9f Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 5 Aug 2017 21:46:15 +0200 Subject: [PATCH 04/10] azure: User internal errors package --- internal/backend/azure/azure.go | 2 +- internal/backend/azure/azure_test.go | 2 +- internal/backend/azure/config.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/backend/azure/azure.go b/internal/backend/azure/azure.go index da6f21ef5..a59f1e1eb 100644 --- a/internal/backend/azure/azure.go +++ b/internal/backend/azure/azure.go @@ -10,9 +10,9 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/storage" - "github.com/pkg/errors" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/debug" + "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" ) diff --git a/internal/backend/azure/azure_test.go b/internal/backend/azure/azure_test.go index 813c0a1e3..4f59e3be9 100644 --- a/internal/backend/azure/azure_test.go +++ b/internal/backend/azure/azure_test.go @@ -2,7 +2,6 @@ package azure_test import ( "context" - "errors" "fmt" "os" "testing" @@ -10,6 +9,7 @@ import ( "github.com/restic/restic/internal/backend/azure" "github.com/restic/restic/internal/backend/test" + "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" . "github.com/restic/restic/internal/test" ) diff --git a/internal/backend/azure/config.go b/internal/backend/azure/config.go index e044ea7aa..9fb76ea4f 100644 --- a/internal/backend/azure/config.go +++ b/internal/backend/azure/config.go @@ -1,10 +1,10 @@ package azure import ( - "errors" "path" "strings" + "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/options" ) From d00fe95f10045140b964306320c75bc5ef6ad822 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 5 Aug 2017 22:15:29 +0200 Subject: [PATCH 05/10] Upgrade min Go version to 1.8 --- .travis.yml | 3 --- build.go | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83b495d41..ad3ad047b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: go sudo: false go: - - 1.7.6 - 1.8.3 - tip @@ -16,8 +15,6 @@ env: matrix: exclude: - - os: osx - go: 1.7.6 - os: osx go: tip - os: linux diff --git a/build.go b/build.go index d8259d559..57a87edd3 100644 --- a/build.go +++ b/build.go @@ -302,8 +302,8 @@ func (cs Constants) LDFlags() string { func main() { ver := runtime.Version() - if strings.HasPrefix(ver, "go1") && ver < "go1.7" { - fmt.Fprintf(os.Stderr, "Go version %s detected, restic requires at least Go 1.7\n", ver) + if strings.HasPrefix(ver, "go1") && ver < "go1.8" { + fmt.Fprintf(os.Stderr, "Go version %s detected, restic requires at least Go 1.8\n", ver) os.Exit(1) } From a726c91116b69e80a86102bf4240c40192d5eb18 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 6 Aug 2017 20:13:45 +0200 Subject: [PATCH 06/10] azure: Rework path initialization --- internal/backend/azure/config.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/backend/azure/config.go b/internal/backend/azure/config.go index 9fb76ea4f..15a2e5cf9 100644 --- a/internal/backend/azure/config.go +++ b/internal/backend/azure/config.go @@ -33,25 +33,25 @@ func init() { // ParseConfig parses the string s and extracts the azure config. The // configuration format is azure:containerName:/[prefix]. func ParseConfig(s string) (interface{}, error) { - if strings.HasPrefix(s, "azure:") { - s = s[6:] - } else { + if !strings.HasPrefix(s, "azure:") { return nil, errors.New("azure: invalid format") } - // use the first entry of the path as the container name and the - // remainder as prefix - path := strings.SplitN(s, ":/", 2) - return createConfig(path) -} -func createConfig(p []string) (interface{}, error) { - if len(p) < 2 { - return nil, errors.New("azure: invalid format, container name not found") + // strip prefix "azure:" + s = s[6:] + + // use the first entry of the path as the bucket name and the + // remainder as prefix + data := strings.SplitN(s, ":", 2) + if len(data) < 2 { + return nil, errors.New("azure: invalid format: bucket name or path not found") + } + container, path := data[0], path.Clean(data[1]) + if strings.HasPrefix(path, "/") { + path = path[1:] } cfg := NewConfig() - cfg.Container = p[0] - if p[1] != "" { - cfg.Prefix = path.Clean(p[1]) - } + cfg.Container = container + cfg.Prefix = path return cfg, nil } From d91d89eef6eac52e5f6d629961246cdf141073a0 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 6 Aug 2017 20:18:19 +0200 Subject: [PATCH 07/10] azure: Create container if it does not exist --- cmd/restic/global.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/restic/global.go b/cmd/restic/global.go index ca6ca65b1..a083d27ed 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -498,7 +498,7 @@ func create(s string, opts options.Options) (restic.Backend, error) { case "s3": return s3.Create(cfg.(s3.Config)) case "azure": - return azure.Open(cfg.(azure.Config)) + return azure.Create(cfg.(azure.Config)) case "swift": return swift.Open(cfg.(swift.Config)) case "b2": From bdd43bd430c3107c9f50e1dfcc638d8497ae85c5 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 9 Aug 2017 20:13:34 +0200 Subject: [PATCH 08/10] Add a section to the manual --- doc/manual.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/manual.rst b/doc/manual.rst index 0282acebd..5e55cead4 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -371,6 +371,33 @@ The number of concurrent connections to the B2 service can be set with the `-o b2.connections=10`. By default, at most five parallel connections are established. +Microsoft Azure Blob Storage +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can also store backups on Microsoft Azure Blob Storage. Export the Azure +account name and key as follows: + +.. code-block:: console + + $ export AZURE_ACCOUNT_NAME= + $ export AZURE_ACCOUNT_KEY= + +Afterwards you can initialize a repository in a container called `foo` in the +root path like this: + +.. code-block:: console + + $ restic -r azure:foo:/ init + enter password for new backend: + enter password again: + + created restic backend a934bac191 at azure:foo:/ + [...] + +The number of concurrent connections to the B2 service can be set with the +`-o azure.connections=10`. By default, at most five parallel connections are +established. + Password prompt on Windows ~~~~~~~~~~~~~~~~~~~~~~~~~~ From a3453869672843e17586b48dfbae42462f3d90bf Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 9 Aug 2017 20:15:08 +0200 Subject: [PATCH 09/10] Add a section to the CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c15cccc5d..c86f2743f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ Important Changes in 0.X.Y vendoring the dependencies is now taken care of by `dep`. https://github.com/restic/restic/pull/1126 + * We've added support for Microsoft Azure Blob Storage as a restic backend. + https://github.com/restic/restic/pull/1149 + https://github.com/restic/restic/pull/1059 + https://github.com/restic/restic/issues/609 + Small changes ------------- From c4613c51d194b35cb922f1b63e6729d953f3ac78 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 9 Aug 2017 20:33:30 +0200 Subject: [PATCH 10/10] Add note about Go 1.8 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c86f2743f..6616f583c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ Important Changes in 0.X.Y https://github.com/restic/restic/pull/1059 https://github.com/restic/restic/issues/609 + * In the course of supporting Microsoft Azure Blobe Storage Go 1.8 is now a + requirement to build restic. + Small changes -------------