From 29593941af5695955b8ed82ef502042863bb7a08 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 12 Nov 2020 05:20:07 +0000 Subject: [PATCH] CodeGen from PR 11641 in Azure/azure-rest-api-specs update (#11641) --- .../applicationdefinitions.go | 86 +++++--- .../managedapplications/applications.go | 4 +- .../2018-06-01/managedapplications/client.go | 111 ++++++++++ .../managedapplicationsapi/interfaces.go | 16 +- .../2018-06-01/managedapplications/models.go | 204 +++++++++++++++++- 5 files changed, 378 insertions(+), 43 deletions(-) diff --git a/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go b/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go index c35801627f2e..4df3035d1619 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/applicationdefinitions.go @@ -137,11 +137,10 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateResponder(resp *http.Re // CreateOrUpdateByID creates a new managed application definition. // Parameters: -// applicationDefinitionID - the fully qualified ID of the managed application definition, including the -// managed application name and the managed application definition resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name} +// resourceGroupName - the name of the resource group. The name is case insensitive. +// applicationDefinitionName - the name of the managed application definition. // parameters - parameters supplied to the create or update a managed application definition. -func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Context, applicationDefinitionID string, parameters ApplicationDefinition) (result ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) { +func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (result ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.CreateOrUpdateByID") defer func() { @@ -153,13 +152,20 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Contex }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: applicationDefinitionName, + Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.Authorizations", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", err.Error()) } - req, err := client.CreateOrUpdateByIDPreparer(ctx, applicationDefinitionID, parameters) + req, err := client.CreateOrUpdateByIDPreparer(ctx, resourceGroupName, applicationDefinitionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", nil, "Failure preparing request") return @@ -175,9 +181,11 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Contex } // CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. -func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx context.Context, applicationDefinitionID string, parameters ApplicationDefinition) (*http.Request, error) { +func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (*http.Request, error) { pathParameters := map[string]interface{}{ - "applicationDefinitionId": applicationDefinitionID, + "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2018-06-01" @@ -189,7 +197,7 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{applicationDefinitionId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -199,7 +207,7 @@ func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx contex // http.Response Body if it receives an error. func (client ApplicationDefinitionsClient) CreateOrUpdateByIDSender(req *http.Request) (future ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) { var resp *http.Response - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -306,10 +314,9 @@ func (client ApplicationDefinitionsClient) DeleteResponder(resp *http.Response) // DeleteByID deletes the managed application definition. // Parameters: -// applicationDefinitionID - the fully qualified ID of the managed application definition, including the -// managed application name and the managed application definition resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name} -func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, applicationDefinitionID string) (result ApplicationDefinitionsDeleteByIDFuture, err error) { +// resourceGroupName - the name of the resource group. The name is case insensitive. +// applicationDefinitionName - the name of the managed application definition. +func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinitionsDeleteByIDFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.DeleteByID") defer func() { @@ -320,7 +327,18 @@ func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, appli tracing.EndSpan(ctx, sc, err) }() } - req, err := client.DeleteByIDPreparer(ctx, applicationDefinitionID) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: applicationDefinitionName, + Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "DeleteByID", err.Error()) + } + + req, err := client.DeleteByIDPreparer(ctx, resourceGroupName, applicationDefinitionName) if err != nil { err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", nil, "Failure preparing request") return @@ -336,9 +354,11 @@ func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, appli } // DeleteByIDPreparer prepares the DeleteByID request. -func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Context, applicationDefinitionID string) (*http.Request, error) { +func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "applicationDefinitionId": applicationDefinitionID, + "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2018-06-01" @@ -349,7 +369,7 @@ func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Contex preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{applicationDefinitionId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -358,7 +378,7 @@ func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Contex // http.Response Body if it receives an error. func (client ApplicationDefinitionsClient) DeleteByIDSender(req *http.Request) (future ApplicationDefinitionsDeleteByIDFuture, err error) { var resp *http.Response - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -465,10 +485,9 @@ func (client ApplicationDefinitionsClient) GetResponder(resp *http.Response) (re // GetByID gets the managed application definition. // Parameters: -// applicationDefinitionID - the fully qualified ID of the managed application definition, including the -// managed application name and the managed application definition resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name} -func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, applicationDefinitionID string) (result ApplicationDefinition, err error) { +// resourceGroupName - the name of the resource group. The name is case insensitive. +// applicationDefinitionName - the name of the managed application definition. +func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinition, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.GetByID") defer func() { @@ -479,7 +498,18 @@ func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, applicat tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetByIDPreparer(ctx, applicationDefinitionID) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: applicationDefinitionName, + Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "GetByID", err.Error()) + } + + req, err := client.GetByIDPreparer(ctx, resourceGroupName, applicationDefinitionName) if err != nil { err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", nil, "Failure preparing request") return @@ -501,9 +531,11 @@ func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, applicat } // GetByIDPreparer prepares the GetByID request. -func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, applicationDefinitionID string) (*http.Request, error) { +func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "applicationDefinitionId": applicationDefinitionID, + "applicationDefinitionName": autorest.Encode("path", applicationDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2018-06-01" @@ -514,7 +546,7 @@ func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{applicationDefinitionId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -522,7 +554,7 @@ func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, // GetByIDSender sends the GetByID request. The method will close the // http.Response Body if it receives an error. func (client ApplicationDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetByIDResponder handles the response to the GetByID request. The method always diff --git a/services/resources/mgmt/2018-06-01/managedapplications/applications.go b/services/resources/mgmt/2018-06-01/managedapplications/applications.go index 89d94756bf04..cf500caa4bdb 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/applications.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/applications.go @@ -790,7 +790,7 @@ func (client ApplicationsClient) ListBySubscriptionComplete(ctx context.Context) // resourceGroupName - the name of the resource group. The name is case insensitive. // applicationName - the name of the managed application. // parameters - parameters supplied to update an existing managed application. -func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationName string, parameters *Application) (result Application, err error) { +func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationName string, parameters *ApplicationPatchable) (result Application, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update") defer func() { @@ -834,7 +834,7 @@ func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName s } // UpdatePreparer prepares the Update request. -func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters *Application) (*http.Request, error) { +func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationName string, parameters *ApplicationPatchable) (*http.Request, error) { pathParameters := map[string]interface{}{ "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), diff --git a/services/resources/mgmt/2018-06-01/managedapplications/client.go b/services/resources/mgmt/2018-06-01/managedapplications/client.go index db11dac27ac0..2620e80c9305 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/client.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/client.go @@ -21,7 +21,11 @@ package managedapplications // 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" ) const ( @@ -50,3 +54,110 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { SubscriptionID: subscriptionID, } } + +// ListOperations lists all of the available Microsoft.Solutions REST API operations. +func (client BaseClient) ListOperations(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListOperations") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listOperationsNextResults + req, err := client.ListOperationsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "ListOperations", resp, "Failure sending request") + return + } + + result.olr, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "ListOperations", resp, "Failure responding to request") + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client BaseClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Solutions/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client BaseClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOperationsNextResults retrieves the next set of results, if any. +func (client BaseClient) listOperationsNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "managedapplications.BaseClient", "listOperationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "managedapplications.BaseClient", "listOperationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedapplications.BaseClient", "listOperationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListOperationsComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListOperations") + 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.ListOperations(ctx) + return +} diff --git a/services/resources/mgmt/2018-06-01/managedapplications/managedapplicationsapi/interfaces.go b/services/resources/mgmt/2018-06-01/managedapplications/managedapplicationsapi/interfaces.go index 536950f80404..7879f19f87b6 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/managedapplicationsapi/interfaces.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/managedapplicationsapi/interfaces.go @@ -22,6 +22,14 @@ import ( "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/managedapplications" ) +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + ListOperations(ctx context.Context) (result managedapplications.OperationListResultPage, err error) + ListOperationsComplete(ctx context.Context) (result managedapplications.OperationListResultIterator, err error) +} + +var _ BaseClientAPI = (*managedapplications.BaseClient)(nil) + // ApplicationsClientAPI contains the set of methods on the ApplicationsClient type. type ApplicationsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationName string, parameters managedapplications.Application) (result managedapplications.ApplicationsCreateOrUpdateFuture, err error) @@ -34,7 +42,7 @@ type ApplicationsClientAPI interface { ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result managedapplications.ApplicationListResultIterator, err error) ListBySubscription(ctx context.Context) (result managedapplications.ApplicationListResultPage, err error) ListBySubscriptionComplete(ctx context.Context) (result managedapplications.ApplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, applicationName string, parameters *managedapplications.Application) (result managedapplications.Application, err error) + Update(ctx context.Context, resourceGroupName string, applicationName string, parameters *managedapplications.ApplicationPatchable) (result managedapplications.Application, err error) UpdateByID(ctx context.Context, applicationID string, parameters *managedapplications.Application) (result managedapplications.Application, err error) } @@ -43,11 +51,11 @@ var _ ApplicationsClientAPI = (*managedapplications.ApplicationsClient)(nil) // ApplicationDefinitionsClientAPI contains the set of methods on the ApplicationDefinitionsClient type. type ApplicationDefinitionsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters managedapplications.ApplicationDefinition) (result managedapplications.ApplicationDefinitionsCreateOrUpdateFuture, err error) - CreateOrUpdateByID(ctx context.Context, applicationDefinitionID string, parameters managedapplications.ApplicationDefinition) (result managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) + CreateOrUpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters managedapplications.ApplicationDefinition) (result managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture, err error) Delete(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result managedapplications.ApplicationDefinitionsDeleteFuture, err error) - DeleteByID(ctx context.Context, applicationDefinitionID string) (result managedapplications.ApplicationDefinitionsDeleteByIDFuture, err error) + DeleteByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result managedapplications.ApplicationDefinitionsDeleteByIDFuture, err error) Get(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result managedapplications.ApplicationDefinition, err error) - GetByID(ctx context.Context, applicationDefinitionID string) (result managedapplications.ApplicationDefinition, err error) + GetByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result managedapplications.ApplicationDefinition, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result managedapplications.ApplicationDefinitionListResultPage, err error) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result managedapplications.ApplicationDefinitionListResultIterator, err error) } diff --git a/services/resources/mgmt/2018-06-01/managedapplications/models.go b/services/resources/mgmt/2018-06-01/managedapplications/models.go index 1101533dae38..9ba8d3a2be04 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/models.go +++ b/services/resources/mgmt/2018-06-01/managedapplications/models.go @@ -507,8 +507,11 @@ func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition } // Creates a new instance of the ApplicationDefinitionListResultPage type. -func NewApplicationDefinitionListResultPage(getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage { - return ApplicationDefinitionListResultPage{fn: getNextPage} +func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage { + return ApplicationDefinitionListResultPage{ + fn: getNextPage, + adlr: cur, + } } // ApplicationDefinitionProperties the managed application definition properties. @@ -533,8 +536,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 } @@ -789,8 +792,11 @@ func (page ApplicationListResultPage) Values() []Application { } // Creates a new instance of the ApplicationListResultPage type. -func NewApplicationListResultPage(getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { - return ApplicationListResultPage{fn: getNextPage} +func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { + return ApplicationListResultPage{ + fn: getNextPage, + alr: cur, + } } // ApplicationPatchable information about managed application. @@ -1058,8 +1064,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 } @@ -1133,8 +1139,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"` @@ -1204,6 +1210,184 @@ func (i Identity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Operation microsoft.Solutions operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Solutions + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: Application, JitRequest, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list Microsoft.Solutions operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Microsoft.Solutions operations. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// 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 *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.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 *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// 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 *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.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.olr) + if err != nil { + return err + } + page.olr = 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 *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + // Plan plan for the managed application. type Plan struct { // Name - The plan name.