From cfb00b6a1a338e53dcb1ac5fbef5d452fe94f600 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 30 Jul 2020 02:44:35 +0000 Subject: [PATCH] Generated from 222c6820550f2d760710701b21c2ac8dc9f30e73 Address PR comments --- .../applicationdefinitions.go | 10 +- .../managedapplications/applications.go | 16 +- .../2018-06-01/managedapplications/enums.go | 96 ++++++++++ .../2018-06-01/managedapplications/models.go | 169 ++++++++---------- .../2018-06-01/managedapplications/version.go | 2 +- 5 files changed, 181 insertions(+), 112 deletions(-) create mode 100644 services/resources/mgmt/2018-06-01/managedapplications/enums.go diff --git a/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go b/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go index fe8373be1738..c35801627f2e 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go @@ -128,7 +128,6 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateSender(req *http.Reques func (client ApplicationDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationDefinition, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -213,7 +212,6 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateByIDSender(req *http.Re func (client ApplicationDefinitionsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -300,7 +298,6 @@ func (client ApplicationDefinitionsClient) DeleteSender(req *http.Request) (futu func (client ApplicationDefinitionsClient) 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 @@ -374,7 +371,6 @@ func (client ApplicationDefinitionsClient) DeleteByIDSender(req *http.Request) ( func (client ApplicationDefinitionsClient) DeleteByIDResponder(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 @@ -460,7 +456,6 @@ func (client ApplicationDefinitionsClient) GetSender(req *http.Request) (*http.R func (client ApplicationDefinitionsClient) GetResponder(resp *http.Response) (result ApplicationDefinition, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -535,7 +530,6 @@ func (client ApplicationDefinitionsClient) GetByIDSender(req *http.Request) (*ht func (client ApplicationDefinitionsClient) GetByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -583,6 +577,9 @@ func (client ApplicationDefinitionsClient) ListByResourceGroup(ctx context.Conte if err != nil { err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to request") } + if result.adlr.hasNextLink() && result.adlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -618,7 +615,6 @@ func (client ApplicationDefinitionsClient) ListByResourceGroupSender(req *http.R func (client ApplicationDefinitionsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationDefinitionListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/resources/mgmt/2018-06-01/managedapplications/applications.go b/services/resources/mgmt/2018-06-01/managedapplications/applications.go index 91a742805c47..89d94756bf04 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/applications.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/applications.go @@ -135,7 +135,6 @@ func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (future func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -228,7 +227,6 @@ func (client ApplicationsClient) CreateOrUpdateByIDSender(req *http.Request) (fu func (client ApplicationsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -315,7 +313,6 @@ func (client ApplicationsClient) DeleteSender(req *http.Request) (future Applica func (client ApplicationsClient) 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 @@ -389,7 +386,6 @@ func (client ApplicationsClient) DeleteByIDSender(req *http.Request) (future App func (client ApplicationsClient) DeleteByIDResponder(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 @@ -475,7 +471,6 @@ func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, e func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -550,7 +545,6 @@ func (client ApplicationsClient) GetByIDSender(req *http.Request) (*http.Respons func (client ApplicationsClient) GetByIDResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -598,6 +592,9 @@ func (client ApplicationsClient) ListByResourceGroup(ctx context.Context, resour if err != nil { err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListByResourceGroup", resp, "Failure responding to request") } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -633,7 +630,6 @@ func (client ApplicationsClient) ListByResourceGroupSender(req *http.Request) (* func (client ApplicationsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -708,6 +704,9 @@ func (client ApplicationsClient) ListBySubscription(ctx context.Context) (result if err != nil { err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsClient", "ListBySubscription", resp, "Failure responding to request") } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -742,7 +741,6 @@ func (client ApplicationsClient) ListBySubscriptionSender(req *http.Request) (*h func (client ApplicationsClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -872,7 +870,6 @@ func (client ApplicationsClient) UpdateSender(req *http.Request) (*http.Response func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -954,7 +951,6 @@ func (client ApplicationsClient) UpdateByIDSender(req *http.Request) (*http.Resp func (client ApplicationsClient) UpdateByIDResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/resources/mgmt/2018-06-01/managedapplications/enums.go b/services/resources/mgmt/2018-06-01/managedapplications/enums.go new file mode 100644 index 000000000000..227c2553cd4f --- /dev/null +++ b/services/resources/mgmt/2018-06-01/managedapplications/enums.go @@ -0,0 +1,96 @@ +package managedapplications + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ApplicationArtifactType enumerates the values for application artifact type. +type ApplicationArtifactType string + +const ( + // Custom ... + Custom ApplicationArtifactType = "Custom" + // Template ... + Template ApplicationArtifactType = "Template" +) + +// PossibleApplicationArtifactTypeValues returns an array of possible values for the ApplicationArtifactType const type. +func PossibleApplicationArtifactTypeValues() []ApplicationArtifactType { + return []ApplicationArtifactType{Custom, Template} +} + +// ApplicationLockLevel enumerates the values for application lock level. +type ApplicationLockLevel string + +const ( + // CanNotDelete ... + CanNotDelete ApplicationLockLevel = "CanNotDelete" + // None ... + None ApplicationLockLevel = "None" + // ReadOnly ... + ReadOnly ApplicationLockLevel = "ReadOnly" +) + +// PossibleApplicationLockLevelValues returns an array of possible values for the ApplicationLockLevel const type. +func PossibleApplicationLockLevelValues() []ApplicationLockLevel { + return []ApplicationLockLevel{CanNotDelete, None, ReadOnly} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Accepted ... + Accepted ProvisioningState = "Accepted" + // Canceled ... + Canceled ProvisioningState = "Canceled" + // Created ... + Created ProvisioningState = "Created" + // Creating ... + Creating ProvisioningState = "Creating" + // Deleted ... + Deleted ProvisioningState = "Deleted" + // Deleting ... + Deleting ProvisioningState = "Deleting" + // Failed ... + Failed ProvisioningState = "Failed" + // Ready ... + Ready ProvisioningState = "Ready" + // Running ... + Running ProvisioningState = "Running" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" + // Updating ... + Updating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{Accepted, Canceled, Created, Creating, Deleted, Deleting, Failed, Ready, Running, Succeeded, Updating} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} diff --git a/services/resources/mgmt/2018-06-01/managedapplications/models.go b/services/resources/mgmt/2018-06-01/managedapplications/models.go index bd0e74f643de..1101533dae38 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/models.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/models.go @@ -30,84 +30,6 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/managedapplications" -// ApplicationArtifactType enumerates the values for application artifact type. -type ApplicationArtifactType string - -const ( - // Custom ... - Custom ApplicationArtifactType = "Custom" - // Template ... - Template ApplicationArtifactType = "Template" -) - -// PossibleApplicationArtifactTypeValues returns an array of possible values for the ApplicationArtifactType const type. -func PossibleApplicationArtifactTypeValues() []ApplicationArtifactType { - return []ApplicationArtifactType{Custom, Template} -} - -// ApplicationLockLevel enumerates the values for application lock level. -type ApplicationLockLevel string - -const ( - // CanNotDelete ... - CanNotDelete ApplicationLockLevel = "CanNotDelete" - // None ... - None ApplicationLockLevel = "None" - // ReadOnly ... - ReadOnly ApplicationLockLevel = "ReadOnly" -) - -// PossibleApplicationLockLevelValues returns an array of possible values for the ApplicationLockLevel const type. -func PossibleApplicationLockLevelValues() []ApplicationLockLevel { - return []ApplicationLockLevel{CanNotDelete, None, ReadOnly} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Accepted ... - Accepted ProvisioningState = "Accepted" - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Created ... - Created ProvisioningState = "Created" - // Creating ... - Creating ProvisioningState = "Creating" - // Deleted ... - Deleted ProvisioningState = "Deleted" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Ready ... - Ready ProvisioningState = "Ready" - // Running ... - Running ProvisioningState = "Running" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Updating ... - Updating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Accepted, Canceled, Created, Creating, Deleted, Deleting, Failed, Ready, Running, Succeeded, Updating} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // SystemAssigned ... - SystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{SystemAssigned} -} - // Application information about managed application. type Application struct { autorest.Response `json:"-"` @@ -510,10 +432,15 @@ func (adlr ApplicationDefinitionListResult) IsEmpty() bool { return adlr.Value == nil || len(*adlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (adlr ApplicationDefinitionListResult) hasNextLink() bool { + return adlr.NextLink != nil && len(*adlr.NextLink) != 0 +} + // applicationDefinitionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { - if adlr.NextLink == nil || len(to.String(adlr.NextLink)) < 1 { + if !adlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -541,11 +468,16 @@ func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Con tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.adlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.adlr) + if err != nil { + return err + } + page.adlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.adlr = next return nil } @@ -601,8 +533,8 @@ type ApplicationDefinitionProperties struct { CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"` } -// ApplicationDefinitionsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. +// ApplicationDefinitionsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. type ApplicationDefinitionsCreateOrUpdateByIDFuture struct { azure.Future } @@ -782,10 +714,15 @@ func (alr ApplicationListResult) IsEmpty() bool { return alr.Value == nil || len(*alr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (alr ApplicationListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + // applicationListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) { - if alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 { + if !alr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -813,11 +750,16 @@ func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.alr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.alr = next return nil } @@ -1035,6 +977,21 @@ type ApplicationProperties struct { ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` } +// MarshalJSON is the custom marshaler for ApplicationProperties. +func (ap ApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ManagedResourceGroupID != nil { + objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID + } + if ap.ApplicationDefinitionID != nil { + objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID + } + if ap.Parameters != nil { + objectMap["parameters"] = ap.Parameters + } + return json.Marshal(objectMap) +} + // ApplicationPropertiesPatchable the managed application properties. type ApplicationPropertiesPatchable struct { // ManagedResourceGroupID - The managed resource group Id. @@ -1049,6 +1006,21 @@ type ApplicationPropertiesPatchable struct { ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` } +// MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable. +func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if app.ManagedResourceGroupID != nil { + objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID + } + if app.ApplicationDefinitionID != nil { + objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID + } + if app.Parameters != nil { + objectMap["parameters"] = app.Parameters + } + return json.Marshal(objectMap) +} + // ApplicationProviderAuthorization the managed application provider authorization. type ApplicationProviderAuthorization struct { // PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources. @@ -1086,8 +1058,8 @@ func (future *ApplicationsCreateOrUpdateByIDFuture) Result(client ApplicationsCl return } -// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. type ApplicationsCreateOrUpdateFuture struct { azure.Future } @@ -1161,8 +1133,8 @@ func (future *ApplicationsDeleteFuture) Result(client ApplicationsClient) (ar au return } -// ErrorResponse error response indicates managed application is not able to process the incoming request. -// The reason is provided in the error message. +// ErrorResponse error response indicates managed application is not able to process the incoming request. The +// reason is provided in the error message. type ErrorResponse struct { // HTTPStatus - Http status code. HTTPStatus *string `json:"httpStatus,omitempty"` @@ -1223,6 +1195,15 @@ type Identity struct { Type ResourceIdentityType `json:"type,omitempty"` } +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + // Plan plan for the managed application. type Plan struct { // Name - The plan name. diff --git a/services/resources/mgmt/2018-06-01/managedapplications/version.go b/services/resources/mgmt/2018-06-01/managedapplications/version.go index 6f37b5048bd9..e6c84c01a802 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/version.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/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 + " managedapplications/2018-06-01" + return "Azure-SDK-For-Go/" + Version() + " managedapplications/2018-06-01" } // Version returns the semantic version (see http://semver.org) of the client.