From bf420eac41b0e69f59ad81b4737be4a4349a4313 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Thu, 28 Mar 2019 09:01:06 -0700 Subject: [PATCH] Remove sfmesh provider (#550) This is not being supported and as such it was requested (internally) to be removed. --- CONTRIBUTING.md | 4 - Gopkg.lock | 104 +- README.md | 14 - providers/register/provider_sfmesh.go | 22 - providers/sfmesh/README.md | 64 - providers/sfmesh/errors.go | 48 - providers/sfmesh/sfmesh.go | 851 -------- providers/sfmesh/sfmesh_test.go | 68 - .../mgmt/servicefabricmesh/models.go | 233 --- .../servicefabricmesh/application.go | 439 ---- .../servicefabricmesh/client.go | 51 - .../servicefabricmesh/codepackage.go | 117 -- .../servicefabricmesh/models.go | 1835 ----------------- .../servicefabricmesh/network.go | 441 ---- .../servicefabricmesh/operations.go | 126 -- .../servicefabricmesh/replica.go | 210 -- .../servicefabricmesh/service.go | 205 -- .../servicefabricmesh/version.go | 30 - .../servicefabricmesh/volume.go | 443 ---- website/data/providers.yaml | 2 - 20 files changed, 50 insertions(+), 5257 deletions(-) delete mode 100644 providers/register/provider_sfmesh.go delete mode 100644 providers/sfmesh/README.md delete mode 100644 providers/sfmesh/errors.go delete mode 100644 providers/sfmesh/sfmesh.go delete mode 100644 providers/sfmesh/sfmesh_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/application.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/codepackage.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/network.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/operations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/replica.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/service.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/version.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/volume.go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 91d3ca4b6..4bc23c846 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,10 +47,6 @@ Onur Filiz (onfiliz@amazon.com) (TBA) -**Service Fabric Mesh** - -Yaron Schneider (yaronsc@microsoft.com) - **Huawei** Fei Xu (xufei40@huawei.com) diff --git a/Gopkg.lock b/Gopkg.lock index a483ef06e..f2b758068 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -19,14 +19,12 @@ source = "github.com/apache/thrift" [[projects]] - digest = "1:c456e3cf993b0d01022ea6202c60aa9500bfef3e956a516c3a74c6a2cb6d4c09" + digest = "1:9a03bb56966318a3668ed18e91ac069b816961b736486e973034893905da67a3" name = "github.com/Azure/azure-sdk-for-go" packages = [ - "profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh", "services/batch/2017-09-01.6.0/batch", "services/network/mgmt/2018-08-01/network", - "services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh", - "version" + "version", ] pruneopts = "NUT" revision = "6d20bdbae88c06c36d72eb512295417693bfdf4e" @@ -38,7 +36,7 @@ name = "github.com/Azure/go-ansiterm" packages = [ ".", - "winterm" + "winterm", ] pruneopts = "NUT" revision = "d6e3b3328b783f23731bc4d058875b0371ff8109" @@ -55,7 +53,7 @@ "autorest/to", "autorest/validation", "logger", - "version" + "version", ] pruneopts = "NUT" revision = "9bc4033dd347c7f416fca46b2f42a043dc1fbdf6" @@ -113,7 +111,7 @@ "sdk/errors", "sdk/requests", "sdk/responses", - "sdk/utils" + "sdk/utils", ] pruneopts = "NUT" revision = "cad214d7d71fba7883fcf3b7e550ba782c15b400" @@ -172,7 +170,7 @@ "service/ecs", "service/ecs/ecsiface", "service/iam", - "service/sts" + "service/sts", ] pruneopts = "NUT" revision = "2e04cd1d1af06ff041e6036745e8b100e2e5f426" @@ -192,7 +190,7 @@ packages = [ "gen-go/agent/common/v1", "gen-go/agent/trace/v1", - "gen-go/trace/v1" + "gen-go/trace/v1", ] pruneopts = "NUT" revision = "24333298e36590ea0716598caacc8959fc393c48" @@ -204,7 +202,7 @@ packages = [ ".", "status", - "status/ocstatus" + "status/ocstatus", ] pruneopts = "NUT" revision = "05f877ca1e627f0a1e01902ba78c63f1ef7db5a3" @@ -242,7 +240,7 @@ "context", "digest", "reference", - "uuid" + "uuid", ] pruneopts = "NUT" revision = "48294d928ced5dd9b378f7fd7c6f5da3ff3f2c89" @@ -294,7 +292,7 @@ "pkg/term/windows", "pkg/truncindex", "plugin/v2", - "reference" + "reference", ] pruneopts = "NUT" revision = "49bf474f9ed7ce7143a59d1964ff7b7fd9b52178" @@ -305,7 +303,7 @@ packages = [ "nat", "sockets", - "tlsconfig" + "tlsconfig", ] pruneopts = "NUT" revision = "3ede32e2033de7505e6500d6c868c2b9ed9f169d" @@ -324,7 +322,7 @@ name = "github.com/docker/libnetwork" packages = [ "iptables", - "portallocator" + "portallocator", ] pruneopts = "NUT" revision = "1ee720e18fe98dceda6039bdd005ffbcb359d343" @@ -336,7 +334,7 @@ name = "github.com/docker/spdystream" packages = [ ".", - "spdy" + "spdy", ] pruneopts = "NUT" revision = "bc6354cbbc295e925e4c611ffe90c1f287ee54db" @@ -400,7 +398,7 @@ name = "github.com/go-openapi/loads" packages = [ ".", - "fmts" + "fmts", ] pruneopts = "NUT" revision = "6bb6486231e079ea125c0f39994ed3d0c53399ed" @@ -410,7 +408,7 @@ name = "github.com/go-openapi/runtime" packages = [ ".", - "client" + "client", ] pruneopts = "NUT" revision = "3b13ebb46790d871d74a6c2450fa4b1280f90854" @@ -460,7 +458,7 @@ "gogoproto", "proto", "protoc-gen-gogo/descriptor", - "sortkeys" + "sortkeys", ] pruneopts = "NUT" revision = "1adfc126b41513cc696b209667c8656ea7aac67c" @@ -491,7 +489,7 @@ "ptypes/any", "ptypes/duration", "ptypes/timestamp", - "ptypes/wrappers" + "ptypes/wrappers", ] pruneopts = "NUT" revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" @@ -548,7 +546,7 @@ packages = [ "OpenAPIv2", "compiler", - "extensions" + "extensions", ] pruneopts = "NUT" revision = "ee43cbb60db7bd22502942cccbc39059117352ab" @@ -592,7 +590,7 @@ name = "github.com/gregjones/httpcache" packages = [ ".", - "diskcache" + "diskcache", ] pruneopts = "NUT" revision = "9cad4c3443a7200dd6400aef47183728de563a38" @@ -602,7 +600,7 @@ name = "github.com/hashicorp/consul" packages = [ "api", - "lib/freeport" + "lib/freeport", ] pruneopts = "NUT" revision = "0bddfa23a2ebe3c0773d917fc104f53d74f7a5ec" @@ -685,7 +683,7 @@ name = "github.com/hashicorp/golang-lru" packages = [ ".", - "simplelru" + "simplelru", ] pruneopts = "NUT" revision = "20f1fb78b0740ba8c3cb143a61e86ba5c8669768" @@ -705,7 +703,7 @@ "hcl/token", "json/parser", "json/scanner", - "json/token" + "json/token", ] pruneopts = "NUT" revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168" @@ -725,7 +723,7 @@ "helper/uuid", "nomad/structs", "nomad/structs/config", - "testutil" + "testutil", ] pruneopts = "NUT" revision = "v0.8.6" @@ -756,7 +754,7 @@ "helper/hclutil", "helper/jsonutil", "helper/parseutil", - "helper/strutil" + "helper/strutil", ] pruneopts = "NUT" revision = "08df121c8b9adcc2b8fd55fc8506c3f9714c7e61" @@ -832,7 +830,7 @@ packages = [ "buffer", "jlexer", - "jwriter" + "jwriter", ] pruneopts = "NUT" revision = "3fdea8d05856a0c8df22ed4bc71b3219245e4485" @@ -908,7 +906,7 @@ "libcontainer/configs", "libcontainer/devices", "libcontainer/system", - "libcontainer/user" + "libcontainer/user", ] pruneopts = "NUT" revision = "baf6536d6259209c3edfa2b22237af82942d3dfa" @@ -958,7 +956,7 @@ name = "github.com/pierrec/lz4" packages = [ ".", - "internal/xxh32" + "internal/xxh32", ] pruneopts = "NUT" revision = "635575b42742856941dbc767b44905bb9ba083f6" @@ -1001,7 +999,7 @@ name = "github.com/spf13/afero" packages = [ ".", - "mem" + "mem", ] pruneopts = "NUT" revision = "63644898a8da0bc22138abf860edaf5277b6102e" @@ -1061,7 +1059,7 @@ packages = [ "assert", "mock", - "require" + "require", ] pruneopts = "NUT" revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71" @@ -1088,7 +1086,7 @@ packages = [ "archive/tar", "tar/asm", - "tar/storage" + "tar/storage", ] pruneopts = "NUT" revision = "38ec4ddb06dedbea0a895c4848b248eb38af221b" @@ -1101,7 +1099,7 @@ "client", "client/aci", "client/api", - "client/network" + "client/network", ] pruneopts = "NUT" revision = "2e12def8b355625e62ffdb319e7c0b26d1d9c15d" @@ -1112,7 +1110,7 @@ name = "github.com/vishvananda/netlink" packages = [ ".", - "nl" + "nl", ] pruneopts = "NUT" revision = "482f7a52b758233521878cb6c5904b6bd63f3457" @@ -1145,7 +1143,7 @@ "vim25/progress", "vim25/soap", "vim25/types", - "vim25/xml" + "vim25/xml", ] pruneopts = "NUT" revision = "123ed177021588bac57b5c87c1a84270ddf2eca8" @@ -1196,7 +1194,7 @@ "pkg/vsphere/extraconfig", "pkg/vsphere/performance", "pkg/vsphere/session", - "pkg/vsphere/sys" + "pkg/vsphere/sys", ] pruneopts = "NUT" revision = "c7d40ac878b09c577c307bc5331c7dd39619ed7c" @@ -1210,7 +1208,7 @@ "message", "rpcout", "rpcvmx", - "vmcheck" + "vmcheck", ] pruneopts = "NUT" revision = "25eff159a728be87e103a0b8045e08273f4dbec4" @@ -1236,7 +1234,7 @@ "trace/propagation", "trace/tracestate", "zpages", - "zpages/internal" + "zpages/internal", ] pruneopts = "NUT" revision = "79993219becaa7e29e3b60cb67f5b8e82dee11d6" @@ -1254,7 +1252,7 @@ "pkcs12/internal/rc2", "poly1305", "salsa20/salsa", - "ssh/terminal" + "ssh/terminal", ] pruneopts = "NUT" revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908" @@ -1274,7 +1272,7 @@ "internal/timeseries", "proxy", "trace", - "websocket" + "websocket", ] pruneopts = "NUT" revision = "f73e4c9ed3b7ebdd5f699a16a880c2b1994e50dd" @@ -1285,7 +1283,7 @@ name = "golang.org/x/oauth2" packages = [ ".", - "internal" + "internal", ] pruneopts = "NUT" revision = "c57b0facaced709681d9f90397429b9430a74754" @@ -1296,7 +1294,7 @@ name = "golang.org/x/sync" packages = [ "errgroup", - "semaphore" + "semaphore", ] pruneopts = "NUT" revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca" @@ -1308,7 +1306,7 @@ packages = [ "cpu", "unix", - "windows" + "windows", ] pruneopts = "NUT" revision = "7dfd1290c7917b7ba22824b9d24954ab3002fe24" @@ -1331,7 +1329,7 @@ "unicode/cldr", "unicode/norm", "unicode/rangetable", - "width" + "width", ] pruneopts = "NUT" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" @@ -1363,7 +1361,7 @@ "internal/log", "internal/remote_api", "internal/urlfetch", - "urlfetch" + "urlfetch", ] pruneopts = "NUT" revision = "ae0ab99deb4dc413a2b4bd6c8bdd0eb67f1e4d06" @@ -1404,7 +1402,7 @@ "stats", "status", "tap", - "transport" + "transport", ] pruneopts = "NUT" revision = "41344da2231b913fa3d983840a57a6b1b7b631a1" @@ -1475,7 +1473,7 @@ "settings/v1alpha1", "storage/v1", "storage/v1alpha1", - "storage/v1beta1" + "storage/v1beta1", ] pruneopts = "NUT" revision = "05914d821849570fba9eacfb29466f2d8d3cd229" @@ -1531,7 +1529,7 @@ "pkg/watch", "third_party/forked/golang/json", "third_party/forked/golang/netutil", - "third_party/forked/golang/reflect" + "third_party/forked/golang/reflect", ] pruneopts = "NUT" revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd" @@ -1543,7 +1541,7 @@ name = "k8s.io/apiserver" packages = [ "pkg/server/httplog", - "pkg/util/wsstream" + "pkg/util/wsstream", ] pruneopts = "NUT" revision = "25e79651c7e569b0ebcd97affc0fe7f1ffcbee94" @@ -1725,7 +1723,7 @@ "util/homedir", "util/integer", "util/retry", - "util/workqueue" + "util/workqueue", ] pruneopts = "NUT" revision = "8d9ed539ba3134352c586810e749e58df4e94e4f" @@ -1757,7 +1755,7 @@ "pkg/fieldpath", "pkg/kubelet/apis/cri/runtime/v1alpha2", "pkg/kubelet/apis/stats/v1alpha1", - "pkg/kubelet/server/remotecommand" + "pkg/kubelet/server/remotecommand", ] pruneopts = "NUT" revision = "c27b913fddd1a6c480c229191a087698aa92f0b1" @@ -1784,12 +1782,10 @@ analyzer-version = 1 input-imports = [ "contrib.go.opencensus.io/exporter/ocagent", - "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh", "github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch", "github.com/Azure/go-autorest/autorest", "github.com/Azure/go-autorest/autorest/adal", "github.com/Azure/go-autorest/autorest/azure", - "github.com/Azure/go-autorest/autorest/azure/auth", "github.com/Azure/go-autorest/autorest/to", "github.com/BurntSushi/toml", "github.com/Sirupsen/logrus", @@ -1894,7 +1890,7 @@ "k8s.io/kubernetes/pkg/fieldpath", "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2", "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1", - "k8s.io/kubernetes/pkg/kubelet/server/remotecommand" + "k8s.io/kubernetes/pkg/kubelet/server/remotecommand", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/README.md b/README.md index 6b1be387e..b539a2999 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ The best description is "Kubernetes API on top, programmable back." + [Azure Container Instances Provider](#azure-container-instances-provider) + [Azure Batch GPU Provider](./providers/azurebatch/README.md) + [AWS Fargate Provider](#aws-fargate-provider) - + [Service Fabric Mesh Provider](#service-fabric-mesh-provider) + [HashiCorp Nomad](#hashicorp-nomad-provider) + [Adding a New Provider via the Provider Interface](#adding-a-new-provider-via-the-provider-interface) * [Testing](#testing) @@ -177,19 +176,6 @@ co-exist with pods on regular worker nodes in the same Kubernetes cluster. Easy instructions and a sample configuration file is available in the [AWS Fargate provider documentation](providers/aws/README.md). -### Service Fabric Mesh Provider - -The Service Fabric Mesh Provider allows you to deploy pods to Azure [Service Fabric Mesh](https://docs.microsoft.com/en-us/azure/service-fabric-mesh/service-fabric-mesh-overview). - -Service Fabric Mesh is a fully managed service that lets developers deploy microservices without managing the underlying infrastructure. - Pods deployed to Service Fabric Mesh will be assigned Public IPs from the Service Fabric Mesh network. - -``` -./bin/virtual-kubelet --provider sfmesh --taint azure.com/sfmesh -``` - -More detailed instructions can be found [here](providers/sfmesh/README.md). - ### HashiCorp Nomad Provider HashiCorp Nomad provider for Virtual Kubelet connects your Kubernetes cluster diff --git a/providers/register/provider_sfmesh.go b/providers/register/provider_sfmesh.go deleted file mode 100644 index 97e600a99..000000000 --- a/providers/register/provider_sfmesh.go +++ /dev/null @@ -1,22 +0,0 @@ -// +build sfmesh_provider - -package register - -import ( - "github.com/virtual-kubelet/virtual-kubelet/providers" - "github.com/virtual-kubelet/virtual-kubelet/providers/sfmesh" -) - -func init() { - register("sfmesh", sfmeshInit) -} - -func sfmeshInit(cfg InitConfig) (providers.Provider, error) { - return sfmesh.NewSFMeshProvider( - cfg.ResourceManager, - cfg.NodeName, - cfg.OperatingSystem, - cfg.InternalIP, - cfg.DaemonPort, - ) -} diff --git a/providers/sfmesh/README.md b/providers/sfmesh/README.md deleted file mode 100644 index 89e338943..000000000 --- a/providers/sfmesh/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# Kubernetes Virtual Kubelet with Service Fabric Mesh - -[Service Fabric Mesh](https://docs.microsoft.com/en-us/azure/service-fabric-mesh/service-fabric-mesh-overview) is a fully managed service that enables developers to deploy microservices applications without managing virtual machines, storage, or networking. Applications hosted on Service Fabric Mesh run and scale without you worrying about the infrastructure powering them. - -The Virtual kubelet integration allows you to use the Kubernetes API to burst out compute to Service Fabric Mesh and schedule pods as Mesh Applications. - -## Status: Experimental - -This provider is currently in the experimental stages. Contributions are welcome! - -## Setup - -The provider expects the following environment variables to be configured: - -- AZURE_CLIENT_ID -- AZURE_CLIENT_SECRET -- AZURE_SUBSCRIPTION_ID -- AZURE_TENANT_ID -- RESOURCE_GROUP -- REGION - -## Quick Start - -#### Run the Virtual Kubelet - -``` -./virtual-kubelet --provider=sfmesh --taint azure.com/sfmesh -``` - -#### Create pod yaml: - -``` -$ cat pod-nginx -apiVersion: v1 -kind: Pod -metadata: - name: nginx -spec: - nodeName: virtual-kubelet - containers: - - name: nginx - image: nginx:latest - ports: - - containerPort: 80 - tolerations: - - key: azure.com/sfmesh - effect: NoSchedule -``` - -#### create pod - -``` -$ kubectl create -f pod-nginx -``` - -#### list containers on Service Fabric Mesh - -``` -$ az mesh app list -o table - -Name ResourceGroup ProvisioningState Location ------- --------------- ------------------- ---------- -nginx myResourceGroup Succeeded eastus -``` diff --git a/providers/sfmesh/errors.go b/providers/sfmesh/errors.go deleted file mode 100644 index 4f67fddbb..000000000 --- a/providers/sfmesh/errors.go +++ /dev/null @@ -1,48 +0,0 @@ -package sfmesh - -import ( - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/cpuguy83/strongerrors" -) - -func wrapError(err error) error { - if err == nil { - return nil - } - switch { - case isStatus(err, http.StatusNotFound): - return strongerrors.NotFound(err) - default: - return err - } -} - -type causal interface { - Cause() error -} - -func isStatus(err error, status int) bool { - if err == nil { - return false - } - - switch e := err.(type) { - case *azure.RequestError: - if e.StatusCode != 0 { - return e.StatusCode == status - } - return isStatus(e.Original, status) - case autorest.DetailedError: - if e.StatusCode != 0 { - return e.StatusCode == status - } - return isStatus(e.Original, status) - case causal: - return isStatus(e.Cause(), status) - } - - return false -} diff --git a/providers/sfmesh/sfmesh.go b/providers/sfmesh/sfmesh.go deleted file mode 100644 index 9c47939ed..000000000 --- a/providers/sfmesh/sfmesh.go +++ /dev/null @@ -1,851 +0,0 @@ -package sfmesh - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "io" - "log" - "os" - "strconv" - "time" - - "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh" - "github.com/Azure/go-autorest/autorest/azure/auth" - "github.com/virtual-kubelet/virtual-kubelet/manager" - "github.com/virtual-kubelet/virtual-kubelet/providers" - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/tools/remotecommand" -) - -const ( - defaultCPUCapacity = "60" - defaultMemoryCapacity = "48Gi" - defaultPodCapacity = "5" - defaultCPURequests = 1.0 - defaultMemoryRequests = 1.0 - defaultCPULimit = 4.0 - defaultMemoryLimit = 16.0 -) - -// SFMeshProvider implements the Virtual Kubelet provider interface -type SFMeshProvider struct { - nodeName string - operatingSystem string - internalIP string - daemonEndpointPort int32 - appClient *servicefabricmesh.ApplicationClient - networkClient *servicefabricmesh.NetworkClient - serviceClient *servicefabricmesh.ServiceClient - region string - resourceGroup string - subscriptionID string - resourceManager *manager.ResourceManager -} - -// AuthConfig is the secret returned from an ImageRegistryCredential -type AuthConfig struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - Auth string `json:"auth,omitempty"` - Email string `json:"email,omitempty"` - ServerAddress string `json:"serveraddress,omitempty"` - IdentityToken string `json:"identitytoken,omitempty"` - RegistryToken string `json:"registrytoken,omitempty"` -} - -// NewSFMeshProvider creates a new SFMeshProvider -func NewSFMeshProvider(rm *manager.ResourceManager, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*SFMeshProvider, error) { - azureSubscriptionID := os.Getenv("AZURE_SUBSCRIPTION_ID") - azureTenantID := os.Getenv("AZURE_TENANT_ID") - azureClientID := os.Getenv("AZURE_CLIENT_ID") - azureClientSecret := os.Getenv("AZURE_CLIENT_SECRET") - region := os.Getenv("REGION") - resourceGroup := os.Getenv("RESOURCE_GROUP") - - if azureSubscriptionID == "" { - return nil, errors.New("Subscription ID cannot be empty, please set AZURE_SUBSCRIPTION_ID") - } - if azureTenantID == "" { - return nil, errors.New("Tenant ID cannot be empty, please set AZURE_TENANT_ID") - } - if azureClientID == "" { - return nil, errors.New("Client ID cannot be empty, please set AZURE_CLIENT_ID ") - } - if azureClientSecret == "" { - return nil, errors.New("Client Secret cannot be empty, please set AZURE_CLIENT_SECRET ") - } - if region == "" { - return nil, errors.New("Region cannot be empty, please set REGION ") - } - if resourceGroup == "" { - return nil, errors.New("Resource Group cannot be empty, please set RESOURCE_GROUP ") - } - - client := servicefabricmesh.NewApplicationClient(azureSubscriptionID) - - auth, err := auth.NewAuthorizerFromEnvironment() - if err != nil { - return nil, err - } - - client.Authorizer = auth - - networkClient := servicefabricmesh.NewNetworkClient(azureSubscriptionID) - networkClient.Authorizer = auth - - serviceClient := servicefabricmesh.NewServiceClient(azureSubscriptionID) - serviceClient.Authorizer = auth - - provider := SFMeshProvider{ - nodeName: nodeName, - operatingSystem: operatingSystem, - internalIP: internalIP, - daemonEndpointPort: daemonEndpointPort, - appClient: &client, - networkClient: &networkClient, - serviceClient: &serviceClient, - region: region, - resourceGroup: resourceGroup, - resourceManager: rm, - subscriptionID: azureSubscriptionID, - } - return &provider, nil -} - -func readDockerCfgSecret(secret *v1.Secret, ips []servicefabricmesh.ImageRegistryCredential) ([]servicefabricmesh.ImageRegistryCredential, error) { - var err error - var authConfigs map[string]AuthConfig - repoData, ok := secret.Data[string(v1.DockerConfigKey)] - - if !ok { - return ips, fmt.Errorf("no dockercfg present in secret") - } - - err = json.Unmarshal(repoData, &authConfigs) - if err != nil { - return ips, err - } - - for server, authConfig := range authConfigs { - ips = append(ips, servicefabricmesh.ImageRegistryCredential{ - Password: &authConfig.Password, - Server: &server, - Username: &authConfig.Username, - }) - } - - return ips, err -} - -func readDockerConfigJSONSecret(secret *v1.Secret, ips []servicefabricmesh.ImageRegistryCredential) ([]servicefabricmesh.ImageRegistryCredential, error) { - var err error - repoData, ok := secret.Data[string(v1.DockerConfigJsonKey)] - - if !ok { - return ips, fmt.Errorf("no dockerconfigjson present in secret") - } - - var authConfigs map[string]map[string]AuthConfig - - err = json.Unmarshal(repoData, &authConfigs) - if err != nil { - return ips, err - } - - auths, ok := authConfigs["auths"] - - if !ok { - return ips, fmt.Errorf("malformed dockerconfigjson in secret") - } - - for server, authConfig := range auths { - ips = append(ips, servicefabricmesh.ImageRegistryCredential{ - Password: &authConfig.Password, - Server: &server, - Username: &authConfig.Username, - }) - } - - return ips, err -} - -func (p *SFMeshProvider) getImagePullSecrets(pod *v1.Pod) ([]servicefabricmesh.ImageRegistryCredential, error) { - ips := make([]servicefabricmesh.ImageRegistryCredential, 0, len(pod.Spec.ImagePullSecrets)) - for _, ref := range pod.Spec.ImagePullSecrets { - secret, err := p.resourceManager.GetSecret(ref.Name, pod.Namespace) - if err != nil { - return ips, err - } - if secret == nil { - return nil, fmt.Errorf("error getting image pull secret") - } - - switch secret.Type { - case v1.SecretTypeDockercfg: - ips, err = readDockerCfgSecret(secret, ips) - case v1.SecretTypeDockerConfigJson: - ips, err = readDockerConfigJSONSecret(secret, ips) - default: - return nil, fmt.Errorf("image pull secret type is not one of kubernetes.io/dockercfg or kubernetes.io/dockerconfigjson") - } - - if err != nil { - return ips, err - } - - } - return ips, nil -} - -func (p *SFMeshProvider) getMeshApplication(pod *v1.Pod) (servicefabricmesh.ApplicationResourceDescription, error) { - meshApp := servicefabricmesh.ApplicationResourceDescription{} - meshApp.Name = &pod.Name - meshApp.Location = &p.region - - podUID := string(pod.UID) - podCreationTimestamp := pod.CreationTimestamp.String() - - tags := map[string]*string{ - "PodName": &pod.Name, - "ClusterName": &pod.ClusterName, - "NodeName": &pod.Spec.NodeName, - "Namespace": &pod.Namespace, - "UID": &podUID, - "CreationTimestamp": &podCreationTimestamp, - } - - meshApp.Tags = tags - - properties := servicefabricmesh.ApplicationResourceProperties{} - meshApp.ApplicationResourceProperties = &properties - - services := []servicefabricmesh.ServiceResourceDescription{} - service := servicefabricmesh.ServiceResourceDescription{} - serviceName := *meshApp.Name + "-service" - service.Name = &serviceName - serviceType := "Microsoft.ServiceFabricMesh/services" - service.Type = &serviceType - - creds, err := p.getImagePullSecrets(pod) - if err != nil { - return meshApp, err - } - - codePackages := []servicefabricmesh.ContainerCodePackageProperties{} - - for _, container := range pod.Spec.Containers { - codePackage := servicefabricmesh.ContainerCodePackageProperties{} - codePackage.Image = &container.Image - codePackage.Name = &container.Name - - if creds != nil { - if len(creds) > 0 { - // Mesh ImageRegistryCredential supports only a single credential - codePackage.ImageRegistryCredential = &creds[0] - } - } - - requirements := servicefabricmesh.ResourceRequirements{} - requests := servicefabricmesh.ResourceRequests{} - - cpuRequest := defaultCPURequests - memoryRequest := defaultMemoryRequests - - if container.Resources.Requests != nil { - if _, ok := container.Resources.Requests[v1.ResourceCPU]; ok { - containerCPURequest := float64(container.Resources.Requests.Cpu().MilliValue()/10.00) / 100.00 - if containerCPURequest > 1 && containerCPURequest <= 4 { - cpuRequest = containerCPURequest - } - } - - if _, ok := container.Resources.Requests[v1.ResourceMemory]; ok { - containerMemoryRequest := float64(container.Resources.Requests.Memory().Value()/100000000.00) / 10.00 - if containerMemoryRequest < 0.10 { - containerMemoryRequest = 0.10 - } - - memoryRequest = containerMemoryRequest - } - } - - requests.CPU = &cpuRequest - requests.MemoryInGB = &memoryRequest - - requirements.Requests = &requests - - if container.Resources.Limits != nil { - cpuLimit := defaultCPULimit - memoryLimit := defaultMemoryLimit - - limits := servicefabricmesh.ResourceLimits{} - limits.CPU = &cpuLimit - limits.MemoryInGB = &memoryLimit - - if _, ok := container.Resources.Limits[v1.ResourceCPU]; ok { - containerCPULimit := float64(container.Resources.Limits.Cpu().MilliValue()) / 1000.00 - if containerCPULimit > 1 { - limits.CPU = &containerCPULimit - } - } - - if _, ok := container.Resources.Limits[v1.ResourceMemory]; ok { - containerMemoryLimit := float64(container.Resources.Limits.Memory().Value()) / 1000000000.00 - if containerMemoryLimit < 0.10 { - containerMemoryLimit = 0.10 - } - - limits.MemoryInGB = &containerMemoryLimit - } - - requirements.Limits = &limits - } - - codePackage.Resources = &requirements - - if len(container.Command) > 0 { - codePackage.Commands = &container.Command - } - - if len(container.Env) > 0 { - envVars := []servicefabricmesh.EnvironmentVariable{} - - for _, envVar := range container.Env { - env := servicefabricmesh.EnvironmentVariable{} - env.Name = &envVar.Name - env.Value = &envVar.Value - - envVars = append(envVars, env) - } - - codePackage.EnvironmentVariables = &envVars - } - - endpoints := []servicefabricmesh.EndpointProperties{} - - for _, port := range container.Ports { - endpoint := p.getEndpointFromContainerPort(port) - endpoints = append(endpoints, endpoint) - } - - if len(endpoints) > 0 { - codePackage.Endpoints = &endpoints - } - - codePackages = append(codePackages, codePackage) - } - - serviceProperties := servicefabricmesh.ServiceResourceProperties{} - serviceProperties.OsType = servicefabricmesh.Linux - replicaCount := int32(1) - serviceProperties.ReplicaCount = &replicaCount - serviceProperties.CodePackages = &codePackages - service.ServiceResourceProperties = &serviceProperties - services = append(services, service) - properties.Services = &services - - return meshApp, nil -} - -func (p *SFMeshProvider) getMeshNetwork(pod *v1.Pod, meshApp servicefabricmesh.ApplicationResourceDescription, location string) servicefabricmesh.NetworkResourceDescription { - network := servicefabricmesh.NetworkResourceDescription{} - network.Name = meshApp.Name - network.Location = &location - - networkProperties := servicefabricmesh.NetworkResourceProperties{} - addressPrefix := "10.0.0.4/22" - networkProperties.AddressPrefix = &addressPrefix - - layers := []servicefabricmesh.Layer4IngressConfig{} - - service := (*meshApp.Services)[0] - - for _, codePackage := range *service.CodePackages { - for _, endpoint := range *codePackage.Endpoints { - layer := p.getLayer(&endpoint, *meshApp.Name, *service.Name) - layers = append(layers, layer) - } - } - - ingressConfig := servicefabricmesh.IngressConfig{} - ingressConfig.Layer4 = &layers - - networkProperties.IngressConfig = &ingressConfig - network.NetworkResourceProperties = &networkProperties - - return network -} - -func (p *SFMeshProvider) getLayer(endpoint *servicefabricmesh.EndpointProperties, appName string, serviceName string) servicefabricmesh.Layer4IngressConfig { - layer := servicefabricmesh.Layer4IngressConfig{} - name := *endpoint.Name + "Ingress" - layerName := &name - layer.Name = layerName - layer.PublicPort = endpoint.Port - layer.EndpointName = endpoint.Name - layer.ApplicationName = &appName - layer.ServiceName = &serviceName - - return layer -} - -func (p *SFMeshProvider) getEndpointFromContainerPort(port v1.ContainerPort) servicefabricmesh.EndpointProperties { - endpoint := servicefabricmesh.EndpointProperties{} - endpointName := strconv.Itoa(int(port.ContainerPort)) + "Listener" - endpoint.Name = &endpointName - endpoint.Port = &port.ContainerPort - - return endpoint -} - -// CreatePod accepts a Pod definition and creates a SF Mesh App. -func (p *SFMeshProvider) CreatePod(ctx context.Context, pod *v1.Pod) error { - log.Printf("receive CreatePod %q\n", pod.Name) - - meshApp, err := p.getMeshApplication(pod) - if err != nil { - return err - } - - meshNetwork := p.getMeshNetwork(pod, meshApp, p.region) - _, err = p.networkClient.Create(context.Background(), p.resourceGroup, *meshNetwork.Name, meshNetwork) - if err != nil { - return err - } - - networkName := *meshNetwork.Name - resourceID := "/subscriptions/" + p.subscriptionID + "/resourceGroups/" + p.resourceGroup + "/providers/Microsoft.ServiceFabricMesh/networks/" + networkName - - service := (*meshApp.Services)[0] - - networkRef := servicefabricmesh.NetworkRef{} - networkRef.Name = &resourceID - - networkRefs := []servicefabricmesh.NetworkRef{} - networkRefs = append(networkRefs, networkRef) - - service.NetworkRefs = &networkRefs - - _, err = p.appClient.Create(context.Background(), p.resourceGroup, pod.Name, meshApp) - if err != nil { - return err - } - - return nil -} - -// UpdatePod updates the pod running inside SF Mesh. -func (p *SFMeshProvider) UpdatePod(ctx context.Context, pod *v1.Pod) error { - log.Printf("receive UpdatePod %q\n", pod.Name) - - app, err := p.getMeshApplication(pod) - if err != nil { - return err - } - - _, err = p.appClient.Create(context.Background(), p.resourceGroup, pod.Name, app) - if err != nil { - return err - } - - return nil -} - -// DeletePod deletes the specified pod out of SF Mesh. -func (p *SFMeshProvider) DeletePod(ctx context.Context, pod *v1.Pod) (err error) { - log.Printf("receive DeletePod %q\n", pod.Name) - - _, err = p.appClient.Delete(ctx, p.resourceGroup, pod.Name) - if err != nil { - return wrapError(err) - } - - return nil -} - -// GetPod returns a pod by name that is running inside SF Mesh. -// returns nil if a pod by that name is not found. -func (p *SFMeshProvider) GetPod(ctx context.Context, namespace, name string) (pod *v1.Pod, err error) { - log.Printf("receive GetPod %q\n", name) - - resp, err := p.appClient.Get(ctx, p.resourceGroup, name) - httpResponse := resp.Response.Response - - if err != nil { - if httpResponse.StatusCode == 404 { - return nil, nil - } - return nil, err - } - - if resp.Tags == nil { - return nil, nil - } - - val, present := resp.Tags["NodeName"] - - if !present { - return nil, nil - } - - if *val != p.nodeName { - return nil, nil - } - - pod, err = p.applicationDescriptionToPod(resp) - if err != nil { - return nil, err - } - - return pod, nil -} - -func (p *SFMeshProvider) appStateToPodPhase(state string) v1.PodPhase { - switch state { - case "Succeeded": - return v1.PodRunning - case "Failed": - return v1.PodFailed - case "Canceled": - return v1.PodFailed - case "Creating": - return v1.PodPending - case "Updating": - return v1.PodPending - } - - return v1.PodUnknown -} - -func (p *SFMeshProvider) appStateToPodConditions(state string, transitiontime metav1.Time) []v1.PodCondition { - switch state { - case "Succeeded": - return []v1.PodCondition{ - v1.PodCondition{ - Type: v1.PodReady, - Status: v1.ConditionTrue, - LastTransitionTime: transitiontime, - }, v1.PodCondition{ - Type: v1.PodInitialized, - Status: v1.ConditionTrue, - LastTransitionTime: transitiontime, - }, v1.PodCondition{ - Type: v1.PodScheduled, - Status: v1.ConditionTrue, - LastTransitionTime: transitiontime, - }, - } - } - return []v1.PodCondition{} -} - -func (p *SFMeshProvider) getMeshService(appName string, serviceName string) (servicefabricmesh.ServiceResourceDescription, error) { - svc, err := p.serviceClient.Get(context.Background(), p.resourceGroup, appName, serviceName) - if err != nil { - return servicefabricmesh.ServiceResourceDescription{}, err - } - - return svc, err -} - -func appStateToContainerState(state string, appStartTime metav1.Time) v1.ContainerState { - if state == "Succeeded" { - return v1.ContainerState{ - Running: &v1.ContainerStateRunning{ - StartedAt: appStartTime, - }, - } - } - - if state == "Failed" || state == "Canceled" { - return v1.ContainerState{ - Terminated: &v1.ContainerStateTerminated{ - ExitCode: 1, - Reason: "", - Message: "", - StartedAt: appStartTime, - FinishedAt: metav1.NewTime(time.Now()), - }, - } - } - - return v1.ContainerState{ - Waiting: &v1.ContainerStateWaiting{ - Reason: "", - Message: "", - }, - } -} - -func (p *SFMeshProvider) getMeshNetworkPublicIP(networkName string) (*string, error) { - network, err := p.networkClient.Get(context.Background(), p.resourceGroup, networkName) - if err != nil { - return nil, err - } - - ipAddress := network.IngressConfig.PublicIPAddress - return ipAddress, nil -} - -func (p *SFMeshProvider) applicationDescriptionToPod(app servicefabricmesh.ApplicationResourceDescription) (*v1.Pod, error) { - var podCreationTimestamp metav1.Time - - if *app.Tags["CreationTimestamp"] != "" { - t, err := time.Parse("2006-01-02 15:04:05.999999999 -0700 MST", *app.Tags["CreationTimestamp"]) - if err != nil { - return nil, err - } - podCreationTimestamp = metav1.NewTime(t) - } - - containerStartTime := podCreationTimestamp - - appState := app.ProvisioningState - podPhase := p.appStateToPodPhase(*appState) - podConditions := p.appStateToPodConditions(*appState, podCreationTimestamp) - - service, err := p.getMeshService(*app.Name, (*app.ServiceNames)[0]) - - containers := []v1.Container{} - containerStatuses := []v1.ContainerStatus{} - - for _, codePkg := range *service.CodePackages { - container := v1.Container{} - container.Name = *codePkg.Name - container.Image = *codePkg.Image - - if codePkg.Commands != nil { - container.Command = *codePkg.Commands - } - - container.Resources = v1.ResourceRequirements{ - Requests: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse(fmt.Sprintf("%g", *codePkg.Resources.Requests.CPU)), - v1.ResourceMemory: resource.MustParse(fmt.Sprintf("%gG", *codePkg.Resources.Requests.MemoryInGB)), - }, - } - - if codePkg.Resources.Limits != nil { - container.Resources.Limits = v1.ResourceList{ - v1.ResourceCPU: resource.MustParse(fmt.Sprintf("%g", *codePkg.Resources.Limits.CPU)), - v1.ResourceMemory: resource.MustParse(fmt.Sprintf("%gG", *codePkg.Resources.Limits.MemoryInGB)), - } - } - - containerStatus := v1.ContainerStatus{ - Name: *codePkg.Name, - State: appStateToContainerState(*appState, podCreationTimestamp), - Ready: podPhase == v1.PodRunning, - Image: container.Image, - ImageID: "", - ContainerID: "", - } - - containerStatuses = append(containerStatuses, containerStatus) - containers = append(containers, container) - } - - appName := app.Name - ipAddress := "" - meshIP, err := p.getMeshNetworkPublicIP(*appName) - if err != nil { - return nil, err - } - - if meshIP != nil { - ipAddress = *meshIP - } - - pod := v1.Pod{ - TypeMeta: metav1.TypeMeta{ - Kind: "Pod", - APIVersion: "v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: *app.Tags["PodName"], - Namespace: *app.Tags["Namespace"], - ClusterName: *app.Tags["ClusterName"], - UID: types.UID(*app.Tags["UID"]), - CreationTimestamp: podCreationTimestamp, - }, - Spec: v1.PodSpec{ - NodeName: *app.Tags["NodeName"], - Volumes: []v1.Volume{}, - Containers: containers, - }, - Status: v1.PodStatus{ - Phase: podPhase, - Conditions: podConditions, - Message: "", - Reason: "", - HostIP: "", - PodIP: ipAddress, - StartTime: &containerStartTime, - ContainerStatuses: containerStatuses, - }, - } - - return &pod, nil -} - -// GetContainerLogs retrieves the logs of a container by name. -func (p *SFMeshProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, tail int) (string, error) { - log.Printf("receive GetContainerLogs %q\n", podName) - return "", nil -} - -// GetPodFullName gets the full pod name as defined in the provider context -func (p *SFMeshProvider) GetPodFullName(namespace string, pod string) string { - return "" -} - -// ExecInContainer executes a command in a container in the pod, copying data -// between in/out/err and the container's stdin/stdout/stderr. -func (p *SFMeshProvider) ExecInContainer(name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error { - log.Printf("receive ExecInContainer %q\n", container) - return nil -} - -// GetPodStatus returns the status of a pod by name that is "running". -// returns nil if a pod by that name is not found. -func (p *SFMeshProvider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error) { - pod, err := p.GetPod(ctx, namespace, name) - if err != nil { - return nil, err - } - - if pod == nil { - return nil, nil - } - - return &pod.Status, nil -} - -// GetPods returns a list of all pods known to be running within SF Mesh. -func (p *SFMeshProvider) GetPods(ctx context.Context) ([]*v1.Pod, error) { - log.Printf("receive GetPods\n") - - var pods []*v1.Pod - - list, err := p.appClient.ListByResourceGroup(ctx, p.resourceGroup) - if err != nil { - return pods, err - } - - apps := list.Values() - - for _, app := range apps { - if app.Tags == nil { - continue - } - - val, present := app.Tags["NodeName"] - - if !present { - continue - } - - if *val != p.nodeName { - continue - } - - pod, err := p.applicationDescriptionToPod(app) - if err != nil { - return pods, err - } - - pods = append(pods, pod) - } - - return pods, nil -} - -// Capacity returns a resource list containing the capacity limits set for SF Mesh. -func (p *SFMeshProvider) Capacity(ctx context.Context) v1.ResourceList { - return v1.ResourceList{ - "cpu": resource.MustParse(defaultCPUCapacity), - "memory": resource.MustParse(defaultMemoryCapacity), - "pods": resource.MustParse(defaultPodCapacity), - } -} - -// NodeConditions returns a list of conditions (Ready, OutOfDisk, etc), for updates to the node status -// within Kubernetes. -func (p *SFMeshProvider) NodeConditions(ctx context.Context) []v1.NodeCondition { - // TODO: Make this configurable - return []v1.NodeCondition{ - { - Type: "Ready", - Status: v1.ConditionTrue, - LastHeartbeatTime: metav1.Now(), - LastTransitionTime: metav1.Now(), - Reason: "KubeletReady", - Message: "kubelet is ready.", - }, - { - Type: "OutOfDisk", - Status: v1.ConditionFalse, - LastHeartbeatTime: metav1.Now(), - LastTransitionTime: metav1.Now(), - Reason: "KubeletHasSufficientDisk", - Message: "kubelet has sufficient disk space available", - }, - { - Type: "MemoryPressure", - Status: v1.ConditionFalse, - LastHeartbeatTime: metav1.Now(), - LastTransitionTime: metav1.Now(), - Reason: "KubeletHasSufficientMemory", - Message: "kubelet has sufficient memory available", - }, - { - Type: "DiskPressure", - Status: v1.ConditionFalse, - LastHeartbeatTime: metav1.Now(), - LastTransitionTime: metav1.Now(), - Reason: "KubeletHasNoDiskPressure", - Message: "kubelet has no disk pressure", - }, - { - Type: "NetworkUnavailable", - Status: v1.ConditionFalse, - LastHeartbeatTime: metav1.Now(), - LastTransitionTime: metav1.Now(), - Reason: "RouteCreated", - Message: "RouteController created a route", - }, - } - -} - -// NodeAddresses returns a list of addresses for the node status -// within Kubernetes. -func (p *SFMeshProvider) NodeAddresses(ctx context.Context) []v1.NodeAddress { - return []v1.NodeAddress{ - { - Type: "InternalIP", - Address: p.internalIP, - }, - } -} - -// NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status -// within Kubernetes. -func (p *SFMeshProvider) NodeDaemonEndpoints(ctx context.Context) *v1.NodeDaemonEndpoints { - return &v1.NodeDaemonEndpoints{ - KubeletEndpoint: v1.DaemonEndpoint{ - Port: p.daemonEndpointPort, - }, - } -} - -// OperatingSystem returns the operating system for this provider. -// This is a noop to default to Linux for now. -func (p *SFMeshProvider) OperatingSystem() string { - return providers.OperatingSystemLinux -} diff --git a/providers/sfmesh/sfmesh_test.go b/providers/sfmesh/sfmesh_test.go deleted file mode 100644 index b446ad126..000000000 --- a/providers/sfmesh/sfmesh_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package sfmesh - -import ( - "errors" - "os" - "testing" - - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func setEnvVars() { - os.Setenv("AZURE_SUBSCRIPTION_ID", "fake") - os.Setenv("AZURE_TENANT_ID", "fake") - os.Setenv("AZURE_CLIENT_ID", "fake") - os.Setenv("AZURE_CLIENT_SECRET", "fake") - os.Setenv("REGION", "fake") - os.Setenv("RESOURCE_GROUP", "fake") -} - -func Test_podToMeshApp(t *testing.T) { - setEnvVars() - - pod := &v1.Pod{} - pod.ObjectMeta = metav1.ObjectMeta{ - Name: "test-pod", - } - pod.Spec = v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "testcontainer", - Image: "nginx", - Ports: []v1.ContainerPort{ - { - Name: "http", - ContainerPort: 80, - }, - }, - }, - }, - } - - provider, err := NewSFMeshProvider(nil, "testnode", "Linux", "6.6.6.6", 80) - if err != nil { - t.Error(err.Error()) - } - - _, err = provider.getMeshApplication(pod) - if err != nil { - t.Error(err.Error()) - } -} - -func Test_meshStateToPodCondition(t *testing.T) { - setEnvVars() - - meshStateSucceeded := "Succeeded" - - provider, err := NewSFMeshProvider(nil, "testnode", "Linux", "6.6.6.6", 80) - if err != nil { - t.Error(err.Error()) - } - - phase := provider.appStateToPodPhase(meshStateSucceeded) - if phase != v1.PodRunning { - t.Error(errors.New("PodRunning phase expected")) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh/models.go b/vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh/models.go deleted file mode 100644 index 5ad4704a3..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh/models.go +++ /dev/null @@ -1,233 +0,0 @@ -// +build go1.9 - -// Copyright 2018 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. - -// This code was auto-generated by: -// github.com/Azure/azure-sdk-for-go/tools/profileBuilder - -package servicefabricmesh - -import original "github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh" - -type ApplicationClient = original.ApplicationClient - -const ( - DefaultBaseURI = original.DefaultBaseURI -) - -type BaseClient = original.BaseClient -type CodePackageClient = original.CodePackageClient -type ApplicationResourceStatus = original.ApplicationResourceStatus - -const ( - Creating ApplicationResourceStatus = original.Creating - Deleting ApplicationResourceStatus = original.Deleting - Failed ApplicationResourceStatus = original.Failed - Invalid ApplicationResourceStatus = original.Invalid - Ready ApplicationResourceStatus = original.Ready - Upgrading ApplicationResourceStatus = original.Upgrading -) - -type DiagnosticsSinkKind = original.DiagnosticsSinkKind - -const ( - DiagnosticsSinkKindAzureInternalMonitoringPipeline DiagnosticsSinkKind = original.DiagnosticsSinkKindAzureInternalMonitoringPipeline - DiagnosticsSinkKindInvalid DiagnosticsSinkKind = original.DiagnosticsSinkKindInvalid -) - -type HealthState = original.HealthState - -const ( - HealthStateError HealthState = original.HealthStateError - HealthStateInvalid HealthState = original.HealthStateInvalid - HealthStateOk HealthState = original.HealthStateOk - HealthStateUnknown HealthState = original.HealthStateUnknown - HealthStateWarning HealthState = original.HealthStateWarning -) - -type IngressQoSLevel = original.IngressQoSLevel - -const ( - Bronze IngressQoSLevel = original.Bronze -) - -type Kind = original.Kind - -const ( - KindAzureInternalMonitoringPipeline Kind = original.KindAzureInternalMonitoringPipeline - KindDiagnosticsSinkProperties Kind = original.KindDiagnosticsSinkProperties -) - -type OperatingSystemTypes = original.OperatingSystemTypes - -const ( - Linux OperatingSystemTypes = original.Linux - Windows OperatingSystemTypes = original.Windows -) - -type ServiceResourceStatus = original.ServiceResourceStatus - -const ( - ServiceResourceStatusActive ServiceResourceStatus = original.ServiceResourceStatusActive - ServiceResourceStatusCreating ServiceResourceStatus = original.ServiceResourceStatusCreating - ServiceResourceStatusDeleting ServiceResourceStatus = original.ServiceResourceStatusDeleting - ServiceResourceStatusFailed ServiceResourceStatus = original.ServiceResourceStatusFailed - ServiceResourceStatusUnknown ServiceResourceStatus = original.ServiceResourceStatusUnknown - ServiceResourceStatusUpgrading ServiceResourceStatus = original.ServiceResourceStatusUpgrading -) - -type ApplicationProperties = original.ApplicationProperties -type ApplicationResourceDescription = original.ApplicationResourceDescription -type ApplicationResourceDescriptionList = original.ApplicationResourceDescriptionList -type ApplicationResourceDescriptionListIterator = original.ApplicationResourceDescriptionListIterator -type ApplicationResourceDescriptionListPage = original.ApplicationResourceDescriptionListPage -type ApplicationResourceProperties = original.ApplicationResourceProperties -type AvailableOperationDisplay = original.AvailableOperationDisplay -type AzureInternalMonitoringPipelineSinkDescription = original.AzureInternalMonitoringPipelineSinkDescription -type ContainerCodePackageProperties = original.ContainerCodePackageProperties -type ContainerEvent = original.ContainerEvent -type ContainerInstanceView = original.ContainerInstanceView -type ContainerLabel = original.ContainerLabel -type ContainerLogs = original.ContainerLogs -type ContainerState = original.ContainerState -type ContainerVolume = original.ContainerVolume -type DiagnosticsDescription = original.DiagnosticsDescription -type DiagnosticsRef = original.DiagnosticsRef -type BasicDiagnosticsSinkProperties = original.BasicDiagnosticsSinkProperties -type DiagnosticsSinkProperties = original.DiagnosticsSinkProperties -type EndpointProperties = original.EndpointProperties -type EnvironmentVariable = original.EnvironmentVariable -type ErrorModel = original.ErrorModel -type ImageRegistryCredential = original.ImageRegistryCredential -type IngressConfig = original.IngressConfig -type Layer4IngressConfig = original.Layer4IngressConfig -type ManagedProxyResource = original.ManagedProxyResource -type NetworkProperties = original.NetworkProperties -type NetworkRef = original.NetworkRef -type NetworkResourceDescription = original.NetworkResourceDescription -type NetworkResourceDescriptionList = original.NetworkResourceDescriptionList -type NetworkResourceDescriptionListIterator = original.NetworkResourceDescriptionListIterator -type NetworkResourceDescriptionListPage = original.NetworkResourceDescriptionListPage -type NetworkResourceProperties = original.NetworkResourceProperties -type OperationListResult = original.OperationListResult -type OperationListResultIterator = original.OperationListResultIterator -type OperationListResultPage = original.OperationListResultPage -type OperationResult = original.OperationResult -type ProvisionedResourceProperties = original.ProvisionedResourceProperties -type ProxyResource = original.ProxyResource -type Resource = original.Resource -type ResourceLimits = original.ResourceLimits -type ResourceRequests = original.ResourceRequests -type ResourceRequirements = original.ResourceRequirements -type ServiceList = original.ServiceList -type ServiceListIterator = original.ServiceListIterator -type ServiceListPage = original.ServiceListPage -type ServiceReplicaDescription = original.ServiceReplicaDescription -type ServiceReplicaList = original.ServiceReplicaList -type ServiceReplicaListIterator = original.ServiceReplicaListIterator -type ServiceReplicaListPage = original.ServiceReplicaListPage -type ServiceReplicaProperties = original.ServiceReplicaProperties -type ServiceResourceDescription = original.ServiceResourceDescription -type ServiceResourceProperties = original.ServiceResourceProperties -type Setting = original.Setting -type TrackedResource = original.TrackedResource -type VolumeProperties = original.VolumeProperties -type VolumeProviderParametersAzureFile = original.VolumeProviderParametersAzureFile -type VolumeResourceDescription = original.VolumeResourceDescription -type VolumeResourceDescriptionList = original.VolumeResourceDescriptionList -type VolumeResourceDescriptionListIterator = original.VolumeResourceDescriptionListIterator -type VolumeResourceDescriptionListPage = original.VolumeResourceDescriptionListPage -type VolumeResourceProperties = original.VolumeResourceProperties -type NetworkClient = original.NetworkClient -type OperationsClient = original.OperationsClient -type ReplicaClient = original.ReplicaClient -type ServiceClient = original.ServiceClient -type VolumeClient = original.VolumeClient - -func NewApplicationClient(subscriptionID string) ApplicationClient { - return original.NewApplicationClient(subscriptionID) -} -func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { - return original.NewApplicationClientWithBaseURI(baseURI, subscriptionID) -} -func New(subscriptionID string) BaseClient { - return original.New(subscriptionID) -} -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return original.NewWithBaseURI(baseURI, subscriptionID) -} -func NewCodePackageClient(subscriptionID string) CodePackageClient { - return original.NewCodePackageClient(subscriptionID) -} -func NewCodePackageClientWithBaseURI(baseURI string, subscriptionID string) CodePackageClient { - return original.NewCodePackageClientWithBaseURI(baseURI, subscriptionID) -} -func PossibleApplicationResourceStatusValues() []ApplicationResourceStatus { - return original.PossibleApplicationResourceStatusValues() -} -func PossibleDiagnosticsSinkKindValues() []DiagnosticsSinkKind { - return original.PossibleDiagnosticsSinkKindValues() -} -func PossibleHealthStateValues() []HealthState { - return original.PossibleHealthStateValues() -} -func PossibleIngressQoSLevelValues() []IngressQoSLevel { - return original.PossibleIngressQoSLevelValues() -} -func PossibleKindValues() []Kind { - return original.PossibleKindValues() -} -func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { - return original.PossibleOperatingSystemTypesValues() -} -func PossibleServiceResourceStatusValues() []ServiceResourceStatus { - return original.PossibleServiceResourceStatusValues() -} -func NewNetworkClient(subscriptionID string) NetworkClient { - return original.NewNetworkClient(subscriptionID) -} -func NewNetworkClientWithBaseURI(baseURI string, subscriptionID string) NetworkClient { - return original.NewNetworkClientWithBaseURI(baseURI, subscriptionID) -} -func NewOperationsClient(subscriptionID string) OperationsClient { - return original.NewOperationsClient(subscriptionID) -} -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) -} -func NewReplicaClient(subscriptionID string) ReplicaClient { - return original.NewReplicaClient(subscriptionID) -} -func NewReplicaClientWithBaseURI(baseURI string, subscriptionID string) ReplicaClient { - return original.NewReplicaClientWithBaseURI(baseURI, subscriptionID) -} -func NewServiceClient(subscriptionID string) ServiceClient { - return original.NewServiceClient(subscriptionID) -} -func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient { - return original.NewServiceClientWithBaseURI(baseURI, subscriptionID) -} -func UserAgent() string { - return original.UserAgent() + " profiles/preview" -} -func Version() string { - return original.Version() -} -func NewVolumeClient(subscriptionID string) VolumeClient { - return original.NewVolumeClient(subscriptionID) -} -func NewVolumeClientWithBaseURI(baseURI string, subscriptionID string) VolumeClient { - return original.NewVolumeClientWithBaseURI(baseURI, subscriptionID) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/application.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/application.go deleted file mode 100644 index 2f362a40c..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/application.go +++ /dev/null @@ -1,439 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "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 service Fabric Mesh Management Client -type ApplicationClient struct { - BaseClient -} - -// 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 creates an application resource with the specified name and description. If an application with the same name -// already exists, then its description is updated to the one indicated in this request. -// -// Use network resources to provide public connectivity to the services of an application. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -// applicationResourceDescription - description for creating an application resource. -func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, applicationName string, applicationResourceDescription ApplicationResourceDescription) (result ApplicationResourceDescription, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: applicationResourceDescription, - Constraints: []validation.Constraint{{Target: "applicationResourceDescription.ApplicationResourceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicefabricmesh.ApplicationClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, applicationName, applicationResourceDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.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, "servicefabricmesh.ApplicationClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, applicationName string, applicationResourceDescription ApplicationResourceDescription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}", pathParameters), - autorest.WithJSON(applicationResourceDescription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// 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, - azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationClient) CreateResponder(resp *http.Response) (result ApplicationResourceDescription, err error) { - err = 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 application resource identified by the name. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, applicationName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// 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, - azure.DoRetryWithRegistration(client.Client)) -} - -// 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 the information about the application resource with a given name. The information includes the information -// about the application's services and other runtime properties. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, applicationName string) (result ApplicationResourceDescription, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.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, "servicefabricmesh.ApplicationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// 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, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationClient) GetResponder(resp *http.Response) (result ApplicationResourceDescription, 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 information about all application resources in a given resource group. The information -// includes the information about the application's services and other runtime properties. -// Parameters: -// resourceGroupName - azure resource group name -func (client ApplicationClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationResourceDescriptionListPage, err error) { - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.ardl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.ardl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ApplicationClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ApplicationClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationResourceDescriptionList, 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 ApplicationClient) listByResourceGroupNextResults(lastResults ApplicationResourceDescriptionList) (result ApplicationResourceDescriptionList, err error) { - req, err := lastResults.applicationResourceDescriptionListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listByResourceGroupNextResults", 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, "servicefabricmesh.ApplicationClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationResourceDescriptionListIterator, err error) { - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription gets the information about all application resources in a given subscription. The information -// includes the information about the application's services and other runtime properties. -func (client ApplicationClient) ListBySubscription(ctx context.Context) (result ApplicationResourceDescriptionListPage, err error) { - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.ardl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.ardl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ApplicationClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ApplicationClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationResourceDescriptionList, 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 ApplicationClient) listBySubscriptionNextResults(lastResults ApplicationResourceDescriptionList) (result ApplicationResourceDescriptionList, err error) { - req, err := lastResults.applicationResourceDescriptionListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listBySubscriptionNextResults", 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, "servicefabricmesh.ApplicationClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationClient) ListBySubscriptionComplete(ctx context.Context) (result ApplicationResourceDescriptionListIterator, err error) { - result.page, err = client.ListBySubscription(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/client.go deleted file mode 100644 index b854fb79d..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/client.go +++ /dev/null @@ -1,51 +0,0 @@ -// Package servicefabricmesh implements the Azure ARM Servicefabricmesh service API version 2018-07-01-preview. -// -// Service Fabric Mesh Management Client -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// 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 Servicefabricmesh - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Servicefabricmesh. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/codepackage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/codepackage.go deleted file mode 100644 index 70eec946f..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/codepackage.go +++ /dev/null @@ -1,117 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// CodePackageClient is the service Fabric Mesh Management Client -type CodePackageClient struct { - BaseClient -} - -// NewCodePackageClient creates an instance of the CodePackageClient client. -func NewCodePackageClient(subscriptionID string) CodePackageClient { - return NewCodePackageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCodePackageClientWithBaseURI creates an instance of the CodePackageClient client. -func NewCodePackageClientWithBaseURI(baseURI string, subscriptionID string) CodePackageClient { - return CodePackageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetContainerLog get the logs for the container of a given code package of an application. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -// serviceName - the identity of the service. -// replicaName - the identity of the service replica. -// codePackageName - the name of the code package. -// tail - number of lines to show from the end of the logs. Default is 100. -func (client CodePackageClient) GetContainerLog(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string, codePackageName string, tail *int32) (result ContainerLogs, err error) { - req, err := client.GetContainerLogPreparer(ctx, resourceGroupName, applicationName, serviceName, replicaName, codePackageName, tail) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.CodePackageClient", "GetContainerLog", nil, "Failure preparing request") - return - } - - resp, err := client.GetContainerLogSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.CodePackageClient", "GetContainerLog", resp, "Failure sending request") - return - } - - result, err = client.GetContainerLogResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.CodePackageClient", "GetContainerLog", resp, "Failure responding to request") - } - - return -} - -// GetContainerLogPreparer prepares the GetContainerLog request. -func (client CodePackageClient) GetContainerLogPreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string, codePackageName string, tail *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "codePackageName": codePackageName, - "replicaName": replicaName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": serviceName, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if tail != nil { - queryParameters["tail"] = autorest.Encode("query", *tail) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}/codePackages/{codePackageName}/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContainerLogSender sends the GetContainerLog request. The method will close the -// http.Response Body if it receives an error. -func (client CodePackageClient) GetContainerLogSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetContainerLogResponder handles the response to the GetContainerLog request. The method always -// closes the http.Response Body. -func (client CodePackageClient) GetContainerLogResponder(resp *http.Response) (result ContainerLogs, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/models.go deleted file mode 100644 index 95f1cc8d7..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/models.go +++ /dev/null @@ -1,1835 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ApplicationResourceStatus enumerates the values for application resource status. -type ApplicationResourceStatus string - -const ( - // Creating ... - Creating ApplicationResourceStatus = "Creating" - // Deleting ... - Deleting ApplicationResourceStatus = "Deleting" - // Failed ... - Failed ApplicationResourceStatus = "Failed" - // Invalid ... - Invalid ApplicationResourceStatus = "Invalid" - // Ready ... - Ready ApplicationResourceStatus = "Ready" - // Upgrading ... - Upgrading ApplicationResourceStatus = "Upgrading" -) - -// PossibleApplicationResourceStatusValues returns an array of possible values for the ApplicationResourceStatus const type. -func PossibleApplicationResourceStatusValues() []ApplicationResourceStatus { - return []ApplicationResourceStatus{Creating, Deleting, Failed, Invalid, Ready, Upgrading} -} - -// DiagnosticsSinkKind enumerates the values for diagnostics sink kind. -type DiagnosticsSinkKind string - -const ( - // DiagnosticsSinkKindAzureInternalMonitoringPipeline Diagnostics settings for Geneva. - DiagnosticsSinkKindAzureInternalMonitoringPipeline DiagnosticsSinkKind = "AzureInternalMonitoringPipeline" - // DiagnosticsSinkKindInvalid Indicates an invalid sink kind. All Service Fabric enumerations have the - // invalid type. - DiagnosticsSinkKindInvalid DiagnosticsSinkKind = "Invalid" -) - -// PossibleDiagnosticsSinkKindValues returns an array of possible values for the DiagnosticsSinkKind const type. -func PossibleDiagnosticsSinkKindValues() []DiagnosticsSinkKind { - return []DiagnosticsSinkKind{DiagnosticsSinkKindAzureInternalMonitoringPipeline, DiagnosticsSinkKindInvalid} -} - -// HealthState enumerates the values for health state. -type HealthState string - -const ( - // HealthStateError Indicates the health state is at an error level. Error health state should be - // investigated, as they can impact the correct functionality of the cluster. The value is 3. - HealthStateError HealthState = "Error" - // HealthStateInvalid Indicates an invalid health state. All Service Fabric enumerations have the invalid - // type. The value is zero. - HealthStateInvalid HealthState = "Invalid" - // HealthStateOk Indicates the health state is okay. The value is 1. - HealthStateOk HealthState = "Ok" - // HealthStateUnknown Indicates an unknown health status. The value is 65535. - HealthStateUnknown HealthState = "Unknown" - // HealthStateWarning Indicates the health state is at a warning level. The value is 2. - HealthStateWarning HealthState = "Warning" -) - -// PossibleHealthStateValues returns an array of possible values for the HealthState const type. -func PossibleHealthStateValues() []HealthState { - return []HealthState{HealthStateError, HealthStateInvalid, HealthStateOk, HealthStateUnknown, HealthStateWarning} -} - -// IngressQoSLevel enumerates the values for ingress qo s level. -type IngressQoSLevel string - -const ( - // Bronze ... - Bronze IngressQoSLevel = "Bronze" -) - -// PossibleIngressQoSLevelValues returns an array of possible values for the IngressQoSLevel const type. -func PossibleIngressQoSLevelValues() []IngressQoSLevel { - return []IngressQoSLevel{Bronze} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindAzureInternalMonitoringPipeline ... - KindAzureInternalMonitoringPipeline Kind = "AzureInternalMonitoringPipeline" - // KindDiagnosticsSinkProperties ... - KindDiagnosticsSinkProperties Kind = "DiagnosticsSinkProperties" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindAzureInternalMonitoringPipeline, KindDiagnosticsSinkProperties} -} - -// OperatingSystemTypes enumerates the values for operating system types. -type OperatingSystemTypes string - -const ( - // Linux ... - Linux OperatingSystemTypes = "Linux" - // Windows ... - Windows OperatingSystemTypes = "Windows" -) - -// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. -func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { - return []OperatingSystemTypes{Linux, Windows} -} - -// ServiceResourceStatus enumerates the values for service resource status. -type ServiceResourceStatus string - -const ( - // ServiceResourceStatusActive ... - ServiceResourceStatusActive ServiceResourceStatus = "Active" - // ServiceResourceStatusCreating ... - ServiceResourceStatusCreating ServiceResourceStatus = "Creating" - // ServiceResourceStatusDeleting ... - ServiceResourceStatusDeleting ServiceResourceStatus = "Deleting" - // ServiceResourceStatusFailed ... - ServiceResourceStatusFailed ServiceResourceStatus = "Failed" - // ServiceResourceStatusUnknown ... - ServiceResourceStatusUnknown ServiceResourceStatus = "Unknown" - // ServiceResourceStatusUpgrading ... - ServiceResourceStatusUpgrading ServiceResourceStatus = "Upgrading" -) - -// PossibleServiceResourceStatusValues returns an array of possible values for the ServiceResourceStatus const type. -func PossibleServiceResourceStatusValues() []ServiceResourceStatus { - return []ServiceResourceStatus{ServiceResourceStatusActive, ServiceResourceStatusCreating, ServiceResourceStatusDeleting, ServiceResourceStatusFailed, ServiceResourceStatusUnknown, ServiceResourceStatusUpgrading} -} - -// ApplicationProperties this type describes properties of an application resource. -type ApplicationProperties struct { - // Description - User readable description of the application. - Description *string `json:"description,omitempty"` - // DebugParams - Internal use. - DebugParams *string `json:"debugParams,omitempty"` - // Services - describes the services in the application. - Services *[]ServiceResourceDescription `json:"services,omitempty"` - // HealthState - Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' - HealthState HealthState `json:"healthState,omitempty"` - // UnhealthyEvaluation - When the application's health state is not 'Ok', this additional details from service fabric Health Manager for the user to know why the application is marked unhealthy. - UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` - // Status - Status of the application resource. Possible values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' - Status ApplicationResourceStatus `json:"status,omitempty"` - // StatusDetails - Gives additional information about the current status of the application deployment. - StatusDetails *string `json:"statusDetails,omitempty"` - // ServiceNames - Names of the services in the application. - ServiceNames *[]string `json:"serviceNames,omitempty"` - // Diagnostics - Describes the diagnostics definition and usage for an application resource. - Diagnostics *DiagnosticsDescription `json:"diagnostics,omitempty"` -} - -// ApplicationResourceDescription this type describes an application resource. -type ApplicationResourceDescription struct { - autorest.Response `json:"-"` - // ApplicationResourceProperties - This type describes properties of an application resource. - *ApplicationResourceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceDescription. -func (ard ApplicationResourceDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ard.ApplicationResourceProperties != nil { - objectMap["properties"] = ard.ApplicationResourceProperties - } - if ard.Tags != nil { - objectMap["tags"] = ard.Tags - } - if ard.ID != nil { - objectMap["id"] = ard.ID - } - if ard.Name != nil { - objectMap["name"] = ard.Name - } - if ard.Type != nil { - objectMap["type"] = ard.Type - } - if ard.Location != nil { - objectMap["location"] = ard.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationResourceDescription struct. -func (ard *ApplicationResourceDescription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationResourceProperties ApplicationResourceProperties - err = json.Unmarshal(*v, &applicationResourceProperties) - if err != nil { - return err - } - ard.ApplicationResourceProperties = &applicationResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ard.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ard.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ard.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ard.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ard.Location = &location - } - } - } - - return nil -} - -// ApplicationResourceDescriptionList a pageable list of application resources. -type ApplicationResourceDescriptionList struct { - autorest.Response `json:"-"` - // Value - One page of the list. - Value *[]ApplicationResourceDescription `json:"value,omitempty"` - // NextLink - URI to fetch the next page of the list. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationResourceDescriptionListIterator provides access to a complete listing of -// ApplicationResourceDescription values. -type ApplicationResourceDescriptionListIterator struct { - i int - page ApplicationResourceDescriptionListPage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationResourceDescriptionListIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationResourceDescriptionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationResourceDescriptionListIterator) Response() ApplicationResourceDescriptionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationResourceDescriptionListIterator) Value() ApplicationResourceDescription { - if !iter.page.NotDone() { - return ApplicationResourceDescription{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (ardl ApplicationResourceDescriptionList) IsEmpty() bool { - return ardl.Value == nil || len(*ardl.Value) == 0 -} - -// applicationResourceDescriptionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ardl ApplicationResourceDescriptionList) applicationResourceDescriptionListPreparer() (*http.Request, error) { - if ardl.NextLink == nil || len(to.String(ardl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ardl.NextLink))) -} - -// ApplicationResourceDescriptionListPage contains a page of ApplicationResourceDescription values. -type ApplicationResourceDescriptionListPage struct { - fn func(ApplicationResourceDescriptionList) (ApplicationResourceDescriptionList, error) - ardl ApplicationResourceDescriptionList -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationResourceDescriptionListPage) Next() error { - next, err := page.fn(page.ardl) - if err != nil { - return err - } - page.ardl = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationResourceDescriptionListPage) NotDone() bool { - return !page.ardl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationResourceDescriptionListPage) Response() ApplicationResourceDescriptionList { - return page.ardl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationResourceDescriptionListPage) Values() []ApplicationResourceDescription { - if page.ardl.IsEmpty() { - return nil - } - return *page.ardl.Value -} - -// ApplicationResourceProperties this type describes properties of an application resource. -type ApplicationResourceProperties struct { - // ProvisioningState - State of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Description - User readable description of the application. - Description *string `json:"description,omitempty"` - // DebugParams - Internal use. - DebugParams *string `json:"debugParams,omitempty"` - // Services - describes the services in the application. - Services *[]ServiceResourceDescription `json:"services,omitempty"` - // HealthState - Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' - HealthState HealthState `json:"healthState,omitempty"` - // UnhealthyEvaluation - When the application's health state is not 'Ok', this additional details from service fabric Health Manager for the user to know why the application is marked unhealthy. - UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` - // Status - Status of the application resource. Possible values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' - Status ApplicationResourceStatus `json:"status,omitempty"` - // StatusDetails - Gives additional information about the current status of the application deployment. - StatusDetails *string `json:"statusDetails,omitempty"` - // ServiceNames - Names of the services in the application. - ServiceNames *[]string `json:"serviceNames,omitempty"` - // Diagnostics - Describes the diagnostics definition and usage for an application resource. - Diagnostics *DiagnosticsDescription `json:"diagnostics,omitempty"` -} - -// AvailableOperationDisplay an operation available at the listed Azure resource provider. -type AvailableOperationDisplay struct { - // Provider - Name of the operation provider. - Provider *string `json:"provider,omitempty"` - // Resource - Name of the resource on which the operation is available. - Resource *string `json:"resource,omitempty"` - // Operation - Name of the available operation. - Operation *string `json:"operation,omitempty"` - // Description - Description of the available operation. - Description *string `json:"description,omitempty"` -} - -// AzureInternalMonitoringPipelineSinkDescription diagnostics settings for Geneva. -type AzureInternalMonitoringPipelineSinkDescription struct { - // AccountName - Azure Internal monitoring pipeline account. - AccountName *string `json:"accountName,omitempty"` - // Namespace - Azure Internal monitoring pipeline account namespace. - Namespace *string `json:"namespace,omitempty"` - // MaConfigURL - Azure Internal monitoring agent configuration. - MaConfigURL *string `json:"maConfigUrl,omitempty"` - // FluentdConfigURL - Azure Internal monitoring agent fluentd configuration. - FluentdConfigURL interface{} `json:"fluentdConfigUrl,omitempty"` - // AutoKeyConfigURL - Azure Internal monitoring pipeline autokey associated with the certificate. - AutoKeyConfigURL *string `json:"autoKeyConfigUrl,omitempty"` - // Name - Name of the sink. This value is referenced by DiagnosticsReferenceDescription - Name *string `json:"name,omitempty"` - // Description - A description of the sink. - Description *string `json:"description,omitempty"` - // Kind - Possible values include: 'KindDiagnosticsSinkProperties', 'KindAzureInternalMonitoringPipeline' - Kind Kind `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureInternalMonitoringPipelineSinkDescription. -func (aimpsd AzureInternalMonitoringPipelineSinkDescription) MarshalJSON() ([]byte, error) { - aimpsd.Kind = KindAzureInternalMonitoringPipeline - objectMap := make(map[string]interface{}) - if aimpsd.AccountName != nil { - objectMap["accountName"] = aimpsd.AccountName - } - if aimpsd.Namespace != nil { - objectMap["namespace"] = aimpsd.Namespace - } - if aimpsd.MaConfigURL != nil { - objectMap["maConfigUrl"] = aimpsd.MaConfigURL - } - objectMap["fluentdConfigUrl"] = aimpsd.FluentdConfigURL - if aimpsd.AutoKeyConfigURL != nil { - objectMap["autoKeyConfigUrl"] = aimpsd.AutoKeyConfigURL - } - if aimpsd.Name != nil { - objectMap["name"] = aimpsd.Name - } - if aimpsd.Description != nil { - objectMap["description"] = aimpsd.Description - } - if aimpsd.Kind != "" { - objectMap["kind"] = aimpsd.Kind - } - return json.Marshal(objectMap) -} - -// AsAzureInternalMonitoringPipelineSinkDescription is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. -func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) { - return &aimpsd, true -} - -// AsDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. -func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) { - return nil, false -} - -// AsBasicDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. -func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsBasicDiagnosticsSinkProperties() (BasicDiagnosticsSinkProperties, bool) { - return &aimpsd, true -} - -// ContainerCodePackageProperties describes a container and its runtime properties. -type ContainerCodePackageProperties struct { - // Name - The name of the code package. - Name *string `json:"name,omitempty"` - // Image - The Container image to use. - Image *string `json:"image,omitempty"` - // ImageRegistryCredential - Image registry credential. - ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` - // Entrypoint - Override for the default entry point in the container. - Entrypoint *string `json:"entrypoint,omitempty"` - // Commands - Command array to execute within the container in exec form. - Commands *[]string `json:"commands,omitempty"` - // EnvironmentVariables - The environment variables to set in this container - EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` - // Settings - The settings to set in this container. The setting file path can be fetched from environment variable "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The path for Linux container is "/var/secrets". - Settings *[]Setting `json:"settings,omitempty"` - // Labels - The labels to set in this container. - Labels *[]ContainerLabel `json:"labels,omitempty"` - // Endpoints - The endpoints exposed by this container. - Endpoints *[]EndpointProperties `json:"endpoints,omitempty"` - // Resources - This type describes the resource requirements for a container or a service. - Resources *ResourceRequirements `json:"resources,omitempty"` - // VolumeRefs - The volumes to be attached to the container. - VolumeRefs *[]ContainerVolume `json:"volumeRefs,omitempty"` - // InstanceView - Runtime information of a container instance. - InstanceView *ContainerInstanceView `json:"instanceView,omitempty"` - // Diagnostics - Reference to sinks in DiagnosticsDescription. - Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` -} - -// ContainerEvent a container event. -type ContainerEvent struct { - // Name - The name of the container event. - Name *string `json:"name,omitempty"` - // Count - The count of the event. - Count *int32 `json:"count,omitempty"` - // FirstTimestamp - Date/time of the first event. - FirstTimestamp *string `json:"firstTimestamp,omitempty"` - // LastTimestamp - Date/time of the last event. - LastTimestamp *string `json:"lastTimestamp,omitempty"` - // Message - The event message - Message *string `json:"message,omitempty"` - // Type - The event type. - Type *string `json:"type,omitempty"` -} - -// ContainerInstanceView runtime information of a container instance. -type ContainerInstanceView struct { - // RestartCount - The number of times the container has been restarted. - RestartCount *int32 `json:"restartCount,omitempty"` - // CurrentState - Current container instance state. - CurrentState *ContainerState `json:"currentState,omitempty"` - // PreviousState - Previous container instance state. - PreviousState *ContainerState `json:"previousState,omitempty"` - // Events - The events of this container instance. - Events *[]ContainerEvent `json:"events,omitempty"` -} - -// ContainerLabel describes a container label. -type ContainerLabel struct { - // Name - The name of the container label. - Name *string `json:"name,omitempty"` - // Value - The value of the container label. - Value *string `json:"value,omitempty"` -} - -// ContainerLogs the logs of the container. -type ContainerLogs struct { - autorest.Response `json:"-"` - // Content - content of the log. - Content *string `json:"content,omitempty"` -} - -// ContainerState the container state. -type ContainerState struct { - // State - The state of this container - State *string `json:"state,omitempty"` - // StartTime - Date/time when the container state started. - StartTime *date.Time `json:"startTime,omitempty"` - // ExitCode - The container exit code. - ExitCode *string `json:"exitCode,omitempty"` - // FinishTime - Date/time when the container state finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // DetailStatus - Human-readable status of this state. - DetailStatus *string `json:"detailStatus,omitempty"` -} - -// ContainerVolume describes how a volume is attached to a container. -type ContainerVolume struct { - // Name - Name of the volume. - Name *string `json:"name,omitempty"` - // ReadOnly - The flag indicating whether the volume is read only. Default is 'false'. - ReadOnly *bool `json:"readOnly,omitempty"` - // DestinationPath - The path within the container at which the volume should be mounted. Only valid path characters are allowed. - DestinationPath *string `json:"destinationPath,omitempty"` -} - -// DiagnosticsDescription describes the diagnostics options available -type DiagnosticsDescription struct { - // Sinks - List of supported sinks that can be referenced. - Sinks *[]BasicDiagnosticsSinkProperties `json:"sinks,omitempty"` - // Enabled - Status of whether or not sinks are enabled. - Enabled *bool `json:"enabled,omitempty"` - // DefaultSinkRefs - The sinks to be used if diagnostics is enabled. Sink choices can be overridden at the service and code package level. - DefaultSinkRefs *[]string `json:"defaultSinkRefs,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticsDescription struct. -func (dd *DiagnosticsDescription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sinks": - if v != nil { - sinks, err := unmarshalBasicDiagnosticsSinkPropertiesArray(*v) - if err != nil { - return err - } - dd.Sinks = &sinks - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - dd.Enabled = &enabled - } - case "defaultSinkRefs": - if v != nil { - var defaultSinkRefs []string - err = json.Unmarshal(*v, &defaultSinkRefs) - if err != nil { - return err - } - dd.DefaultSinkRefs = &defaultSinkRefs - } - } - } - - return nil -} - -// DiagnosticsRef reference to sinks in DiagnosticsDescription. -type DiagnosticsRef struct { - // Enabled - Status of whether or not sinks are enabled. - Enabled *bool `json:"enabled,omitempty"` - // SinkRefs - List of sinks to be used if enabled. References the list of sinks in DiagnosticsDescription. - SinkRefs *[]string `json:"sinkRefs,omitempty"` -} - -// BasicDiagnosticsSinkProperties properties of a DiagnosticsSink. -type BasicDiagnosticsSinkProperties interface { - AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) - AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) -} - -// DiagnosticsSinkProperties properties of a DiagnosticsSink. -type DiagnosticsSinkProperties struct { - // Name - Name of the sink. This value is referenced by DiagnosticsReferenceDescription - Name *string `json:"name,omitempty"` - // Description - A description of the sink. - Description *string `json:"description,omitempty"` - // Kind - Possible values include: 'KindDiagnosticsSinkProperties', 'KindAzureInternalMonitoringPipeline' - Kind Kind `json:"kind,omitempty"` -} - -func unmarshalBasicDiagnosticsSinkProperties(body []byte) (BasicDiagnosticsSinkProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindAzureInternalMonitoringPipeline): - var aimpsd AzureInternalMonitoringPipelineSinkDescription - err := json.Unmarshal(body, &aimpsd) - return aimpsd, err - default: - var dsp DiagnosticsSinkProperties - err := json.Unmarshal(body, &dsp) - return dsp, err - } -} -func unmarshalBasicDiagnosticsSinkPropertiesArray(body []byte) ([]BasicDiagnosticsSinkProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dspArray := make([]BasicDiagnosticsSinkProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dsp, err := unmarshalBasicDiagnosticsSinkProperties(*rawMessage) - if err != nil { - return nil, err - } - dspArray[index] = dsp - } - return dspArray, nil -} - -// MarshalJSON is the custom marshaler for DiagnosticsSinkProperties. -func (dsp DiagnosticsSinkProperties) MarshalJSON() ([]byte, error) { - dsp.Kind = KindDiagnosticsSinkProperties - objectMap := make(map[string]interface{}) - if dsp.Name != nil { - objectMap["name"] = dsp.Name - } - if dsp.Description != nil { - objectMap["description"] = dsp.Description - } - if dsp.Kind != "" { - objectMap["kind"] = dsp.Kind - } - return json.Marshal(objectMap) -} - -// AsAzureInternalMonitoringPipelineSinkDescription is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. -func (dsp DiagnosticsSinkProperties) AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) { - return nil, false -} - -// AsDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. -func (dsp DiagnosticsSinkProperties) AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) { - return &dsp, true -} - -// AsBasicDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. -func (dsp DiagnosticsSinkProperties) AsBasicDiagnosticsSinkProperties() (BasicDiagnosticsSinkProperties, bool) { - return &dsp, true -} - -// EndpointProperties describes a container endpoint. -type EndpointProperties struct { - // Name - The name of the endpoint. - Name *string `json:"name,omitempty"` - // Port - Port used by the container. - Port *int32 `json:"port,omitempty"` -} - -// EnvironmentVariable describes an environment variable for the container. -type EnvironmentVariable struct { - // Name - The name of the environment variable. - Name *string `json:"name,omitempty"` - // Value - The value of the environment variable. - Value *string `json:"value,omitempty"` -} - -// ErrorModel the error details. -type ErrorModel struct { - // Code - The error code. - Code *string `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` -} - -// ImageRegistryCredential image registry credential. -type ImageRegistryCredential struct { - // Server - Docker image registry server, without protocol such as `http` and `https`. - Server *string `json:"server,omitempty"` - // Username - The username for the private registry. - Username *string `json:"username,omitempty"` - // Password - The password for the private registry. - Password *string `json:"password,omitempty"` -} - -// IngressConfig describes public connectivity configuration for the network. -type IngressConfig struct { - // QosLevel - The QoS tier for ingress. Possible values include: 'Bronze' - QosLevel IngressQoSLevel `json:"qosLevel,omitempty"` - // Layer4 - Configuration for layer4 public connectivity for this network. - Layer4 *[]Layer4IngressConfig `json:"layer4,omitempty"` - // PublicIPAddress - The public IP address for reaching this network. - PublicIPAddress *string `json:"publicIPAddress,omitempty"` -} - -// Layer4IngressConfig describes the layer4 configuration for public connectivity for this network. -type Layer4IngressConfig struct { - // Name - Layer4 ingress config name. - Name *string `json:"name,omitempty"` - // PublicPort - Specifies the public port at which the service endpoint below needs to be exposed. - PublicPort *int32 `json:"publicPort,omitempty"` - // ApplicationName - The application name which contains the service to be exposed. - ApplicationName *string `json:"applicationName,omitempty"` - // ServiceName - The service whose endpoint needs to be exposed at the public port. - ServiceName *string `json:"serviceName,omitempty"` - // EndpointName - The service endpoint that needs to be exposed. - EndpointName *string `json:"endpointName,omitempty"` -} - -// ManagedProxyResource the resource model definition for Azure Resource Manager proxy resource. It will have -// everything other than required location and tags. This proxy resource is explicitly created or updated by -// including it in the parent resource. -type ManagedProxyResource struct { - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` -} - -// NetworkProperties describes a network. -type NetworkProperties struct { - // Description - User readable description of the network. - Description *string `json:"description,omitempty"` - // AddressPrefix - the address prefix for this network. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // IngressConfig - Configuration for public connectivity for this network. - IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` -} - -// NetworkRef describes a network reference in a service. -type NetworkRef struct { - // Name - Name of the network. - Name *string `json:"name,omitempty"` -} - -// NetworkResourceDescription this type describes a network resource. -type NetworkResourceDescription struct { - autorest.Response `json:"-"` - // NetworkResourceProperties - Describes properties of a network resource. - *NetworkResourceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetworkResourceDescription. -func (nrd NetworkResourceDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nrd.NetworkResourceProperties != nil { - objectMap["properties"] = nrd.NetworkResourceProperties - } - if nrd.Tags != nil { - objectMap["tags"] = nrd.Tags - } - if nrd.ID != nil { - objectMap["id"] = nrd.ID - } - if nrd.Name != nil { - objectMap["name"] = nrd.Name - } - if nrd.Type != nil { - objectMap["type"] = nrd.Type - } - if nrd.Location != nil { - objectMap["location"] = nrd.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NetworkResourceDescription struct. -func (nrd *NetworkResourceDescription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var networkResourceProperties NetworkResourceProperties - err = json.Unmarshal(*v, &networkResourceProperties) - if err != nil { - return err - } - nrd.NetworkResourceProperties = &networkResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - nrd.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nrd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nrd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nrd.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - nrd.Location = &location - } - } - } - - return nil -} - -// NetworkResourceDescriptionList a pageable list of network resources. -type NetworkResourceDescriptionList struct { - autorest.Response `json:"-"` - // Value - One page of the list. - Value *[]NetworkResourceDescription `json:"value,omitempty"` - // NextLink - URI to fetch the next page of the list. - NextLink *string `json:"nextLink,omitempty"` -} - -// NetworkResourceDescriptionListIterator provides access to a complete listing of NetworkResourceDescription -// values. -type NetworkResourceDescriptionListIterator struct { - i int - page NetworkResourceDescriptionListPage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NetworkResourceDescriptionListIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NetworkResourceDescriptionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NetworkResourceDescriptionListIterator) Response() NetworkResourceDescriptionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NetworkResourceDescriptionListIterator) Value() NetworkResourceDescription { - if !iter.page.NotDone() { - return NetworkResourceDescription{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (nrdl NetworkResourceDescriptionList) IsEmpty() bool { - return nrdl.Value == nil || len(*nrdl.Value) == 0 -} - -// networkResourceDescriptionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nrdl NetworkResourceDescriptionList) networkResourceDescriptionListPreparer() (*http.Request, error) { - if nrdl.NextLink == nil || len(to.String(nrdl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nrdl.NextLink))) -} - -// NetworkResourceDescriptionListPage contains a page of NetworkResourceDescription values. -type NetworkResourceDescriptionListPage struct { - fn func(NetworkResourceDescriptionList) (NetworkResourceDescriptionList, error) - nrdl NetworkResourceDescriptionList -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NetworkResourceDescriptionListPage) Next() error { - next, err := page.fn(page.nrdl) - if err != nil { - return err - } - page.nrdl = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NetworkResourceDescriptionListPage) NotDone() bool { - return !page.nrdl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NetworkResourceDescriptionListPage) Response() NetworkResourceDescriptionList { - return page.nrdl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NetworkResourceDescriptionListPage) Values() []NetworkResourceDescription { - if page.nrdl.IsEmpty() { - return nil - } - return *page.nrdl.Value -} - -// NetworkResourceProperties describes properties of a network resource. -type NetworkResourceProperties struct { - // ProvisioningState - State of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Description - User readable description of the network. - Description *string `json:"description,omitempty"` - // AddressPrefix - the address prefix for this network. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // IngressConfig - Configuration for public connectivity for this network. - IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` -} - -// OperationListResult describes the result of the request to list Service Fabric operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Service Fabric operations supported by the Microsoft.ServiceFabric resource provider. - Value *[]OperationResult `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationResult values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() OperationResult { - if !iter.page.NotDone() { - return OperationResult{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { - if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of OperationResult values. -type OperationListResultPage struct { - fn func(OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) Next() error { - next, err := page.fn(page.olr) - if err != nil { - return err - } - page.olr = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []OperationResult { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// OperationResult list of operations available at the listed Azure resource provider. -type OperationResult struct { - // Name - The name of the operation. - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *AvailableOperationDisplay `json:"display,omitempty"` - // Origin - Origin result - Origin *string `json:"origin,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProvisionedResourceProperties describes common properties of a provisioned resource. -type ProvisionedResourceProperties struct { - // ProvisioningState - State of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ProxyResource the resource model definition for Azure Resource Manager proxy resource. It will have everything -// other than required location and tags. -type ProxyResource struct { - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` -} - -// Resource the resource model definition for Azure Resource Manager resource. -type Resource struct { - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` -} - -// ResourceLimits this type describes the resource limits for a given container. It describes the most amount of -// resources a container is allowed to use before being restarted. -type ResourceLimits struct { - // MemoryInGB - The memory limit in GB. - MemoryInGB *float64 `json:"memoryInGB,omitempty"` - // CPU - CPU limits in cores. At present, only full cores are supported. - CPU *float64 `json:"cpu,omitempty"` -} - -// ResourceRequests this type describes the requested resources for a given container. It describes the least -// amount of resources required for the container. A container can consume more than requested resources up to the -// specified limits before being restarted. Currently, the requested resources are treated as limits. -type ResourceRequests struct { - // MemoryInGB - The memory request in GB for this container. - MemoryInGB *float64 `json:"memoryInGB,omitempty"` - // CPU - Requested number of CPU cores. At present, only full cores are supported. - CPU *float64 `json:"cpu,omitempty"` -} - -// ResourceRequirements this type describes the resource requirements for a container or a service. -type ResourceRequirements struct { - // Requests - Describes the requested resources for a given container. - Requests *ResourceRequests `json:"requests,omitempty"` - // Limits - Describes the maximum limits on the resources for a given container. - Limits *ResourceLimits `json:"limits,omitempty"` -} - -// ServiceList a pageable list of all services in an application. -type ServiceList struct { - autorest.Response `json:"-"` - // Value - One page of the list. - Value *[]ServiceResourceDescription `json:"value,omitempty"` - // NextLink - URI to fetch the next page of the list. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceListIterator provides access to a complete listing of ServiceResourceDescription values. -type ServiceListIterator struct { - i int - page ServiceListPage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceListIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceListIterator) Response() ServiceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceListIterator) Value() ServiceResourceDescription { - if !iter.page.NotDone() { - return ServiceResourceDescription{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl ServiceList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// serviceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl ServiceList) serviceListPreparer() (*http.Request, error) { - if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// ServiceListPage contains a page of ServiceResourceDescription values. -type ServiceListPage struct { - fn func(ServiceList) (ServiceList, error) - sl ServiceList -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceListPage) Next() error { - next, err := page.fn(page.sl) - if err != nil { - return err - } - page.sl = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceListPage) Response() ServiceList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceListPage) Values() []ServiceResourceDescription { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// ServiceReplicaDescription this type describes a replica of a service resource. -type ServiceReplicaDescription struct { - autorest.Response `json:"-"` - // ReplicaName - Name of the replica. - ReplicaName *string `json:"replicaName,omitempty"` - // OsType - The Operating system type required by the code in service. - // . Possible values include: 'Linux', 'Windows' - OsType OperatingSystemTypes `json:"osType,omitempty"` - // CodePackages - Describes the set of code packages that forms the service. A code package describes the container and the properties for running it. All the code packages are started together on the same host and share the same context (network, process etc.). - CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` - // NetworkRefs - The names of the private networks that this service needs to be part of. - NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` - // Diagnostics - Reference to sinks in DiagnosticsDescription. - Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` -} - -// ServiceReplicaList a pageable list of replicas of a service resource. -type ServiceReplicaList struct { - autorest.Response `json:"-"` - // Value - One page of the list. - Value *[]ServiceReplicaDescription `json:"value,omitempty"` - // NextLink - URI to fetch the next page of the list. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceReplicaListIterator provides access to a complete listing of ServiceReplicaDescription values. -type ServiceReplicaListIterator struct { - i int - page ServiceReplicaListPage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceReplicaListIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceReplicaListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceReplicaListIterator) Response() ServiceReplicaList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceReplicaListIterator) Value() ServiceReplicaDescription { - if !iter.page.NotDone() { - return ServiceReplicaDescription{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (srl ServiceReplicaList) IsEmpty() bool { - return srl.Value == nil || len(*srl.Value) == 0 -} - -// serviceReplicaListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srl ServiceReplicaList) serviceReplicaListPreparer() (*http.Request, error) { - if srl.NextLink == nil || len(to.String(srl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srl.NextLink))) -} - -// ServiceReplicaListPage contains a page of ServiceReplicaDescription values. -type ServiceReplicaListPage struct { - fn func(ServiceReplicaList) (ServiceReplicaList, error) - srl ServiceReplicaList -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceReplicaListPage) Next() error { - next, err := page.fn(page.srl) - if err != nil { - return err - } - page.srl = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceReplicaListPage) NotDone() bool { - return !page.srl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceReplicaListPage) Response() ServiceReplicaList { - return page.srl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceReplicaListPage) Values() []ServiceReplicaDescription { - if page.srl.IsEmpty() { - return nil - } - return *page.srl.Value -} - -// ServiceReplicaProperties describes the properties of a service replica. -type ServiceReplicaProperties struct { - // OsType - The Operating system type required by the code in service. - // . Possible values include: 'Linux', 'Windows' - OsType OperatingSystemTypes `json:"osType,omitempty"` - // CodePackages - Describes the set of code packages that forms the service. A code package describes the container and the properties for running it. All the code packages are started together on the same host and share the same context (network, process etc.). - CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` - // NetworkRefs - The names of the private networks that this service needs to be part of. - NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` - // Diagnostics - Reference to sinks in DiagnosticsDescription. - Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` -} - -// ServiceResourceDescription this type describes a service resource. -type ServiceResourceDescription struct { - autorest.Response `json:"-"` - // ServiceResourceProperties - This type describes properties of a service resource. - *ServiceResourceProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResourceDescription. -func (srd ServiceResourceDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srd.ServiceResourceProperties != nil { - objectMap["properties"] = srd.ServiceResourceProperties - } - if srd.ID != nil { - objectMap["id"] = srd.ID - } - if srd.Name != nil { - objectMap["name"] = srd.Name - } - if srd.Type != nil { - objectMap["type"] = srd.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceDescription struct. -func (srd *ServiceResourceDescription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceResourceProperties ServiceResourceProperties - err = json.Unmarshal(*v, &serviceResourceProperties) - if err != nil { - return err - } - srd.ServiceResourceProperties = &serviceResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - srd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - srd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - srd.Type = &typeVar - } - } - } - - return nil -} - -// ServiceResourceProperties this type describes properties of a service resource. -type ServiceResourceProperties struct { - // Description - User readable description of the service. - Description *string `json:"description,omitempty"` - // ReplicaCount - The number of replicas of the service to create. Defaults to 1 if not specified. - ReplicaCount *int32 `json:"replicaCount,omitempty"` - // HealthState - The health state of a resource such as Application, Service, or Network. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' - HealthState HealthState `json:"healthState,omitempty"` - // Status - Represents the status of the service. Possible values include: 'ServiceResourceStatusUnknown', 'ServiceResourceStatusActive', 'ServiceResourceStatusUpgrading', 'ServiceResourceStatusDeleting', 'ServiceResourceStatusCreating', 'ServiceResourceStatusFailed' - Status ServiceResourceStatus `json:"status,omitempty"` - // OsType - The Operating system type required by the code in service. - // . Possible values include: 'Linux', 'Windows' - OsType OperatingSystemTypes `json:"osType,omitempty"` - // CodePackages - Describes the set of code packages that forms the service. A code package describes the container and the properties for running it. All the code packages are started together on the same host and share the same context (network, process etc.). - CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` - // NetworkRefs - The names of the private networks that this service needs to be part of. - NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` - // Diagnostics - Reference to sinks in DiagnosticsDescription. - Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` -} - -// Setting describes a setting for the container. -type Setting struct { - // Name - The name of the setting. - Name *string `json:"name,omitempty"` - // Value - The value of the setting. - Value *string `json:"value,omitempty"` -} - -// TrackedResource the resource model definition for Azure Resource Manager tracked top-level resource. -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.ID != nil { - objectMap["id"] = tr.ID - } - if tr.Name != nil { - objectMap["name"] = tr.Name - } - if tr.Type != nil { - objectMap["type"] = tr.Type - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// VolumeProperties this type describes properties of a volume resource. -type VolumeProperties struct { - // Description - User readable description of the volume. - Description *string `json:"description,omitempty"` - // Provider - Provider of the volume. - Provider *string `json:"provider,omitempty"` - // AzureFileParameters - This type describes a volume provided by an Azure Files file share. - AzureFileParameters *VolumeProviderParametersAzureFile `json:"azureFileParameters,omitempty"` -} - -// VolumeProviderParametersAzureFile this type describes a volume provided by an Azure Files file share. -type VolumeProviderParametersAzureFile struct { - // AccountName - Name of the Azure storage account for the File Share. - AccountName *string `json:"accountName,omitempty"` - // AccountKey - Access key of the Azure storage account for the File Share. - AccountKey *string `json:"accountKey,omitempty"` - // ShareName - Name of the Azure Files file share that provides storage for the volume. - ShareName *string `json:"shareName,omitempty"` -} - -// VolumeResourceDescription this type describes a volume resource. -type VolumeResourceDescription struct { - autorest.Response `json:"-"` - // VolumeResourceProperties - Describes properties of a volume resource. - *VolumeResourceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - The name of the resource - Name *string `json:"name,omitempty"` - // Type - The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeResourceDescription. -func (vrd VolumeResourceDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vrd.VolumeResourceProperties != nil { - objectMap["properties"] = vrd.VolumeResourceProperties - } - if vrd.Tags != nil { - objectMap["tags"] = vrd.Tags - } - if vrd.ID != nil { - objectMap["id"] = vrd.ID - } - if vrd.Name != nil { - objectMap["name"] = vrd.Name - } - if vrd.Type != nil { - objectMap["type"] = vrd.Type - } - if vrd.Location != nil { - objectMap["location"] = vrd.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeResourceDescription struct. -func (vrd *VolumeResourceDescription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var volumeResourceProperties VolumeResourceProperties - err = json.Unmarshal(*v, &volumeResourceProperties) - if err != nil { - return err - } - vrd.VolumeResourceProperties = &volumeResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vrd.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vrd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vrd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vrd.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vrd.Location = &location - } - } - } - - return nil -} - -// VolumeResourceDescriptionList a pageable list of volume resources. -type VolumeResourceDescriptionList struct { - autorest.Response `json:"-"` - // Value - One page of the list. - Value *[]VolumeResourceDescription `json:"value,omitempty"` - // NextLink - URI to fetch the next page of the list. - NextLink *string `json:"nextLink,omitempty"` -} - -// VolumeResourceDescriptionListIterator provides access to a complete listing of VolumeResourceDescription values. -type VolumeResourceDescriptionListIterator struct { - i int - page VolumeResourceDescriptionListPage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VolumeResourceDescriptionListIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VolumeResourceDescriptionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VolumeResourceDescriptionListIterator) Response() VolumeResourceDescriptionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VolumeResourceDescriptionListIterator) Value() VolumeResourceDescription { - if !iter.page.NotDone() { - return VolumeResourceDescription{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (vrdl VolumeResourceDescriptionList) IsEmpty() bool { - return vrdl.Value == nil || len(*vrdl.Value) == 0 -} - -// volumeResourceDescriptionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vrdl VolumeResourceDescriptionList) volumeResourceDescriptionListPreparer() (*http.Request, error) { - if vrdl.NextLink == nil || len(to.String(vrdl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vrdl.NextLink))) -} - -// VolumeResourceDescriptionListPage contains a page of VolumeResourceDescription values. -type VolumeResourceDescriptionListPage struct { - fn func(VolumeResourceDescriptionList) (VolumeResourceDescriptionList, error) - vrdl VolumeResourceDescriptionList -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VolumeResourceDescriptionListPage) Next() error { - next, err := page.fn(page.vrdl) - if err != nil { - return err - } - page.vrdl = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VolumeResourceDescriptionListPage) NotDone() bool { - return !page.vrdl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VolumeResourceDescriptionListPage) Response() VolumeResourceDescriptionList { - return page.vrdl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VolumeResourceDescriptionListPage) Values() []VolumeResourceDescription { - if page.vrdl.IsEmpty() { - return nil - } - return *page.vrdl.Value -} - -// VolumeResourceProperties describes properties of a volume resource. -type VolumeResourceProperties struct { - // ProvisioningState - State of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Description - User readable description of the volume. - Description *string `json:"description,omitempty"` - // Provider - Provider of the volume. - Provider *string `json:"provider,omitempty"` - // AzureFileParameters - This type describes a volume provided by an Azure Files file share. - AzureFileParameters *VolumeProviderParametersAzureFile `json:"azureFileParameters,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/network.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/network.go deleted file mode 100644 index ddcef5bca..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/network.go +++ /dev/null @@ -1,441 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NetworkClient is the service Fabric Mesh Management Client -type NetworkClient struct { - BaseClient -} - -// NewNetworkClient creates an instance of the NetworkClient client. -func NewNetworkClient(subscriptionID string) NetworkClient { - return NewNetworkClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkClientWithBaseURI creates an instance of the NetworkClient client. -func NewNetworkClientWithBaseURI(baseURI string, subscriptionID string) NetworkClient { - return NetworkClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a network resource with the specified name and description. If a network with the same name already -// exists, then its description is updated to the one indicated in this request. -// -// Use network resources to create private network and configure public connectivity for services within your -// application. -// Parameters: -// resourceGroupName - azure resource group name -// networkName - the identity of the network. -// networkResourceDescription - description for creating a network resource. -func (client NetworkClient) Create(ctx context.Context, resourceGroupName string, networkName string, networkResourceDescription NetworkResourceDescription) (result NetworkResourceDescription, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: networkResourceDescription, - Constraints: []validation.Constraint{{Target: "networkResourceDescription.NetworkResourceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "networkResourceDescription.NetworkResourceProperties.AddressPrefix", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicefabricmesh.NetworkClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, networkName, networkResourceDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client NetworkClient) CreatePreparer(ctx context.Context, resourceGroupName string, networkName string, networkResourceDescription NetworkResourceDescription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkName": networkName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkName}", pathParameters), - autorest.WithJSON(networkResourceDescription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client NetworkClient) CreateResponder(resp *http.Response) (result NetworkResourceDescription, err error) { - err = 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 network resource identified by the name. -// Parameters: -// resourceGroupName - azure resource group name -// networkName - the identity of the network. -func (client NetworkClient) Delete(ctx context.Context, resourceGroupName string, networkName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, networkName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NetworkClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkName": networkName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/networks/{networkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NetworkClient) 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 information about the network resource with a given name. This information includes the network -// description and other runtime information. -// Parameters: -// resourceGroupName - azure resource group name -// networkName - the identity of the network. -func (client NetworkClient) Get(ctx context.Context, resourceGroupName string, networkName string) (result NetworkResourceDescription, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, networkName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NetworkClient) GetPreparer(ctx context.Context, resourceGroupName string, networkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkName": networkName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/networks/{networkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NetworkClient) GetResponder(resp *http.Response) (result NetworkResourceDescription, 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 information about all network resources in a given resource group. The information -// includes the network description and other runtime properties. -// Parameters: -// resourceGroupName - azure resource group name -func (client NetworkClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result NetworkResourceDescriptionListPage, err error) { - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.nrdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.nrdl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NetworkClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/networks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client NetworkClient) ListByResourceGroupResponder(resp *http.Response) (result NetworkResourceDescriptionList, 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 NetworkClient) listByResourceGroupNextResults(lastResults NetworkResourceDescriptionList) (result NetworkResourceDescriptionList, err error) { - req, err := lastResults.networkResourceDescriptionListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listByResourceGroupNextResults", 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, "servicefabricmesh.NetworkClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client NetworkClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result NetworkResourceDescriptionListIterator, err error) { - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription gets the information about all network resources in a given subscription. The information -// includes the network description and other runtime properties. -func (client NetworkClient) ListBySubscription(ctx context.Context) (result NetworkResourceDescriptionListPage, err error) { - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.nrdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.nrdl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client NetworkClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/networks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client NetworkClient) ListBySubscriptionResponder(resp *http.Response) (result NetworkResourceDescriptionList, 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 NetworkClient) listBySubscriptionNextResults(lastResults NetworkResourceDescriptionList) (result NetworkResourceDescriptionList, err error) { - req, err := lastResults.networkResourceDescriptionListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listBySubscriptionNextResults", 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, "servicefabricmesh.NetworkClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client NetworkClient) ListBySubscriptionComplete(ctx context.Context) (result NetworkResourceDescriptionListIterator, err error) { - result.page, err = client.ListBySubscription(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/operations.go deleted file mode 100644 index 41e38d871..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/operations.go +++ /dev/null @@ -1,126 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the service Fabric Mesh Management Client -type OperationsClient struct { - BaseClient -} - -// 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 operations provided by Service Fabric SeaBreeze resource provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ServiceFabricMesh/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// 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, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// 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, "servicefabricmesh.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/replica.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/replica.go deleted file mode 100644 index ad37938df..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/replica.go +++ /dev/null @@ -1,210 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ReplicaClient is the service Fabric Mesh Management Client -type ReplicaClient struct { - BaseClient -} - -// NewReplicaClient creates an instance of the ReplicaClient client. -func NewReplicaClient(subscriptionID string) ReplicaClient { - return NewReplicaClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicaClientWithBaseURI creates an instance of the ReplicaClient client. -func NewReplicaClientWithBaseURI(baseURI string, subscriptionID string) ReplicaClient { - return ReplicaClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the information about the specified replica of a given service of an application. The information includes -// the runtime properties of the replica instance. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -// serviceName - the identity of the service. -// replicaName - the identity of the service replica. -func (client ReplicaClient) Get(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string) (result ServiceReplicaDescription, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, applicationName, serviceName, replicaName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicaClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "replicaName": replicaName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": serviceName, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicaClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ReplicaClient) GetResponder(resp *http.Response) (result ServiceReplicaDescription, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceName gets the information about all replicas of a given service of an application. The information -// includes the runtime properties of the replica instance. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -// serviceName - the identity of the service. -func (client ReplicaClient) ListByServiceName(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (result ServiceReplicaListPage, err error) { - result.fn = client.listByServiceNameNextResults - req, err := client.ListByServiceNamePreparer(ctx, resourceGroupName, applicationName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "ListByServiceName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceNameSender(req) - if err != nil { - result.srl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "ListByServiceName", resp, "Failure sending request") - return - } - - result.srl, err = client.ListByServiceNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "ListByServiceName", resp, "Failure responding to request") - } - - return -} - -// ListByServiceNamePreparer prepares the ListByServiceName request. -func (client ReplicaClient) ListByServiceNamePreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": serviceName, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceNameSender sends the ListByServiceName request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicaClient) ListByServiceNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceNameResponder handles the response to the ListByServiceName request. The method always -// closes the http.Response Body. -func (client ReplicaClient) ListByServiceNameResponder(resp *http.Response) (result ServiceReplicaList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNameNextResults retrieves the next set of results, if any. -func (client ReplicaClient) listByServiceNameNextResults(lastResults ServiceReplicaList) (result ServiceReplicaList, err error) { - req, err := lastResults.serviceReplicaListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "listByServiceNameNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "listByServiceNameNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "listByServiceNameNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceNameComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicaClient) ListByServiceNameComplete(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (result ServiceReplicaListIterator, err error) { - result.page, err = client.ListByServiceName(ctx, resourceGroupName, applicationName, serviceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/service.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/service.go deleted file mode 100644 index 307371fb9..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/service.go +++ /dev/null @@ -1,205 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ServiceClient is the service Fabric Mesh Management Client -type ServiceClient struct { - BaseClient -} - -// NewServiceClient creates an instance of the ServiceClient client. -func NewServiceClient(subscriptionID string) ServiceClient { - return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceClientWithBaseURI creates an instance of the ServiceClient client. -func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient { - return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get the operation returns the properties of the service. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -// serviceName - the identity of the service. -func (client ServiceClient) Get(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (result ServiceResourceDescription, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, applicationName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": serviceName, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetResponder(resp *http.Response) (result ServiceResourceDescription, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByApplicationName gets the information about all services of a given service of an application. The information -// includes the runtime properties of the service instance. -// Parameters: -// resourceGroupName - azure resource group name -// applicationName - the identity of the application. -func (client ServiceClient) ListByApplicationName(ctx context.Context, resourceGroupName string, applicationName string) (result ServiceListPage, err error) { - result.fn = client.listByApplicationNameNextResults - req, err := client.ListByApplicationNamePreparer(ctx, resourceGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "ListByApplicationName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByApplicationNameSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "ListByApplicationName", resp, "Failure sending request") - return - } - - result.sl, err = client.ListByApplicationNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "ListByApplicationName", resp, "Failure responding to request") - } - - return -} - -// ListByApplicationNamePreparer prepares the ListByApplicationName request. -func (client ServiceClient) ListByApplicationNamePreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": applicationName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/applications/{applicationName}/services", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByApplicationNameSender sends the ListByApplicationName request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ListByApplicationNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByApplicationNameResponder handles the response to the ListByApplicationName request. The method always -// closes the http.Response Body. -func (client ServiceClient) ListByApplicationNameResponder(resp *http.Response) (result ServiceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByApplicationNameNextResults retrieves the next set of results, if any. -func (client ServiceClient) listByApplicationNameNextResults(lastResults ServiceList) (result ServiceList, err error) { - req, err := lastResults.serviceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "listByApplicationNameNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByApplicationNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "listByApplicationNameNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByApplicationNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "listByApplicationNameNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByApplicationNameComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListByApplicationNameComplete(ctx context.Context, resourceGroupName string, applicationName string) (result ServiceListIterator, err error) { - result.page, err = client.ListByApplicationName(ctx, resourceGroupName, applicationName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/version.go deleted file mode 100644 index 6f8bfc012..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/version.go +++ /dev/null @@ -1,30 +0,0 @@ -package servicefabricmesh - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// 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/" + version.Number + " servicefabricmesh/2018-07-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/volume.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/volume.go deleted file mode 100644 index 726df0e67..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/volume.go +++ /dev/null @@ -1,443 +0,0 @@ -package servicefabricmesh - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VolumeClient is the service Fabric Mesh Management Client -type VolumeClient struct { - BaseClient -} - -// NewVolumeClient creates an instance of the VolumeClient client. -func NewVolumeClient(subscriptionID string) VolumeClient { - return NewVolumeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVolumeClientWithBaseURI creates an instance of the VolumeClient client. -func NewVolumeClientWithBaseURI(baseURI string, subscriptionID string) VolumeClient { - return VolumeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a volume resource with the specified name and description. If a volume with the same name already -// exists, then its description is updated to the one indicated in this request. -// Parameters: -// resourceGroupName - azure resource group name -// volumeName - the identity of the volume. -// volumeResourceDescription - description for creating a volume resource. -func (client VolumeClient) Create(ctx context.Context, resourceGroupName string, volumeName string, volumeResourceDescription VolumeResourceDescription) (result VolumeResourceDescription, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: volumeResourceDescription, - Constraints: []validation.Constraint{{Target: "volumeResourceDescription.VolumeResourceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "volumeResourceDescription.VolumeResourceProperties.Provider", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "volumeResourceDescription.VolumeResourceProperties.AzureFileParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "volumeResourceDescription.VolumeResourceProperties.AzureFileParameters.AccountName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "volumeResourceDescription.VolumeResourceProperties.AzureFileParameters.ShareName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("servicefabricmesh.VolumeClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, volumeName, volumeResourceDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client VolumeClient) CreatePreparer(ctx context.Context, resourceGroupName string, volumeName string, volumeResourceDescription VolumeResourceDescription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": volumeName, - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeName}", pathParameters), - autorest.WithJSON(volumeResourceDescription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client VolumeClient) CreateResponder(resp *http.Response) (result VolumeResourceDescription, err error) { - err = 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 volume identified by the name. -// Parameters: -// resourceGroupName - azure resource group name -// volumeName - the identity of the volume. -func (client VolumeClient) Delete(ctx context.Context, resourceGroupName string, volumeName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VolumeClient) DeletePreparer(ctx context.Context, resourceGroupName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": volumeName, - } - - const APIVersion = "2018-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.ServiceFabricMesh/volumes/{volumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VolumeClient) 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 information about the volume resource with a given name. This information includes the volume -// description and other runtime information. -// Parameters: -// resourceGroupName - azure resource group name -// volumeName - the identity of the volume. -func (client VolumeClient) Get(ctx context.Context, resourceGroupName string, volumeName string) (result VolumeResourceDescription, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VolumeClient) GetPreparer(ctx context.Context, resourceGroupName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": volumeName, - } - - const APIVersion = "2018-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.ServiceFabricMesh/volumes/{volumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VolumeClient) GetResponder(resp *http.Response) (result VolumeResourceDescription, 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 information about all volume resources in a given resource group. The information -// includes the volume description and other runtime information. -// Parameters: -// resourceGroupName - azure resource group name -func (client VolumeClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VolumeResourceDescriptionListPage, err error) { - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.vrdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.vrdl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VolumeClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/volumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client VolumeClient) ListByResourceGroupResponder(resp *http.Response) (result VolumeResourceDescriptionList, 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 VolumeClient) listByResourceGroupNextResults(lastResults VolumeResourceDescriptionList) (result VolumeResourceDescriptionList, err error) { - req, err := lastResults.volumeResourceDescriptionListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listByResourceGroupNextResults", 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, "servicefabricmesh.VolumeClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client VolumeClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VolumeResourceDescriptionListIterator, err error) { - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription gets the information about all volume resources in a given subscription. The information includes -// the volume description and other runtime information. -func (client VolumeClient) ListBySubscription(ctx context.Context) (result VolumeResourceDescriptionListPage, err error) { - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.vrdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.vrdl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client VolumeClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-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.ServiceFabricMesh/volumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client VolumeClient) ListBySubscriptionResponder(resp *http.Response) (result VolumeResourceDescriptionList, 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 VolumeClient) listBySubscriptionNextResults(lastResults VolumeResourceDescriptionList) (result VolumeResourceDescriptionList, err error) { - req, err := lastResults.volumeResourceDescriptionListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listBySubscriptionNextResults", 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, "servicefabricmesh.VolumeClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client VolumeClient) ListBySubscriptionComplete(ctx context.Context) (result VolumeResourceDescriptionListIterator, err error) { - result.page, err = client.ListBySubscription(ctx) - return -} diff --git a/website/data/providers.yaml b/website/data/providers.yaml index 48124ceac..eabb089f0 100644 --- a/website/data/providers.yaml +++ b/website/data/providers.yaml @@ -12,7 +12,5 @@ tag: huawei - name: HashiCorp Nomad tag: nomad -- name: Service Fabric Mesh - tag: sfmesh - name: vSphere Integrated Containers (**VIC**) tag: vic