From bfd54fd08fec326752d0666083a587d11abfa1d0 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 3 Aug 2020 05:32:13 +0000 Subject: [PATCH] Generated from fa6454cbee0b5fc598248d355c01153ce79a2591 Fix prettier. --- .../appplatform/appplatformapi/interfaces.go | 32 + .../2019-05-01-preview/appplatform/apps.go | 9 +- .../appplatform/bindings.go | 8 +- .../appplatform/certificates.go | 405 ++++++ .../appplatform/customdomains.go | 573 ++++++++ .../appplatform/deployments.go | 38 +- .../2019-05-01-preview/appplatform/enums.go | 261 ++++ .../2019-05-01-preview/appplatform/models.go | 1289 +++++++++++++---- .../appplatform/operations.go | 4 +- .../appplatform/services.go | 17 +- .../2019-05-01-preview/appplatform/sku.go | 153 ++ .../2019-05-01-preview/appplatform/version.go | 2 +- 12 files changed, 2442 insertions(+), 349 deletions(-) create mode 100644 services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/certificates.go create mode 100644 services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/customdomains.go create mode 100644 services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/enums.go create mode 100644 services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/sku.go diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go index 2149383d24e6..6e2a0a6252de 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go @@ -67,6 +67,30 @@ type BindingsClientAPI interface { var _ BindingsClientAPI = (*appplatform.BindingsClient)(nil) +// CertificatesClientAPI contains the set of methods on the CertificatesClient type. +type CertificatesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource appplatform.CertificateResource) (result appplatform.CertificateResource, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result appplatform.CertificateResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.CertificateResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.CertificateResourceCollectionIterator, err error) +} + +var _ CertificatesClientAPI = (*appplatform.CertificatesClient)(nil) + +// CustomDomainsClientAPI contains the set of methods on the CustomDomainsClient type. +type CustomDomainsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource appplatform.CustomDomainResource) (result appplatform.CustomDomainResource, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result appplatform.CustomDomainResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.CustomDomainResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.CustomDomainResourceCollectionIterator, err error) + Patch(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource appplatform.CustomDomainResource) (result appplatform.CustomDomainResource, err error) + Validate(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload appplatform.CustomDomainValidatePayload) (result appplatform.CustomDomainValidateResult, err error) +} + +var _ CustomDomainsClientAPI = (*appplatform.CustomDomainsClient)(nil) + // DeploymentsClientAPI contains the set of methods on the DeploymentsClient type. type DeploymentsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource appplatform.DeploymentResource) (result appplatform.DeploymentsCreateOrUpdateFuture, err error) @@ -92,3 +116,11 @@ type OperationsClientAPI interface { } var _ OperationsClientAPI = (*appplatform.OperationsClient)(nil) + +// SkuClientAPI contains the set of methods on the SkuClient type. +type SkuClientAPI interface { + List(ctx context.Context) (result appplatform.ResourceSkuCollectionPage, err error) + ListComplete(ctx context.Context) (result appplatform.ResourceSkuCollectionIterator, err error) +} + +var _ SkuClientAPI = (*appplatform.SkuClient)(nil) diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go index e01eeb81b16b..bd9c4f09bcc6 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go @@ -139,7 +139,6 @@ func (client AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCre func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result AppResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -218,7 +217,6 @@ func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) func (client AppsClient) 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 @@ -300,7 +298,6 @@ func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { func (client AppsClient) GetResponder(resp *http.Response) (result AppResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -379,7 +376,6 @@ func (client AppsClient) GetResourceUploadURLSender(req *http.Request) (*http.Re func (client AppsClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -421,6 +417,9 @@ func (client AppsClient) List(ctx context.Context, resourceGroupName string, ser if err != nil { err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure responding to request") } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -457,7 +456,6 @@ func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { func (client AppsClient) ListResponder(resp *http.Response) (result AppResourceCollection, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -576,7 +574,6 @@ func (client AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFutur func (client AppsClient) UpdateResponder(resp *http.Response) (result AppResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go index bb105e027b32..b085cc70681a 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go @@ -117,7 +117,6 @@ func (client BindingsClient) CreateOrUpdateSender(req *http.Request) (*http.Resp func (client BindingsClient) CreateOrUpdateResponder(resp *http.Response) (result BindingResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -198,7 +197,6 @@ func (client BindingsClient) DeleteSender(req *http.Request) (*http.Response, er func (client BindingsClient) 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 @@ -278,7 +276,6 @@ func (client BindingsClient) GetSender(req *http.Request) (*http.Response, error func (client BindingsClient) GetResponder(resp *http.Response) (result BindingResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -321,6 +318,9 @@ func (client BindingsClient) List(ctx context.Context, resourceGroupName string, if err != nil { err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure responding to request") } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -358,7 +358,6 @@ func (client BindingsClient) ListSender(req *http.Request) (*http.Response, erro func (client BindingsClient) ListResponder(resp *http.Response) (result BindingResourceCollection, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -479,7 +478,6 @@ func (client BindingsClient) UpdateSender(req *http.Request) (*http.Response, er func (client BindingsClient) UpdateResponder(resp *http.Response) (result BindingResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/certificates.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/certificates.go new file mode 100644 index 000000000000..aad52ad4af60 --- /dev/null +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/certificates.go @@ -0,0 +1,405 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificatesClient is the REST API for Azure Spring Cloud +type CertificatesClient struct { + BaseClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the CertificatesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +// certificateResource - parameters for the create or update operation +func (client CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource CertificateResource) (result CertificateResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateResource, + Constraints: []validation.Constraint{{Target: "certificateResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificateResource.Properties.VaultURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "certificateResource.Properties.KeyVaultCertName", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.CertificatesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, certificateName, certificateResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource CertificateResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-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.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(certificateResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +func (client CertificatesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", 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 CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +func (client CertificatesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result CertificateResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", 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 CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result CertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the certificates of one user. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client CertificatesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result CertificateResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.List") + defer func() { + sc := -1 + if result.crc.Response.Response != nil { + sc = result.crc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.crc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", resp, "Failure sending request") + return + } + + result.crc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", resp, "Failure responding to request") + } + if result.crc.hasNextLink() && result.crc.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificatesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", pathParameters), + 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 CertificatesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListResponder(resp *http.Response) (result CertificateResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CertificatesClient) listNextResults(ctx context.Context, lastResults CertificateResourceCollection) (result CertificateResourceCollection, err error) { + req, err := lastResults.certificateResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "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, "appplatform.CertificatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificatesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result CertificateResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, serviceName) + return +} diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/customdomains.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/customdomains.go new file mode 100644 index 000000000000..9ebd936e176d --- /dev/null +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/customdomains.go @@ -0,0 +1,573 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CustomDomainsClient is the REST API for Azure Spring Cloud +type CustomDomainsClient struct { + BaseClient +} + +// NewCustomDomainsClient creates an instance of the CustomDomainsClient client. +func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { + return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomDomainsClientWithBaseURI creates an instance of the CustomDomainsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { + return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +// domainResource - parameters for the create or update operation +func (client CustomDomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (result CustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, domainName, domainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CustomDomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithJSON(domainResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) CreateOrUpdateResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +func (client CustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", 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 CustomDomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +func (client CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result CustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", 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 CustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the custom domains of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client CustomDomainsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result CustomDomainResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.List") + defer func() { + sc := -1 + if result.cdrc.Response.Response != nil { + sc = result.cdrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cdrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", resp, "Failure sending request") + return + } + + result.cdrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", resp, "Failure responding to request") + } + if result.cdrc.hasNextLink() && result.cdrc.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListPreparer prepares the List request. +func (client CustomDomainsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", pathParameters), + 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 CustomDomainsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) ListResponder(resp *http.Response) (result CustomDomainResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CustomDomainsClient) listNextResults(ctx context.Context, lastResults CustomDomainResourceCollection) (result CustomDomainResourceCollection, err error) { + req, err := lastResults.customDomainResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "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, "appplatform.CustomDomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomDomainsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result CustomDomainResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, serviceName, appName) + return +} + +// Patch update custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +// domainResource - parameters for the create or update operation +func (client CustomDomainsClient) Patch(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (result CustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Patch") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchPreparer(ctx, resourceGroupName, serviceName, appName, domainName, domainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client CustomDomainsClient) PatchPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithJSON(domainResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) PatchSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) PatchResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate check the resource name is valid as well as not in use. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client CustomDomainsClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: validatePayload, + Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.CustomDomainsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, serviceName, appName, validatePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client CustomDomainsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/validate", pathParameters), + autorest.WithJSON(validatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) ValidateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) ValidateResponder(resp *http.Response) (result CustomDomainValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go index db9e2ba8c9af..76aeed30d8b4 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go @@ -21,7 +21,6 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -61,27 +60,6 @@ func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentResource, - Constraints: []validation.Constraint{{Target: "deploymentResource.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.CPU", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.CPU", Name: validation.InclusiveMaximum, Rule: int64(4), Chain: nil}, - {Target: "deploymentResource.Properties.DeploymentSettings.CPU", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "deploymentResource.Properties.DeploymentSettings.MemoryInGB", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.MemoryInGB", Name: validation.InclusiveMaximum, Rule: int64(8), Chain: nil}, - {Target: "deploymentResource.Properties.DeploymentSettings.MemoryInGB", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "deploymentResource.Properties.DeploymentSettings.InstanceCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.InstanceCount", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, - {Target: "deploymentResource.Properties.DeploymentSettings.InstanceCount", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("appplatform.DeploymentsClient", "CreateOrUpdate", err.Error()) - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) if err != nil { err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") @@ -139,7 +117,6 @@ func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -220,7 +197,6 @@ func (client DeploymentsClient) DeleteSender(req *http.Request) (*http.Response, func (client DeploymentsClient) 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 @@ -300,7 +276,6 @@ func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, er func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -381,7 +356,6 @@ func (client DeploymentsClient) GetLogFileURLSender(req *http.Request) (*http.Re func (client DeploymentsClient) GetLogFileURLResponder(resp *http.Response) (result LogFileURLResponse, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -425,6 +399,9 @@ func (client DeploymentsClient) List(ctx context.Context, resourceGroupName stri if err != nil { err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure responding to request") } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -465,7 +442,6 @@ func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, e func (client DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentResourceCollection, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -545,6 +521,9 @@ func (client DeploymentsClient) ListClusterAllDeployments(ctx context.Context, r if err != nil { err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListClusterAllDeployments", resp, "Failure responding to request") } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -584,7 +563,6 @@ func (client DeploymentsClient) ListClusterAllDeploymentsSender(req *http.Reques func (client DeploymentsClient) ListClusterAllDeploymentsResponder(resp *http.Response) (result DeploymentResourceCollection, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -702,7 +680,6 @@ func (client DeploymentsClient) RestartSender(req *http.Request) (future Deploym func (client DeploymentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp @@ -782,7 +759,6 @@ func (client DeploymentsClient) StartSender(req *http.Request) (future Deploymen func (client DeploymentsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp @@ -862,7 +838,6 @@ func (client DeploymentsClient) StopSender(req *http.Request) (future Deployment func (client DeploymentsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp @@ -945,7 +920,6 @@ func (client DeploymentsClient) UpdateSender(req *http.Request) (future Deployme func (client DeploymentsClient) UpdateResponder(resp *http.Response) (result DeploymentResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/enums.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/enums.go new file mode 100644 index 000000000000..6af67441d29a --- /dev/null +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/enums.go @@ -0,0 +1,261 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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. + +// AppResourceProvisioningState enumerates the values for app resource provisioning state. +type AppResourceProvisioningState string + +const ( + // Creating ... + Creating AppResourceProvisioningState = "Creating" + // Failed ... + Failed AppResourceProvisioningState = "Failed" + // Succeeded ... + Succeeded AppResourceProvisioningState = "Succeeded" + // Updating ... + Updating AppResourceProvisioningState = "Updating" +) + +// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. +func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { + return []AppResourceProvisioningState{Creating, Failed, Succeeded, Updating} +} + +// ConfigServerState enumerates the values for config server state. +type ConfigServerState string + +const ( + // ConfigServerStateDeleted ... + ConfigServerStateDeleted ConfigServerState = "Deleted" + // ConfigServerStateFailed ... + ConfigServerStateFailed ConfigServerState = "Failed" + // ConfigServerStateNotAvailable ... + ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" + // ConfigServerStateSucceeded ... + ConfigServerStateSucceeded ConfigServerState = "Succeeded" + // ConfigServerStateUpdating ... + ConfigServerStateUpdating ConfigServerState = "Updating" +) + +// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. +func PossibleConfigServerStateValues() []ConfigServerState { + return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} +} + +// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. +type DeploymentResourceProvisioningState string + +const ( + // DeploymentResourceProvisioningStateCreating ... + DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" + // DeploymentResourceProvisioningStateFailed ... + DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" + // DeploymentResourceProvisioningStateSucceeded ... + DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" + // DeploymentResourceProvisioningStateUpdating ... + DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" +) + +// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. +func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { + return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} +} + +// DeploymentResourceStatus enumerates the values for deployment resource status. +type DeploymentResourceStatus string + +const ( + // DeploymentResourceStatusAllocating ... + DeploymentResourceStatusAllocating DeploymentResourceStatus = "Allocating" + // DeploymentResourceStatusCompiling ... + DeploymentResourceStatusCompiling DeploymentResourceStatus = "Compiling" + // DeploymentResourceStatusFailed ... + DeploymentResourceStatusFailed DeploymentResourceStatus = "Failed" + // DeploymentResourceStatusRunning ... + DeploymentResourceStatusRunning DeploymentResourceStatus = "Running" + // DeploymentResourceStatusStopped ... + DeploymentResourceStatusStopped DeploymentResourceStatus = "Stopped" + // DeploymentResourceStatusUnknown ... + DeploymentResourceStatusUnknown DeploymentResourceStatus = "Unknown" + // DeploymentResourceStatusUpgrading ... + DeploymentResourceStatusUpgrading DeploymentResourceStatus = "Upgrading" +) + +// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. +func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { + return []DeploymentResourceStatus{DeploymentResourceStatusAllocating, DeploymentResourceStatusCompiling, DeploymentResourceStatusFailed, DeploymentResourceStatusRunning, DeploymentResourceStatusStopped, DeploymentResourceStatusUnknown, DeploymentResourceStatusUpgrading} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // None ... + None ManagedIdentityType = "None" + // SystemAssigned ... + SystemAssigned ManagedIdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoved ... + ProvisioningStateMoved ProvisioningState = "Moved" + // ProvisioningStateMoveFailed ... + ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // NotAvailableForSubscription ... + NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // QuotaID ... + QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // Location ... + Location ResourceSkuRestrictionsType = "Location" + // Zone ... + Zone ResourceSkuRestrictionsType = "Zone" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{Location, Zone} +} + +// RuntimeVersion enumerates the values for runtime version. +type RuntimeVersion string + +const ( + // Java11 ... + Java11 RuntimeVersion = "Java_11" + // Java8 ... + Java8 RuntimeVersion = "Java_8" +) + +// PossibleRuntimeVersionValues returns an array of possible values for the RuntimeVersion const type. +func PossibleRuntimeVersionValues() []RuntimeVersion { + return []RuntimeVersion{Java11, Java8} +} + +// SkuScaleType enumerates the values for sku scale type. +type SkuScaleType string + +const ( + // SkuScaleTypeAutomatic ... + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + // SkuScaleTypeManual ... + SkuScaleTypeManual SkuScaleType = "Manual" + // SkuScaleTypeNone ... + SkuScaleTypeNone SkuScaleType = "None" +) + +// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. +func PossibleSkuScaleTypeValues() []SkuScaleType { + return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} +} + +// TestKeyType enumerates the values for test key type. +type TestKeyType string + +const ( + // Primary ... + Primary TestKeyType = "Primary" + // Secondary ... + Secondary TestKeyType = "Secondary" +) + +// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. +func PossibleTestKeyTypeValues() []TestKeyType { + return []TestKeyType{Primary, Secondary} +} + +// TraceProxyState enumerates the values for trace proxy state. +type TraceProxyState string + +const ( + // TraceProxyStateFailed ... + TraceProxyStateFailed TraceProxyState = "Failed" + // TraceProxyStateNotAvailable ... + TraceProxyStateNotAvailable TraceProxyState = "NotAvailable" + // TraceProxyStateSucceeded ... + TraceProxyStateSucceeded TraceProxyState = "Succeeded" + // TraceProxyStateUpdating ... + TraceProxyStateUpdating TraceProxyState = "Updating" +) + +// PossibleTraceProxyStateValues returns an array of possible values for the TraceProxyState const type. +func PossibleTraceProxyStateValues() []TraceProxyState { + return []TraceProxyState{TraceProxyStateFailed, TraceProxyStateNotAvailable, TraceProxyStateSucceeded, TraceProxyStateUpdating} +} + +// UserSourceType enumerates the values for user source type. +type UserSourceType string + +const ( + // Jar ... + Jar UserSourceType = "Jar" + // Source ... + Source UserSourceType = "Source" +) + +// PossibleUserSourceTypeValues returns an array of possible values for the UserSourceType const type. +func PossibleUserSourceTypeValues() []UserSourceType { + return []UserSourceType{Jar, Source} +} diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go index cf8d8d68fd8a..691a503f6c8e 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go @@ -31,188 +31,15 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" -// AppResourceProvisioningState enumerates the values for app resource provisioning state. -type AppResourceProvisioningState string - -const ( - // Creating ... - Creating AppResourceProvisioningState = "Creating" - // Failed ... - Failed AppResourceProvisioningState = "Failed" - // Succeeded ... - Succeeded AppResourceProvisioningState = "Succeeded" - // Updating ... - Updating AppResourceProvisioningState = "Updating" -) - -// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. -func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { - return []AppResourceProvisioningState{Creating, Failed, Succeeded, Updating} -} - -// ConfigServerState enumerates the values for config server state. -type ConfigServerState string - -const ( - // ConfigServerStateDeleted ... - ConfigServerStateDeleted ConfigServerState = "Deleted" - // ConfigServerStateFailed ... - ConfigServerStateFailed ConfigServerState = "Failed" - // ConfigServerStateNotAvailable ... - ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" - // ConfigServerStateSucceeded ... - ConfigServerStateSucceeded ConfigServerState = "Succeeded" - // ConfigServerStateUpdating ... - ConfigServerStateUpdating ConfigServerState = "Updating" -) - -// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. -func PossibleConfigServerStateValues() []ConfigServerState { - return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} -} - -// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. -type DeploymentResourceProvisioningState string - -const ( - // DeploymentResourceProvisioningStateCreating ... - DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" - // DeploymentResourceProvisioningStateFailed ... - DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" - // DeploymentResourceProvisioningStateSucceeded ... - DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" - // DeploymentResourceProvisioningStateUpdating ... - DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" -) - -// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. -func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { - return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} -} - -// DeploymentResourceStatus enumerates the values for deployment resource status. -type DeploymentResourceStatus string - -const ( - // DeploymentResourceStatusAllocating ... - DeploymentResourceStatusAllocating DeploymentResourceStatus = "Allocating" - // DeploymentResourceStatusCompiling ... - DeploymentResourceStatusCompiling DeploymentResourceStatus = "Compiling" - // DeploymentResourceStatusFailed ... - DeploymentResourceStatusFailed DeploymentResourceStatus = "Failed" - // DeploymentResourceStatusRunning ... - DeploymentResourceStatusRunning DeploymentResourceStatus = "Running" - // DeploymentResourceStatusStopped ... - DeploymentResourceStatusStopped DeploymentResourceStatus = "Stopped" - // DeploymentResourceStatusUnknown ... - DeploymentResourceStatusUnknown DeploymentResourceStatus = "Unknown" - // DeploymentResourceStatusUpgrading ... - DeploymentResourceStatusUpgrading DeploymentResourceStatus = "Upgrading" -) - -// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. -func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { - return []DeploymentResourceStatus{DeploymentResourceStatusAllocating, DeploymentResourceStatusCompiling, DeploymentResourceStatusFailed, DeploymentResourceStatusRunning, DeploymentResourceStatusStopped, DeploymentResourceStatusUnknown, DeploymentResourceStatusUpgrading} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleted ... - ProvisioningStateDeleted ProvisioningState = "Deleted" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateMoved ... - ProvisioningStateMoved ProvisioningState = "Moved" - // ProvisioningStateMoveFailed ... - ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" - // ProvisioningStateMoving ... - ProvisioningStateMoving ProvisioningState = "Moving" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// RuntimeVersion enumerates the values for runtime version. -type RuntimeVersion string - -const ( - // Java11 ... - Java11 RuntimeVersion = "Java_11" - // Java8 ... - Java8 RuntimeVersion = "Java_8" -) - -// PossibleRuntimeVersionValues returns an array of possible values for the RuntimeVersion const type. -func PossibleRuntimeVersionValues() []RuntimeVersion { - return []RuntimeVersion{Java11, Java8} -} - -// TestKeyType enumerates the values for test key type. -type TestKeyType string - -const ( - // Primary ... - Primary TestKeyType = "Primary" - // Secondary ... - Secondary TestKeyType = "Secondary" -) - -// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. -func PossibleTestKeyTypeValues() []TestKeyType { - return []TestKeyType{Primary, Secondary} -} - -// TraceProxyState enumerates the values for trace proxy state. -type TraceProxyState string - -const ( - // TraceProxyStateFailed ... - TraceProxyStateFailed TraceProxyState = "Failed" - // TraceProxyStateNotAvailable ... - TraceProxyStateNotAvailable TraceProxyState = "NotAvailable" - // TraceProxyStateSucceeded ... - TraceProxyStateSucceeded TraceProxyState = "Succeeded" - // TraceProxyStateUpdating ... - TraceProxyStateUpdating TraceProxyState = "Updating" -) - -// PossibleTraceProxyStateValues returns an array of possible values for the TraceProxyState const type. -func PossibleTraceProxyStateValues() []TraceProxyState { - return []TraceProxyState{TraceProxyStateFailed, TraceProxyStateNotAvailable, TraceProxyStateSucceeded, TraceProxyStateUpdating} -} - -// UserSourceType enumerates the values for user source type. -type UserSourceType string - -const ( - // Jar ... - Jar UserSourceType = "Jar" - // Source ... - Source UserSourceType = "Source" -) - -// PossibleUserSourceTypeValues returns an array of possible values for the UserSourceType const type. -func PossibleUserSourceTypeValues() []UserSourceType { - return []UserSourceType{Jar, Source} -} - // AppResource app resource payload type AppResource struct { autorest.Response `json:"-"` // Properties - Properties of the App resource Properties *AppResourceProperties `json:"properties,omitempty"` + // Identity - The Managed Identity type of the app resource + Identity *ManagedIdentityProperties `json:"identity,omitempty"` + // Location - The GEO location of the application, always the same with its parent resource + Location *string `json:"location,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource. @@ -221,6 +48,21 @@ type AppResource struct { Type *string `json:"type,omitempty"` } +// MarshalJSON is the custom marshaler for AppResource. +func (ar AppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Properties != nil { + objectMap["properties"] = ar.Properties + } + if ar.Identity != nil { + objectMap["identity"] = ar.Identity + } + if ar.Location != nil { + objectMap["location"] = ar.Location + } + return json.Marshal(objectMap) +} + // AppResourceCollection object that includes an array of App resources and a possible link for next set type AppResourceCollection struct { autorest.Response `json:"-"` @@ -299,10 +141,15 @@ func (arc AppResourceCollection) IsEmpty() bool { return arc.Value == nil || len(*arc.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (arc AppResourceCollection) hasNextLink() bool { + return arc.NextLink != nil && len(*arc.NextLink) != 0 +} + // appResourceCollectionPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (arc AppResourceCollection) appResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if arc.NextLink == nil || len(to.String(arc.NextLink)) < 1 { + if !arc.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -330,11 +177,16 @@ func (page *AppResourceCollectionPage) NextWithContext(ctx context.Context) (err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.arc) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.arc) + if err != nil { + return err + } + page.arc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.arc = next return nil } @@ -378,6 +230,10 @@ type AppResourceProperties struct { ProvisioningState AppResourceProvisioningState `json:"provisioningState,omitempty"` // ActiveDeploymentName - Name of the active deployment of the App ActiveDeploymentName *string `json:"activeDeploymentName,omitempty"` + // Fqdn - Fully qualified dns Name. + Fqdn *string `json:"fqdn,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` // CreatedTime - READ-ONLY; Date time when the resource is created CreatedTime *date.Time `json:"createdTime,omitempty"` // TemporaryDisk - Temporary disk settings @@ -386,6 +242,30 @@ type AppResourceProperties struct { PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` } +// MarshalJSON is the custom marshaler for AppResourceProperties. +func (arp AppResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arp.Public != nil { + objectMap["public"] = arp.Public + } + if arp.ActiveDeploymentName != nil { + objectMap["activeDeploymentName"] = arp.ActiveDeploymentName + } + if arp.Fqdn != nil { + objectMap["fqdn"] = arp.Fqdn + } + if arp.HTTPSOnly != nil { + objectMap["httpsOnly"] = arp.HTTPSOnly + } + if arp.TemporaryDisk != nil { + objectMap["temporaryDisk"] = arp.TemporaryDisk + } + if arp.PersistentDisk != nil { + objectMap["persistentDisk"] = arp.PersistentDisk + } + return json.Marshal(objectMap) +} + // AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type AppsCreateOrUpdateFuture struct { @@ -521,10 +401,15 @@ func (ao AvailableOperations) IsEmpty() bool { return ao.Value == nil || len(*ao.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (ao AvailableOperations) hasNextLink() bool { + return ao.NextLink != nil && len(*ao.NextLink) != 0 +} + // availableOperationsPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (ao AvailableOperations) availableOperationsPreparer(ctx context.Context) (*http.Request, error) { - if ao.NextLink == nil || len(to.String(ao.NextLink)) < 1 { + if !ao.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -552,11 +437,16 @@ func (page *AvailableOperationsPage) NextWithContext(ctx context.Context) (err e tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.ao) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.ao) + if err != nil { + return err + } + page.ao = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.ao = next return nil } @@ -603,8 +493,17 @@ type BindingResource struct { Type *string `json:"type,omitempty"` } -// BindingResourceCollection object that includes an array of Binding resources and a possible link for -// next set +// MarshalJSON is the custom marshaler for BindingResource. +func (br BindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + return json.Marshal(objectMap) +} + +// BindingResourceCollection object that includes an array of Binding resources and a possible link for next +// set type BindingResourceCollection struct { autorest.Response `json:"-"` // Value - Collection of Binding resources @@ -682,10 +581,15 @@ func (brc BindingResourceCollection) IsEmpty() bool { return brc.Value == nil || len(*brc.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (brc BindingResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + // bindingResourceCollectionPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (brc BindingResourceCollection) bindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if brc.NextLink == nil || len(to.String(brc.NextLink)) < 1 { + if !brc.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -713,11 +617,16 @@ func (page *BindingResourceCollectionPage) NextWithContext(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.brc) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.brc) + if err != nil { + return err + } + page.brc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.brc = next return nil } @@ -753,9 +662,9 @@ func NewBindingResourceCollectionPage(getNextPage func(context.Context, BindingR // BindingResourceProperties binding resource properties payload type BindingResourceProperties struct { - // ResourceName - The name of the bound resource + // ResourceName - READ-ONLY; The name of the bound resource ResourceName *string `json:"resourceName,omitempty"` - // ResourceType - The standard Azure resource type of the bound resource + // ResourceType - READ-ONLY; The standard Azure resource type of the bound resource ResourceType *string `json:"resourceType,omitempty"` // ResourceID - The Azure resource id of the bound resource ResourceID *string `json:"resourceId,omitempty"` @@ -774,93 +683,550 @@ type BindingResourceProperties struct { // MarshalJSON is the custom marshaler for BindingResourceProperties. func (brp BindingResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if brp.ResourceName != nil { - objectMap["resourceName"] = brp.ResourceName - } - if brp.ResourceType != nil { - objectMap["resourceType"] = brp.ResourceType - } if brp.ResourceID != nil { objectMap["resourceId"] = brp.ResourceID } if brp.Key != nil { objectMap["key"] = brp.Key } - if brp.BindingParameters != nil { - objectMap["bindingParameters"] = brp.BindingParameters + if brp.BindingParameters != nil { + objectMap["bindingParameters"] = brp.BindingParameters + } + return json.Marshal(objectMap) +} + +// CertificateProperties certificate resource payload. +type CertificateProperties struct { + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // VaultURI - The vault uri of user key vault. + VaultURI *string `json:"vaultUri,omitempty"` + // KeyVaultCertName - The certificate name of key vault. + KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` + // CertVersion - The certificate version of key vault. + CertVersion *string `json:"certVersion,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.VaultURI != nil { + objectMap["vaultUri"] = cp.VaultURI + } + if cp.KeyVaultCertName != nil { + objectMap["keyVaultCertName"] = cp.KeyVaultCertName + } + if cp.CertVersion != nil { + objectMap["certVersion"] = cp.CertVersion + } + return json.Marshal(objectMap) +} + +// CertificateResource certificate resource payload. +type CertificateResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the certificate resource payload. + Properties *CertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateResource. +func (cr CertificateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cr.Properties != nil { + objectMap["properties"] = cr.Properties + } + return json.Marshal(objectMap) +} + +// CertificateResourceCollection collection compose of certificate resources list and a possible link for next +// page. +type CertificateResourceCollection struct { + autorest.Response `json:"-"` + // Value - The certificate resources list. + Value *[]CertificateResource `json:"value,omitempty"` + // NextLink - The link to next page of certificate list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateResourceCollectionIterator provides access to a complete listing of CertificateResource values. +type CertificateResourceCollectionIterator struct { + i int + page CertificateResourceCollectionPage +} + +// NextWithContext 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 *CertificateResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CertificateResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateResourceCollectionIterator) 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 CertificateResourceCollectionIterator) Response() CertificateResourceCollection { + 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 CertificateResourceCollectionIterator) Value() CertificateResource { + if !iter.page.NotDone() { + return CertificateResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CertificateResourceCollectionIterator type. +func NewCertificateResourceCollectionIterator(page CertificateResourceCollectionPage) CertificateResourceCollectionIterator { + return CertificateResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crc CertificateResourceCollection) IsEmpty() bool { + return crc.Value == nil || len(*crc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crc CertificateResourceCollection) hasNextLink() bool { + return crc.NextLink != nil && len(*crc.NextLink) != 0 +} + +// certificateResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crc CertificateResourceCollection) certificateResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !crc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crc.NextLink))) +} + +// CertificateResourceCollectionPage contains a page of CertificateResource values. +type CertificateResourceCollectionPage struct { + fn func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error) + crc CertificateResourceCollection +} + +// NextWithContext 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 *CertificateResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.crc) + if err != nil { + return err + } + page.crc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *CertificateResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateResourceCollectionPage) NotDone() bool { + return !page.crc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateResourceCollectionPage) Response() CertificateResourceCollection { + return page.crc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateResourceCollectionPage) Values() []CertificateResource { + if page.crc.IsEmpty() { + return nil + } + return *page.crc.Value +} + +// Creates a new instance of the CertificateResourceCollectionPage type. +func NewCertificateResourceCollectionPage(getNextPage func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error)) CertificateResourceCollectionPage { + return CertificateResourceCollectionPage{fn: getNextPage} +} + +// CloudError an error response from the service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ClusterResourceProperties service properties payload +type ClusterResourceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ConfigServerProperties - Config server git properties of the Service + ConfigServerProperties *ConfigServerProperties `json:"configServerProperties,omitempty"` + // Trace - Trace properties of the Service + Trace *TraceProperties `json:"trace,omitempty"` + // NetworkProfile - Network profile of the Service + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // Version - READ-ONLY; Version of the Service + Version *int32 `json:"version,omitempty"` + // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource + ServiceID *string `json:"serviceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterResourceProperties. +func (crp ClusterResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crp.ConfigServerProperties != nil { + objectMap["configServerProperties"] = crp.ConfigServerProperties + } + if crp.Trace != nil { + objectMap["trace"] = crp.Trace + } + if crp.NetworkProfile != nil { + objectMap["networkProfile"] = crp.NetworkProfile + } + return json.Marshal(objectMap) +} + +// ConfigServerGitProperty property of git. +type ConfigServerGitProperty struct { + // Repositories - Repositories of git. + Repositories *[]GitPatternRepository `json:"repositories,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigServerProperties config server git properties payload +type ConfigServerProperties struct { + // State - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' + State ConfigServerState `json:"state,omitempty"` + // Error - Error when apply config server settings. + Error *Error `json:"error,omitempty"` + // ConfigServer - Settings of config server. + ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerProperties. +func (csp ConfigServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.Error != nil { + objectMap["error"] = csp.Error + } + if csp.ConfigServer != nil { + objectMap["configServer"] = csp.ConfigServer + } + return json.Marshal(objectMap) +} + +// ConfigServerSettings the settings of config server. +type ConfigServerSettings struct { + // GitProperty - Property of git environment. + GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +} + +// CustomDomainProperties custom domain of app resource payload. +type CustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // AppName - READ-ONLY; The app name of domain. + AppName *string `json:"appName,omitempty"` + // CertName - The bound certificate name of domain. + CertName *string `json:"certName,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainProperties. +func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.Thumbprint != nil { + objectMap["thumbprint"] = cdp.Thumbprint + } + if cdp.CertName != nil { + objectMap["certName"] = cdp.CertName + } + return json.Marshal(objectMap) +} + +// CustomDomainResource custom domain resource payload. +type CustomDomainResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the custom domain resource. + Properties *CustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainResource. +func (cdr CustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdr.Properties != nil { + objectMap["properties"] = cdr.Properties + } + return json.Marshal(objectMap) +} + +// CustomDomainResourceCollection collection compose of a custom domain resources list and a possible link for +// next page. +type CustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - The custom domain resources list. + Value *[]CustomDomainResource `json:"value,omitempty"` + // NextLink - The link to next page of custom domain list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomDomainResourceCollectionIterator provides access to a complete listing of CustomDomainResource values. +type CustomDomainResourceCollectionIterator struct { + i int + page CustomDomainResourceCollectionPage +} + +// NextWithContext 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 *CustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomDomainResourceCollectionIterator) 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 CustomDomainResourceCollectionIterator) Response() CustomDomainResourceCollection { + 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 CustomDomainResourceCollectionIterator) Value() CustomDomainResource { + if !iter.page.NotDone() { + return CustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomDomainResourceCollectionIterator type. +func NewCustomDomainResourceCollectionIterator(page CustomDomainResourceCollectionPage) CustomDomainResourceCollectionIterator { + return CustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cdrc CustomDomainResourceCollection) IsEmpty() bool { + return cdrc.Value == nil || len(*cdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cdrc CustomDomainResourceCollection) hasNextLink() bool { + return cdrc.NextLink != nil && len(*cdrc.NextLink) != 0 +} + +// customDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cdrc CustomDomainResourceCollection) customDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cdrc.NextLink))) +} + +// CustomDomainResourceCollectionPage contains a page of CustomDomainResource values. +type CustomDomainResourceCollectionPage struct { + fn func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error) + cdrc CustomDomainResourceCollection +} + +// NextWithContext 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 *CustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cdrc) + if err != nil { + return err + } + page.cdrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - return json.Marshal(objectMap) + return nil } -// CloudError an error response from the service. -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *CustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) } -// CloudErrorBody an error response from the service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomDomainResourceCollectionPage) NotDone() bool { + return !page.cdrc.IsEmpty() } -// ClusterResourceProperties service properties payload -type ClusterResourceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ConfigServerProperties - Config server git properties of the Service - ConfigServerProperties *ConfigServerProperties `json:"configServerProperties,omitempty"` - // Trace - Trace properties of the Service - Trace *TraceProperties `json:"trace,omitempty"` - // Version - READ-ONLY; Version of the Service - Version *int32 `json:"version,omitempty"` - // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource - ServiceID *string `json:"serviceId,omitempty"` +// Response returns the raw server response from the last page request. +func (page CustomDomainResourceCollectionPage) Response() CustomDomainResourceCollection { + return page.cdrc } -// ConfigServerGitProperty property of git. -type ConfigServerGitProperty struct { - // Repositories - Repositories of git. - Repositories *[]GitPatternRepository `json:"repositories,omitempty"` - // URI - URI of the repository - URI *string `json:"uri,omitempty"` - // Label - Label of the repository - Label *string `json:"label,omitempty"` - // SearchPaths - Searching path of the repository - SearchPaths *[]string `json:"searchPaths,omitempty"` - // Username - Username of git repository basic auth. - Username *string `json:"username,omitempty"` - // Password - Password of git repository basic auth. - Password *string `json:"password,omitempty"` - // HostKey - Public sshKey of git repository. - HostKey *string `json:"hostKey,omitempty"` - // HostKeyAlgorithm - SshKey algorithm of git repository. - HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` - // PrivateKey - Private sshKey algorithm of git repository. - PrivateKey *string `json:"privateKey,omitempty"` - // StrictHostKeyChecking - Strict host key checking or not. - StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomDomainResourceCollectionPage) Values() []CustomDomainResource { + if page.cdrc.IsEmpty() { + return nil + } + return *page.cdrc.Value } -// ConfigServerProperties config server git properties payload -type ConfigServerProperties struct { - // State - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' - State ConfigServerState `json:"state,omitempty"` - // Error - Error when apply config server settings. - Error *Error `json:"error,omitempty"` - // ConfigServer - Settings of config server. - ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` +// Creates a new instance of the CustomDomainResourceCollectionPage type. +func NewCustomDomainResourceCollectionPage(getNextPage func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error)) CustomDomainResourceCollectionPage { + return CustomDomainResourceCollectionPage{fn: getNextPage} } -// ConfigServerSettings the settings of config server. -type ConfigServerSettings struct { - // GitProperty - Property of git environment. - GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +// CustomDomainValidatePayload custom domain validate payload. +type CustomDomainValidatePayload struct { + // Name - Name to be validated + Name *string `json:"name,omitempty"` +} + +// CustomDomainValidateResult validation result for custom domain. +type CustomDomainValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicates if domain name is valid. + IsValid *bool `json:"isValid,omitempty"` + // Message - Message of why domain name is invalid. + Message *string `json:"message,omitempty"` } // DeploymentInstance deployment instance payload @@ -888,8 +1254,16 @@ type DeploymentResource struct { Type *string `json:"type,omitempty"` } -// DeploymentResourceCollection object that includes an array of App resources and a possible link for next -// set +// MarshalJSON is the custom marshaler for DeploymentResource. +func (dr DeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dr.Properties != nil { + objectMap["properties"] = dr.Properties + } + return json.Marshal(objectMap) +} + +// DeploymentResourceCollection object that includes an array of App resources and a possible link for next set type DeploymentResourceCollection struct { autorest.Response `json:"-"` // Value - Collection of Deployment resources @@ -967,10 +1341,15 @@ func (drc DeploymentResourceCollection) IsEmpty() bool { return drc.Value == nil || len(*drc.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (drc DeploymentResourceCollection) hasNextLink() bool { + return drc.NextLink != nil && len(*drc.NextLink) != 0 +} + // deploymentResourceCollectionPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (drc DeploymentResourceCollection) deploymentResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if drc.NextLink == nil || len(to.String(drc.NextLink)) < 1 { + if !drc.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -998,11 +1377,16 @@ func (page *DeploymentResourceCollectionPage) NextWithContext(ctx context.Contex tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.drc) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.drc) + if err != nil { + return err + } + page.drc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.drc = next return nil } @@ -1042,10 +1426,10 @@ type DeploymentResourceProperties struct { Source *UserSourceInfo `json:"source,omitempty"` // AppName - READ-ONLY; App name of the deployment AppName *string `json:"appName,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' - ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` // DeploymentSettings - Deployment settings of the Deployment DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' + ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` // Status - READ-ONLY; Status of the Deployment. Possible values include: 'DeploymentResourceStatusUnknown', 'DeploymentResourceStatusStopped', 'DeploymentResourceStatusRunning', 'DeploymentResourceStatusFailed', 'DeploymentResourceStatusAllocating', 'DeploymentResourceStatusUpgrading', 'DeploymentResourceStatusCompiling' Status DeploymentResourceStatus `json:"status,omitempty"` // Active - READ-ONLY; Indicates whether the Deployment is active @@ -1056,8 +1440,20 @@ type DeploymentResourceProperties struct { Instances *[]DeploymentInstance `json:"instances,omitempty"` } -// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// MarshalJSON is the custom marshaler for DeploymentResourceProperties. +func (drp DeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if drp.Source != nil { + objectMap["source"] = drp.Source + } + if drp.DeploymentSettings != nil { + objectMap["deploymentSettings"] = drp.DeploymentSettings + } + return json.Marshal(objectMap) +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. type DeploymentsCreateOrUpdateFuture struct { azure.Future } @@ -1087,13 +1483,13 @@ func (future *DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) // DeploymentSettings deployment settings payload type DeploymentSettings struct { - // CPU - Required CPU + // CPU - Required CPU, basic tier should be 1, standard tier should be in range (1, 4) CPU *int32 `json:"cpu,omitempty"` - // MemoryInGB - Required Memory size in GB + // MemoryInGB - Required Memory size in GB, basic tier should be in range (1, 2), standard tier should be in range (1, 8) MemoryInGB *int32 `json:"memoryInGB,omitempty"` // JvmOptions - JVM parameter JvmOptions *string `json:"jvmOptions,omitempty"` - // InstanceCount - Instance count + // InstanceCount - Instance count, basic tier should be in range (1, 25), standard tier should be in range (1, 500) InstanceCount *int32 `json:"instanceCount,omitempty"` // EnvironmentVariables - Collection of environment variables EnvironmentVariables map[string]*string `json:"environmentVariables"` @@ -1148,8 +1544,7 @@ func (future *DeploymentsRestartFuture) Result(client DeploymentsClient) (ar aut return } -// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeploymentsStartFuture struct { azure.Future } @@ -1171,8 +1566,7 @@ func (future *DeploymentsStartFuture) Result(client DeploymentsClient) (ar autor return } -// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeploymentsStopFuture struct { azure.Future } @@ -1274,6 +1668,14 @@ type LogSpecification struct { BlobDuration *string `json:"blobDuration,omitempty"` } +// ManagedIdentityProperties managed identity properties retrieved from ARM request headers. +type ManagedIdentityProperties struct { + // Type - Possible values include: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + // MetricDimension specifications of the Dimension of metrics type MetricDimension struct { // Name - Name of the dimension @@ -1325,12 +1727,26 @@ type NameAvailabilityParameters struct { Name *string `json:"name,omitempty"` } +// NetworkProfile service network profile payload +type NetworkProfile struct { + // ServiceRuntimeSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Cloud Service Runtime + ServiceRuntimeSubnetID *string `json:"serviceRuntimeSubnetId,omitempty"` + // AppSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps + AppSubnetID *string `json:"appSubnetId,omitempty"` + // ServiceCidr - Azure Spring Cloud service reserved CIDR + ServiceCidr *string `json:"serviceCidr,omitempty"` + // ServiceRuntimeNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Cloud Service Runtime + ServiceRuntimeNetworkResourceGroup *string `json:"serviceRuntimeNetworkResourceGroup,omitempty"` + // AppNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Cloud Apps + AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` +} + // OperationDetail operation detail payload type OperationDetail struct { // Name - Name of the operation Name *string `json:"name,omitempty"` - // DataAction - Indicates whether the operation is a data action - DataAction *bool `json:"dataAction,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` // Display - Display of the operation Display *OperationDisplay `json:"display,omitempty"` // Origin - Origin of the operation @@ -1367,6 +1783,18 @@ type PersistentDisk struct { MountPath *string `json:"mountPath,omitempty"` } +// MarshalJSON is the custom marshaler for PersistentDisk. +func (pd PersistentDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.SizeInGB != nil { + objectMap["sizeInGB"] = pd.SizeInGB + } + if pd.MountPath != nil { + objectMap["mountPath"] = pd.MountPath + } + return json.Marshal(objectMap) +} + // ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than // required location and tags. type ProxyResource struct { @@ -1394,6 +1822,231 @@ type Resource struct { Type *string `json:"type,omitempty"` } +// ResourceSku describes an available Azure Spring Cloud SKU. +type ResourceSku struct { + // ResourceType - Gets the type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - Gets the name of SKU. + Name *string `json:"name,omitempty"` + // Tier - Gets the tier of SKU. + Tier *string `json:"tier,omitempty"` + // Capacity - Gets the capacity of SKU. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // Locations - Gets the set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - Gets a list of locations and availability zones in those locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // Restrictions - Gets the restrictions because of which SKU cannot be used. This is + // empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuCapabilities ... +type ResourceSkuCapabilities struct { + // Name - Gets an invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - Gets an invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuCollection ... +type ResourceSkuCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resource SKU + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkuCollectionIterator provides access to a complete listing of ResourceSku values. +type ResourceSkuCollectionIterator struct { + i int + page ResourceSkuCollectionPage +} + +// NextWithContext 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 *ResourceSkuCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceSkuCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkuCollectionIterator) 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 ResourceSkuCollectionIterator) Response() ResourceSkuCollection { + 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 ResourceSkuCollectionIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkuCollectionIterator type. +func NewResourceSkuCollectionIterator(page ResourceSkuCollectionPage) ResourceSkuCollectionIterator { + return ResourceSkuCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsc ResourceSkuCollection) IsEmpty() bool { + return rsc.Value == nil || len(*rsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rsc ResourceSkuCollection) hasNextLink() bool { + return rsc.NextLink != nil && len(*rsc.NextLink) != 0 +} + +// resourceSkuCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsc ResourceSkuCollection) resourceSkuCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsc.NextLink))) +} + +// ResourceSkuCollectionPage contains a page of ResourceSku values. +type ResourceSkuCollectionPage struct { + fn func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error) + rsc ResourceSkuCollection +} + +// NextWithContext 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 *ResourceSkuCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rsc) + if err != nil { + return err + } + page.rsc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceSkuCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkuCollectionPage) NotDone() bool { + return !page.rsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkuCollectionPage) Response() ResourceSkuCollection { + return page.rsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkuCollectionPage) Values() []ResourceSku { + if page.rsc.IsEmpty() { + return nil + } + return *page.rsc.Value +} + +// Creates a new instance of the ResourceSkuCollectionPage type. +func NewResourceSkuCollectionPage(getNextPage func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error)) ResourceSkuCollectionPage { + return ResourceSkuCollectionPage{fn: getNextPage} +} + +// ResourceSkuLocationInfo ... +type ResourceSkuLocationInfo struct { + // Location - Gets location of the SKU + Location *string `json:"location,omitempty"` + // Zones - Gets list of availability zones where the SKU is supported. + Zones *[]string `json:"zones,omitempty"` + // ZoneDetails - Gets details of capabilities available to a SKU in specific zones. + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` +} + +// ResourceSkuRestrictionInfo ... +type ResourceSkuRestrictionInfo struct { + // Locations - Gets locations where the SKU is restricted + Locations *[]string `json:"locations,omitempty"` + // Zones - Gets list of availability zones where the SKU is restricted. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkuRestrictions ... +type ResourceSkuRestrictions struct { + // Type - Gets the type of restrictions. Possible values include: 'Location', 'Zone' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - Gets the value of restrictions. If the restriction type is set to + // location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // RestrictionInfo - Gets the information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + // ReasonCode - Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: 'QuotaID', 'NotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` +} + +// ResourceSkuZoneDetails ... +type ResourceSkuZoneDetails struct { + // Name - Gets the set of zones that the SKU is available in with the + // specified capabilities. + Name *[]string `json:"name,omitempty"` + // Capabilities - Gets a list of capabilities that are available for the SKU in the + // specified list of zones. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` +} + // ResourceUploadDefinition resource upload definition payload type ResourceUploadDefinition struct { autorest.Response `json:"-"` @@ -1408,6 +2061,8 @@ type ServiceResource struct { autorest.Response `json:"-"` // Properties - Properties of the Service resource Properties *ClusterResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Service resource + Sku *Sku `json:"sku,omitempty"` // Location - The GEO location of the resource. Location *string `json:"location,omitempty"` // Tags - Tags of the service which is a list of key value pairs that describe the resource. @@ -1426,6 +2081,9 @@ func (sr ServiceResource) MarshalJSON() ([]byte, error) { if sr.Properties != nil { objectMap["properties"] = sr.Properties } + if sr.Sku != nil { + objectMap["sku"] = sr.Sku + } if sr.Location != nil { objectMap["location"] = sr.Location } @@ -1513,10 +2171,15 @@ func (srl ServiceResourceList) IsEmpty() bool { return srl.Value == nil || len(*srl.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (srl ServiceResourceList) hasNextLink() bool { + return srl.NextLink != nil && len(*srl.NextLink) != 0 +} + // serviceResourceListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { - if srl.NextLink == nil || len(to.String(srl.NextLink)) < 1 { + if !srl.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1544,11 +2207,16 @@ func (page *ServiceResourceListPage) NextWithContext(ctx context.Context) (err e tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.srl) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.srl) + if err != nil { + return err + } + page.srl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.srl = next return nil } @@ -1611,8 +2279,7 @@ func (future *ServicesCreateOrUpdateFuture) Result(client ServicesClient) (sr Se return } -// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServicesDeleteFuture struct { azure.Future } @@ -1642,8 +2309,7 @@ type ServiceSpecification struct { MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` } -// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServicesUpdateFuture struct { azure.Future } @@ -1671,6 +2337,28 @@ func (future *ServicesUpdateFuture) Result(client ServicesClient) (sr ServiceRes return } +// Sku sku of Azure Spring Cloud +type Sku struct { + // Name - Name of the Sku + Name *string `json:"name,omitempty"` + // Tier - Tier of the Sku + Tier *string `json:"tier,omitempty"` + // Capacity - Current capacity of the target resource + Capacity *int32 `json:"capacity,omitempty"` +} + +// SkuCapacity the SKU capacity +type SkuCapacity struct { + // Minimum - Gets or sets the minimum. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Gets or sets the maximum. + Maximum *int32 `json:"maximum,omitempty"` + // Default - Gets or sets the default. + Default *int32 `json:"default,omitempty"` + // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeNone', 'SkuScaleTypeManual', 'SkuScaleTypeAutomatic' + ScaleType SkuScaleType `json:"scaleType,omitempty"` +} + // TemporaryDisk temporary disk payload type TemporaryDisk struct { // SizeInGB - Size of the temporary disk in GB @@ -1706,6 +2394,21 @@ type TraceProperties struct { AppInsightInstrumentationKey *string `json:"appInsightInstrumentationKey,omitempty"` } +// MarshalJSON is the custom marshaler for TraceProperties. +func (tp TraceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.Error != nil { + objectMap["error"] = tp.Error + } + if tp.Enabled != nil { + objectMap["enabled"] = tp.Enabled + } + if tp.AppInsightInstrumentationKey != nil { + objectMap["appInsightInstrumentationKey"] = tp.AppInsightInstrumentationKey + } + return json.Marshal(objectMap) +} + // TrackedResource the resource model definition for a ARM tracked top level resource. type TrackedResource struct { // Location - The GEO location of the resource. diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go index 4d5997f30742..4367fb7eab98 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go @@ -71,6 +71,9 @@ func (client OperationsClient) List(ctx context.Context) (result AvailableOperat if err != nil { err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure responding to request") } + if result.ao.hasNextLink() && result.ao.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -101,7 +104,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableOperations, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go index 794a9214a28b..3056c4d9c5ea 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go @@ -118,7 +118,6 @@ func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*ht func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -211,7 +210,6 @@ func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (future Ser func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -288,7 +286,6 @@ func (client ServicesClient) DeleteSender(req *http.Request) (future ServicesDel func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), autorest.ByClosing()) result.Response = resp @@ -364,7 +361,6 @@ func (client ServicesClient) DisableTestEndpointSender(req *http.Request) (*http func (client ServicesClient) DisableTestEndpointResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp @@ -440,7 +436,6 @@ func (client ServicesClient) EnableTestEndpointSender(req *http.Request) (*http. func (client ServicesClient) EnableTestEndpointResponder(resp *http.Response) (result TestKeys, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -517,7 +512,6 @@ func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -558,6 +552,9 @@ func (client ServicesClient) List(ctx context.Context, resourceGroupName string) if err != nil { err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure responding to request") } + if result.srl.hasNextLink() && result.srl.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -593,7 +590,6 @@ func (client ServicesClient) ListSender(req *http.Request) (*http.Response, erro func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -668,6 +664,9 @@ func (client ServicesClient) ListBySubscription(ctx context.Context) (result Ser if err != nil { err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure responding to request") } + if result.srl.hasNextLink() && result.srl.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -702,7 +701,6 @@ func (client ServicesClient) ListBySubscriptionSender(req *http.Request) (*http. func (client ServicesClient) ListBySubscriptionResponder(resp *http.Response) (result ServiceResourceList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -816,7 +814,6 @@ func (client ServicesClient) ListTestKeysSender(req *http.Request) (*http.Respon func (client ServicesClient) ListTestKeysResponder(resp *http.Response) (result TestKeys, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -896,7 +893,6 @@ func (client ServicesClient) RegenerateTestKeySender(req *http.Request) (*http.R func (client ServicesClient) RegenerateTestKeyResponder(resp *http.Response) (result TestKeys, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -976,7 +972,6 @@ func (client ServicesClient) UpdateSender(req *http.Request) (future ServicesUpd func (client ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/sku.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/sku.go new file mode 100644 index 000000000000..20940b56fa02 --- /dev/null +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/sku.go @@ -0,0 +1,153 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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/tracing" + "net/http" +) + +// SkuClient is the REST API for Azure Spring Cloud +type SkuClient struct { + BaseClient +} + +// NewSkuClient creates an instance of the SkuClient client. +func NewSkuClient(subscriptionID string) SkuClient { + return NewSkuClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSkuClientWithBaseURI creates an instance of the SkuClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSkuClientWithBaseURI(baseURI string, subscriptionID string) SkuClient { + return SkuClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client SkuClient) List(ctx context.Context) (result ResourceSkuCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuClient.List") + defer func() { + sc := -1 + if result.rsc.Response.Response != nil { + sc = result.rsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkuClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.SkuClient", "List", resp, "Failure sending request") + return + } + + result.rsc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkuClient", "List", resp, "Failure responding to request") + } + if result.rsc.hasNextLink() && result.rsc.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListPreparer prepares the List request. +func (client SkuClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus", pathParameters), + 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 SkuClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SkuClient) ListResponder(resp *http.Response) (result ResourceSkuCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SkuClient) listNextResults(ctx context.Context, lastResults ResourceSkuCollection) (result ResourceSkuCollection, err error) { + req, err := lastResults.resourceSkuCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.SkuClient", "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, "appplatform.SkuClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkuClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkuClient) ListComplete(ctx context.Context) (result ResourceSkuCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go index ae12ebc2af4d..f38427d62f6c 100644 --- a/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go +++ b/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " appplatform/2019-05-01-preview" + return "Azure-SDK-For-Go/" + Version() + " appplatform/2019-05-01-preview" } // Version returns the semantic version (see http://semver.org) of the client.