From b7aa69f73179d98ef9009a1ee9e77355b1a51108 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 5 Sep 2023 06:47:15 +0000 Subject: [PATCH] CodeGen from PR 25652 in Azure/azure-rest-api-specs Merge 4f27319aca9111e202effbcf4b9eb018dec8846d into acf24167b5174d88f36302e243c883f2e63eec52 --- .../armmanagedapplications/CHANGELOG.md | 32 ++ .../application_client.go | 3 +- .../application_client_example_test.go | 66 --- .../applicationdefinitions_client.go | 353 ++++++++++-- ...licationdefinitions_client_example_test.go | 285 ---------- .../applications_client.go | 516 ++++++++++++++++-- .../applications_client_example_test.go | 256 --------- .../armmanagedapplications/autorest.md | 6 +- .../armmanagedapplications/client_factory.go | 11 +- .../armmanagedapplications/constants.go | 63 ++- .../solutions/armmanagedapplications/go.mod | 22 +- .../solutions/armmanagedapplications/go.sum | 38 +- .../jitrequests_client.go | 82 ++- .../jitrequests_client_example_test.go | 283 ---------- .../armmanagedapplications/models.go | 225 +++----- .../armmanagedapplications/models_serde.go | 264 +++++++-- .../armmanagedapplications/options.go | 199 +++++++ .../armmanagedapplications/response_types.go | 88 ++- .../armmanagedapplications/time_rfc3339.go | 3 +- 19 files changed, 1497 insertions(+), 1298 deletions(-) delete mode 100644 sdk/resourcemanager/solutions/armmanagedapplications/application_client_example_test.go delete mode 100644 sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client_example_test.go delete mode 100644 sdk/resourcemanager/solutions/armmanagedapplications/applications_client_example_test.go delete mode 100644 sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client_example_test.go create mode 100644 sdk/resourcemanager/solutions/armmanagedapplications/options.go diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/CHANGELOG.md b/sdk/resourcemanager/solutions/armmanagedapplications/CHANGELOG.md index a97d0d00a73b..58e771115b50 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/CHANGELOG.md +++ b/sdk/resourcemanager/solutions/armmanagedapplications/CHANGELOG.md @@ -1,5 +1,37 @@ # Release History +## 2.0.0 (2023-09-05) +### Breaking Changes + +- Operation `*ApplicationDefinitionsClient.BeginCreateOrUpdate` has been changed to non-LRO, use `*ApplicationDefinitionsClient.CreateOrUpdate` instead. +- Operation `*ApplicationDefinitionsClient.BeginDelete` has been changed to non-LRO, use `*ApplicationDefinitionsClient.Delete` instead. +- Operation `*ApplicationsClient.Update` has been changed to LRO, use `*ApplicationsClient.BeginUpdate` instead. +- Struct `ApplicationPropertiesPatchable` has been removed +- Field `ProvisioningState` of struct `ApplicationDefinitionProperties` has been removed + +### Features Added + +- New enum type `Status` with values `StatusElevate`, `StatusNotSpecified`, `StatusRemove` +- New enum type `Substatus` with values `SubstatusApproved`, `SubstatusDenied`, `SubstatusExpired`, `SubstatusFailed`, `SubstatusNotSpecified`, `SubstatusTimeout` +- New function `*ApplicationDefinitionsClient.CreateOrUpdateByID(context.Context, string, string, ApplicationDefinition, *ApplicationDefinitionsClientCreateOrUpdateByIDOptions) (ApplicationDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*ApplicationDefinitionsClient.DeleteByID(context.Context, string, string, *ApplicationDefinitionsClientDeleteByIDOptions) (ApplicationDefinitionsClientDeleteByIDResponse, error)` +- New function `*ApplicationDefinitionsClient.GetByID(context.Context, string, string, *ApplicationDefinitionsClientGetByIDOptions) (ApplicationDefinitionsClientGetByIDResponse, error)` +- New function `*ApplicationDefinitionsClient.UpdateByID(context.Context, string, string, ApplicationDefinitionPatchable, *ApplicationDefinitionsClientUpdateByIDOptions) (ApplicationDefinitionsClientUpdateByIDResponse, error)` +- New function `*ApplicationsClient.BeginCreateOrUpdateByID(context.Context, string, Application, *ApplicationsClientBeginCreateOrUpdateByIDOptions) (*runtime.Poller[ApplicationsClientCreateOrUpdateByIDResponse], error)` +- New function `*ApplicationsClient.BeginDeleteByID(context.Context, string, *ApplicationsClientBeginDeleteByIDOptions) (*runtime.Poller[ApplicationsClientDeleteByIDResponse], error)` +- New function `*ApplicationsClient.GetByID(context.Context, string, *ApplicationsClientGetByIDOptions) (ApplicationsClientGetByIDResponse, error)` +- New function `*ApplicationsClient.ListTokens(context.Context, string, string, ListTokenRequest, *ApplicationsClientListTokensOptions) (ApplicationsClientListTokensResponse, error)` +- New function `*ApplicationsClient.BeginUpdateAccess(context.Context, string, string, UpdateAccessDefinition, *ApplicationsClientBeginUpdateAccessOptions) (*runtime.Poller[ApplicationsClientUpdateAccessResponse], error)` +- New function `*ApplicationsClient.BeginUpdateByID(context.Context, string, *ApplicationsClientBeginUpdateByIDOptions) (*runtime.Poller[ApplicationsClientUpdateByIDResponse], error)` +- New struct `AllowedUpgradePlansResult` +- New struct `JitRequestMetadata` +- New struct `ListTokenRequest` +- New struct `ManagedIdentityToken` +- New struct `ManagedIdentityTokenResult` +- New struct `UpdateAccessDefinition` +- New anonymous field `AllowedUpgradePlansResult` in struct `ApplicationsClientListAllowedUpgradePlansResponse` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/application_client.go b/sdk/resourcemanager/solutions/armmanagedapplications/application_client.go index cde27f1ee41e..780604278710 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/application_client.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/application_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/application_client_example_test.go b/sdk/resourcemanager/solutions/armmanagedapplications/application_client_example_test.go deleted file mode 100644 index 3da89ea74a73..000000000000 --- a/sdk/resourcemanager/solutions/armmanagedapplications/application_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmanagedapplications_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listSolutionsOperations.json -func ExampleApplicationClient_NewListOperationsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationClient().NewListOperationsPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armmanagedapplications.OperationListResult{ - // Value: []*armmanagedapplications.Operation{ - // { - // Name: to.Ptr("SolutionsOperation1"), - // Display: &armmanagedapplications.OperationDisplay{ - // Description: to.Ptr("Description of the operation"), - // Operation: to.Ptr("Read"), - // Provider: to.Ptr("Microsoft.ResourceProvider"), - // Resource: to.Ptr("Resource1"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SolutionssOperation2"), - // Display: &armmanagedapplications.OperationDisplay{ - // Description: to.Ptr("Description of the operation"), - // Operation: to.Ptr("Write"), - // Provider: to.Ptr("Microsoft.ResourceProvider"), - // Resource: to.Ptr("Resource2"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client.go b/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client.go index 02c5a1201e32..35cab9b4f069 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications @@ -44,50 +43,35 @@ func NewApplicationDefinitionsClient(subscriptionID string, credential azcore.To return client, nil } -// BeginCreateOrUpdate - Creates a new managed application definition. +// CreateOrUpdate - Creates or updates a managed application definition. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 // - 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 an managed application definition. -// - options - ApplicationDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.BeginCreateOrUpdate +// - options - ApplicationDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.CreateOrUpdate // method. -func (client *ApplicationDefinitionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ApplicationDefinitionsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, applicationDefinitionName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationDefinitionsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ApplicationDefinitionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Creates a new managed application definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01 -func (client *ApplicationDefinitionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +func (client *ApplicationDefinitionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientCreateOrUpdateOptions) (ApplicationDefinitionsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationDefinitionName, parameters, options) if err != nil { - return nil, err + return ApplicationDefinitionsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return nil, err + return ApplicationDefinitionsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientCreateOrUpdateResponse{}, err } - return resp, nil + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ApplicationDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ApplicationDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -109,50 +93,113 @@ func (client *ApplicationDefinitionsClient) createOrUpdateCreateRequest(ctx cont reqQP.Set("api-version", "2021-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ApplicationDefinitionsClient) createOrUpdateHandleResponse(resp *http.Response) (ApplicationDefinitionsClientCreateOrUpdateResponse, error) { + result := ApplicationDefinitionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationDefinition); err != nil { + return ApplicationDefinitionsClientCreateOrUpdateResponse{}, err + } + return result, nil } -// BeginDelete - Deletes the managed application definition. +// CreateOrUpdateByID - Creates or updates a managed application definition. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationDefinitionName - The name of the managed application definition. -// - options - ApplicationDefinitionsClientBeginDeleteOptions contains the optional parameters for the ApplicationDefinitionsClient.BeginDelete +// - parameters - Parameters supplied to the create or update a managed application definition. +// - options - ApplicationDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.CreateOrUpdateByID // method. -func (client *ApplicationDefinitionsClient) BeginDelete(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientBeginDeleteOptions) (*runtime.Poller[ApplicationDefinitionsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, applicationDefinitionName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ApplicationDefinitionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[ApplicationDefinitionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) +func (client *ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientCreateOrUpdateByIDOptions) (ApplicationDefinitionsClientCreateOrUpdateByIDResponse, error) { + var err error + req, err := client.createOrUpdateByIDCreateRequest(ctx, resourceGroupName, applicationDefinitionName, parameters, options) + if err != nil { + return ApplicationDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientCreateOrUpdateByIDResponse{}, err } + resp, err := client.createOrUpdateByIDHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *ApplicationDefinitionsClient) createOrUpdateByIDCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition, options *ApplicationDefinitionsClientCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationDefinitionName == "" { + return nil, errors.New("parameter applicationDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationDefinitionName}", url.PathEscape(applicationDefinitionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateByIDHandleResponse handles the CreateOrUpdateByID response. +func (client *ApplicationDefinitionsClient) createOrUpdateByIDHandleResponse(resp *http.Response) (ApplicationDefinitionsClientCreateOrUpdateByIDResponse, error) { + result := ApplicationDefinitionsClientCreateOrUpdateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationDefinition); err != nil { + return ApplicationDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + return result, nil } // Delete - Deletes the managed application definition. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 -func (client *ApplicationDefinitionsClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientBeginDeleteOptions) (*http.Response, error) { +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - applicationDefinitionName - The name of the managed application definition. +// - options - ApplicationDefinitionsClientDeleteOptions contains the optional parameters for the ApplicationDefinitionsClient.Delete +// method. +func (client *ApplicationDefinitionsClient) Delete(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientDeleteOptions) (ApplicationDefinitionsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationDefinitionName, options) if err != nil { - return nil, err + return ApplicationDefinitionsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return nil, err + return ApplicationDefinitionsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientDeleteResponse{}, err } - return resp, nil + return ApplicationDefinitionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. -func (client *ApplicationDefinitionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ApplicationDefinitionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -177,6 +224,57 @@ func (client *ApplicationDefinitionsClient) deleteCreateRequest(ctx context.Cont return req, nil } +// DeleteByID - Deletes the managed application definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - applicationDefinitionName - The name of the managed application definition. +// - options - ApplicationDefinitionsClientDeleteByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.DeleteByID +// method. +func (client *ApplicationDefinitionsClient) DeleteByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientDeleteByIDOptions) (ApplicationDefinitionsClientDeleteByIDResponse, error) { + var err error + req, err := client.deleteByIDCreateRequest(ctx, resourceGroupName, applicationDefinitionName, options) + if err != nil { + return ApplicationDefinitionsClientDeleteByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationDefinitionsClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientDeleteByIDResponse{}, err + } + return ApplicationDefinitionsClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *ApplicationDefinitionsClient) deleteByIDCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationDefinitionName == "" { + return nil, errors.New("parameter applicationDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationDefinitionName}", url.PathEscape(applicationDefinitionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Get - Gets the managed application definition. // If the operation fails it returns an *azcore.ResponseError type. // @@ -186,18 +284,21 @@ func (client *ApplicationDefinitionsClient) deleteCreateRequest(ctx context.Cont // - options - ApplicationDefinitionsClientGetOptions contains the optional parameters for the ApplicationDefinitionsClient.Get // method. func (client *ApplicationDefinitionsClient) Get(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientGetOptions) (ApplicationDefinitionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, applicationDefinitionName, options) if err != nil { return ApplicationDefinitionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationDefinitionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationDefinitionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -235,6 +336,67 @@ func (client *ApplicationDefinitionsClient) getHandleResponse(resp *http.Respons return result, nil } +// GetByID - Gets the managed application definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - applicationDefinitionName - The name of the managed application definition. +// - options - ApplicationDefinitionsClientGetByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.GetByID +// method. +func (client *ApplicationDefinitionsClient) GetByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientGetByIDOptions) (ApplicationDefinitionsClientGetByIDResponse, error) { + var err error + req, err := client.getByIDCreateRequest(ctx, resourceGroupName, applicationDefinitionName, options) + if err != nil { + return ApplicationDefinitionsClientGetByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ApplicationDefinitionsClient) getByIDCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationDefinitionName == "" { + return nil, errors.New("parameter applicationDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationDefinitionName}", url.PathEscape(applicationDefinitionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ApplicationDefinitionsClient) getByIDHandleResponse(resp *http.Response) (ApplicationDefinitionsClientGetByIDResponse, error) { + result := ApplicationDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationDefinition); err != nil { + return ApplicationDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Lists the managed application definitions in a resource group. // // Generated from API version 2021-07-01 @@ -300,7 +462,7 @@ func (client *ApplicationDefinitionsClient) listByResourceGroupHandleResponse(re return result, nil } -// NewListBySubscriptionPager - Gets all the application definitions within a subscription. +// NewListBySubscriptionPager - Lists all the application definitions within a subscription. // // Generated from API version 2021-07-01 // - options - ApplicationDefinitionsClientListBySubscriptionOptions contains the optional parameters for the ApplicationDefinitionsClient.NewListBySubscriptionPager @@ -370,18 +532,21 @@ func (client *ApplicationDefinitionsClient) listBySubscriptionHandleResponse(res // - options - ApplicationDefinitionsClientUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.Update // method. func (client *ApplicationDefinitionsClient) Update(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable, options *ApplicationDefinitionsClientUpdateOptions) (ApplicationDefinitionsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationDefinitionName, parameters, options) if err != nil { return ApplicationDefinitionsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationDefinitionsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationDefinitionsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -407,7 +572,10 @@ func (client *ApplicationDefinitionsClient) updateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2021-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. @@ -418,3 +586,68 @@ func (client *ApplicationDefinitionsClient) updateHandleResponse(resp *http.Resp } return result, nil } + +// UpdateByID - Updates the managed application definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - 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 update a managed application definition. +// - options - ApplicationDefinitionsClientUpdateByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.UpdateByID +// method. +func (client *ApplicationDefinitionsClient) UpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable, options *ApplicationDefinitionsClientUpdateByIDOptions) (ApplicationDefinitionsClientUpdateByIDResponse, error) { + var err error + req, err := client.updateByIDCreateRequest(ctx, resourceGroupName, applicationDefinitionName, parameters, options) + if err != nil { + return ApplicationDefinitionsClientUpdateByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationDefinitionsClientUpdateByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationDefinitionsClientUpdateByIDResponse{}, err + } + resp, err := client.updateByIDHandleResponse(httpResp) + return resp, err +} + +// updateByIDCreateRequest creates the UpdateByID request. +func (client *ApplicationDefinitionsClient) updateByIDCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable, options *ApplicationDefinitionsClientUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationDefinitionName == "" { + return nil, errors.New("parameter applicationDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationDefinitionName}", url.PathEscape(applicationDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateByIDHandleResponse handles the UpdateByID response. +func (client *ApplicationDefinitionsClient) updateByIDHandleResponse(resp *http.Response) (ApplicationDefinitionsClientUpdateByIDResponse, error) { + result := ApplicationDefinitionsClientUpdateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationDefinition); err != nil { + return ApplicationDefinitionsClientUpdateByIDResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client_example_test.go b/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client_example_test.go deleted file mode 100644 index e7fef490118d..000000000000 --- a/sdk/resourcemanager/solutions/armmanagedapplications/applicationdefinitions_client_example_test.go +++ /dev/null @@ -1,285 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmanagedapplications_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json -func ExampleApplicationDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationDefinitionsClient().Get(ctx, "rg", "myManagedApplicationDef", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationDefinition = armmanagedapplications.ApplicationDefinition{ - // Name: to.Ptr("myManagedApplicationDef"), - // Type: to.Ptr("Microsoft.Solutions/applicationDefinitions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myManagedApplicationDef"), - // Properties: &armmanagedapplications.ApplicationDefinitionProperties{ - // Description: to.Ptr("myManagedApplicationDef description"), - // Artifacts: []*armmanagedapplications.ApplicationDefinitionArtifact{ - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameCreateUIDefinition), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeCustom), - // URI: to.Ptr("https://path/to/managedApplicationCreateUiDefinition.json"), - // }, - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameApplicationResourceTemplate), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeTemplate), - // URI: to.Ptr("https://path/to/mainTemplate.json"), - // }}, - // Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - // { - // PrincipalID: to.Ptr("validprincipalguid"), - // RoleDefinitionID: to.Ptr("validroleguid"), - // }}, - // DisplayName: to.Ptr("myManagedApplicationDef"), - // LockLevel: to.Ptr(armmanagedapplications.ApplicationLockLevelNone), - // PackageFileURI: to.Ptr("https://path/to/packagezipfile"), - // Policies: []*armmanagedapplications.ApplicationPolicy{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json -func ExampleApplicationDefinitionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationDefinitionsClient().BeginDelete(ctx, "rg", "myManagedApplicationDef", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json -func ExampleApplicationDefinitionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationDefinitionsClient().BeginCreateOrUpdate(ctx, "rg", "myManagedApplicationDef", armmanagedapplications.ApplicationDefinition{ - Properties: &armmanagedapplications.ApplicationDefinitionProperties{ - Description: to.Ptr("myManagedApplicationDef description"), - Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - { - PrincipalID: to.Ptr("validprincipalguid"), - RoleDefinitionID: to.Ptr("validroleguid"), - }}, - DisplayName: to.Ptr("myManagedApplicationDef"), - LockLevel: to.Ptr(armmanagedapplications.ApplicationLockLevelNone), - PackageFileURI: to.Ptr("https://path/to/packagezipfile"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationDefinition = armmanagedapplications.ApplicationDefinition{ - // Name: to.Ptr("myManagedApplicationDef"), - // Type: to.Ptr("Microsoft.Solutions/applicationDefinitions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myManagedApplicationDef"), - // Properties: &armmanagedapplications.ApplicationDefinitionProperties{ - // Description: to.Ptr("myManagedApplicationDef description"), - // Artifacts: []*armmanagedapplications.ApplicationDefinitionArtifact{ - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameCreateUIDefinition), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeCustom), - // URI: to.Ptr("https://path/to/managedApplicationCreateUiDefinition.json"), - // }, - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameApplicationResourceTemplate), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeTemplate), - // URI: to.Ptr("https://path/to/mainTemplate.json"), - // }}, - // Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - // { - // PrincipalID: to.Ptr("validprincipalguid"), - // RoleDefinitionID: to.Ptr("validroleguid"), - // }}, - // DisplayName: to.Ptr("myManagedApplicationDef"), - // LockLevel: to.Ptr(armmanagedapplications.ApplicationLockLevelNone), - // PackageFileURI: to.Ptr("https://path/to/packagezipfile"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json -func ExampleApplicationDefinitionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationDefinitionsClient().Update(ctx, "rg", "myManagedApplicationDef", armmanagedapplications.ApplicationDefinitionPatchable{ - Tags: map[string]*string{ - "department": to.Ptr("Finance"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationDefinition = armmanagedapplications.ApplicationDefinition{ - // Name: to.Ptr("myManagedApplicationDef"), - // Type: to.Ptr("Microsoft.Solutions/applicationDefinitions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myManagedApplicationDef"), - // Properties: &armmanagedapplications.ApplicationDefinitionProperties{ - // Description: to.Ptr("myManagedApplicationDef description"), - // Artifacts: []*armmanagedapplications.ApplicationDefinitionArtifact{ - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameCreateUIDefinition), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeCustom), - // URI: to.Ptr("https://path/to/managedApplicationCreateUiDefinition.json"), - // }, - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameApplicationResourceTemplate), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeTemplate), - // URI: to.Ptr("https://path/to/mainTemplate.json"), - // }}, - // Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - // { - // PrincipalID: to.Ptr("validprincipalguid"), - // RoleDefinitionID: to.Ptr("validroleguid"), - // }}, - // DisplayName: to.Ptr("myManagedApplicationDef"), - // LockLevel: to.Ptr(armmanagedapplications.ApplicationLockLevelNone), - // PackageFileURI: to.Ptr("https://path/to/packagezipfile"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json -func ExampleApplicationDefinitionsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationDefinitionsClient().NewListByResourceGroupPager("rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationDefinitionListResult = armmanagedapplications.ApplicationDefinitionListResult{ - // Value: []*armmanagedapplications.ApplicationDefinition{ - // { - // Name: to.Ptr("myManagedApplicationDef"), - // Type: to.Ptr("Microsoft.Solutions/applicationDefinitions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myManagedApplicationDef"), - // Properties: &armmanagedapplications.ApplicationDefinitionProperties{ - // Description: to.Ptr("myManagedApplicationDef description"), - // Artifacts: []*armmanagedapplications.ApplicationDefinitionArtifact{ - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameCreateUIDefinition), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeCustom), - // URI: to.Ptr("https://path/to/managedApplicationCreateUiDefinition.json"), - // }, - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameApplicationResourceTemplate), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeTemplate), - // URI: to.Ptr("https://path/to/mainTemplate.json"), - // }}, - // Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - // { - // PrincipalID: to.Ptr("validprincipalguid"), - // RoleDefinitionID: to.Ptr("validroleguid"), - // }}, - // DisplayName: to.Ptr("myManagedApplicationDef"), - // LockLevel: to.Ptr(armmanagedapplications.ApplicationLockLevelNone), - // PackageFileURI: to.Ptr("https://path/to/packagezipfile"), - // }, - // }, - // { - // Name: to.Ptr("myManagedApplicationDef2"), - // Type: to.Ptr("Microsoft.Solutions/applicationDefinitions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myManagedApplicationDef2"), - // Properties: &armmanagedapplications.ApplicationDefinitionProperties{ - // Description: to.Ptr("myManagedApplicationDef2 description"), - // Artifacts: []*armmanagedapplications.ApplicationDefinitionArtifact{ - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameCreateUIDefinition), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeCustom), - // URI: to.Ptr("https://path/to/managedApplicationCreateUiDefinition.json"), - // }, - // { - // Name: to.Ptr(armmanagedapplications.ApplicationDefinitionArtifactNameApplicationResourceTemplate), - // Type: to.Ptr(armmanagedapplications.ApplicationArtifactTypeTemplate), - // URI: to.Ptr("https://path/to/mainTemplate.json"), - // }}, - // Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - // { - // PrincipalID: to.Ptr("validprincipalguid"), - // RoleDefinitionID: to.Ptr("validroleguid"), - // }}, - // DisplayName: to.Ptr("myManagedApplicationDef2"), - // LockLevel: to.Ptr(armmanagedapplications.ApplicationLockLevelNone), - // PackageFileURI: to.Ptr("https://path/to/packagezipfile"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/applications_client.go b/sdk/resourcemanager/solutions/armmanagedapplications/applications_client.go index 66fda3dd4dcd..4ea86a5bb398 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/applications_client.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/applications_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications @@ -44,7 +43,7 @@ func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredent return client, nil } -// BeginCreateOrUpdate - Creates a new managed application. +// BeginCreateOrUpdate - Creates or updates a managed application. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 @@ -59,31 +58,34 @@ func (client *ApplicationsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ApplicationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// CreateOrUpdate - Creates a new managed application. +// CreateOrUpdate - Creates or updates a managed application. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 func (client *ApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationName string, parameters Application, options *ApplicationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,7 +111,74 @@ func (client *ApplicationsClient) createOrUpdateCreateRequest(ctx context.Contex reqQP.Set("api-version", "2021-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdateByID - Creates or updates a managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - applicationID - The fully qualified ID of the managed application, including the managed application name and the managed +// application resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} +// - parameters - Parameters supplied to the create or update a managed application. +// - options - ApplicationsClientBeginCreateOrUpdateByIDOptions contains the optional parameters for the ApplicationsClient.BeginCreateOrUpdateByID +// method. +func (client *ApplicationsClient) BeginCreateOrUpdateByID(ctx context.Context, applicationID string, parameters Application, options *ApplicationsClientBeginCreateOrUpdateByIDOptions) (*runtime.Poller[ApplicationsClientCreateOrUpdateByIDResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateByID(ctx, applicationID, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientCreateOrUpdateByIDResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationsClientCreateOrUpdateByIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdateByID - Creates or updates a managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +func (client *ApplicationsClient) createOrUpdateByID(ctx context.Context, applicationID string, parameters Application, options *ApplicationsClientBeginCreateOrUpdateByIDOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateByIDCreateRequest(ctx, applicationID, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *ApplicationsClient) createOrUpdateByIDCreateRequest(ctx context.Context, applicationID string, parameters Application, options *ApplicationsClientBeginCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/{applicationId}" + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", applicationID) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the managed application. @@ -126,9 +195,10 @@ func (client *ApplicationsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ApplicationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,18 +209,20 @@ func (client *ApplicationsClient) BeginDelete(ctx context.Context, resourceGroup // // Generated from API version 2021-07-01 func (client *ApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -179,6 +251,66 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou return req, nil } +// BeginDeleteByID - Deletes the managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - applicationID - The fully qualified ID of the managed application, including the managed application name and the managed +// application resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} +// - options - ApplicationsClientBeginDeleteByIDOptions contains the optional parameters for the ApplicationsClient.BeginDeleteByID +// method. +func (client *ApplicationsClient) BeginDeleteByID(ctx context.Context, applicationID string, options *ApplicationsClientBeginDeleteByIDOptions) (*runtime.Poller[ApplicationsClientDeleteByIDResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteByID(ctx, applicationID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientDeleteByIDResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationsClientDeleteByIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// DeleteByID - Deletes the managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +func (client *ApplicationsClient) deleteByID(ctx context.Context, applicationID string, options *ApplicationsClientBeginDeleteByIDOptions) (*http.Response, error) { + var err error + req, err := client.deleteByIDCreateRequest(ctx, applicationID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *ApplicationsClient) deleteByIDCreateRequest(ctx context.Context, applicationID string, options *ApplicationsClientBeginDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{applicationId}" + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", applicationID) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Get - Gets the managed application. // If the operation fails it returns an *azcore.ResponseError type. // @@ -187,18 +319,21 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou // - applicationName - The name of the managed application. // - options - ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. func (client *ApplicationsClient) Get(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientGetOptions) (ApplicationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, applicationName, options) if err != nil { return ApplicationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -236,6 +371,56 @@ func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (Applic return result, nil } +// GetByID - Gets the managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - applicationID - The fully qualified ID of the managed application, including the managed application name and the managed +// application resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} +// - options - ApplicationsClientGetByIDOptions contains the optional parameters for the ApplicationsClient.GetByID method. +func (client *ApplicationsClient) GetByID(ctx context.Context, applicationID string, options *ApplicationsClientGetByIDOptions) (ApplicationsClientGetByIDResponse, error) { + var err error + req, err := client.getByIDCreateRequest(ctx, applicationID, options) + if err != nil { + return ApplicationsClientGetByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientGetByIDResponse{}, err + } + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ApplicationsClient) getByIDCreateRequest(ctx context.Context, applicationID string, options *ApplicationsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{applicationId}" + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", applicationID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ApplicationsClient) getByIDHandleResponse(resp *http.Response) (ApplicationsClientGetByIDResponse, error) { + result := ApplicationsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ApplicationsClientGetByIDResponse{}, err + } + return result, nil +} + // ListAllowedUpgradePlans - List allowed upgrade plans for application. // If the operation fails it returns an *azcore.ResponseError type. // @@ -245,18 +430,21 @@ func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (Applic // - options - ApplicationsClientListAllowedUpgradePlansOptions contains the optional parameters for the ApplicationsClient.ListAllowedUpgradePlans // method. func (client *ApplicationsClient) ListAllowedUpgradePlans(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientListAllowedUpgradePlansOptions) (ApplicationsClientListAllowedUpgradePlansResponse, error) { + var err error req, err := client.listAllowedUpgradePlansCreateRequest(ctx, resourceGroupName, applicationName, options) if err != nil { return ApplicationsClientListAllowedUpgradePlansResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationsClientListAllowedUpgradePlansResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationsClientListAllowedUpgradePlansResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientListAllowedUpgradePlansResponse{}, err } - return ApplicationsClientListAllowedUpgradePlansResponse{}, nil + resp, err := client.listAllowedUpgradePlansHandleResponse(httpResp) + return resp, err } // listAllowedUpgradePlansCreateRequest creates the ListAllowedUpgradePlans request. @@ -285,7 +473,16 @@ func (client *ApplicationsClient) listAllowedUpgradePlansCreateRequest(ctx conte return req, nil } -// NewListByResourceGroupPager - Gets all the applications within a resource group. +// listAllowedUpgradePlansHandleResponse handles the ListAllowedUpgradePlans response. +func (client *ApplicationsClient) listAllowedUpgradePlansHandleResponse(resp *http.Response) (ApplicationsClientListAllowedUpgradePlansResponse, error) { + result := ApplicationsClientListAllowedUpgradePlansResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AllowedUpgradePlansResult); err != nil { + return ApplicationsClientListAllowedUpgradePlansResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the applications within a resource group. // // Generated from API version 2021-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. @@ -350,7 +547,7 @@ func (client *ApplicationsClient) listByResourceGroupHandleResponse(resp *http.R return result, nil } -// NewListBySubscriptionPager - Gets all the applications within a subscription. +// NewListBySubscriptionPager - Lists all the applications within a subscription. // // Generated from API version 2021-07-01 // - options - ApplicationsClientListBySubscriptionOptions contains the optional parameters for the ApplicationsClient.NewListBySubscriptionPager @@ -410,6 +607,70 @@ func (client *ApplicationsClient) listBySubscriptionHandleResponse(resp *http.Re return result, nil } +// ListTokens - List tokens for application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - applicationName - The name of the managed application. +// - parameters - Request body parameters to list tokens. +// - options - ApplicationsClientListTokensOptions contains the optional parameters for the ApplicationsClient.ListTokens method. +func (client *ApplicationsClient) ListTokens(ctx context.Context, resourceGroupName string, applicationName string, parameters ListTokenRequest, options *ApplicationsClientListTokensOptions) (ApplicationsClientListTokensResponse, error) { + var err error + req, err := client.listTokensCreateRequest(ctx, resourceGroupName, applicationName, parameters, options) + if err != nil { + return ApplicationsClientListTokensResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientListTokensResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientListTokensResponse{}, err + } + resp, err := client.listTokensHandleResponse(httpResp) + return resp, err +} + +// listTokensCreateRequest creates the ListTokens request. +func (client *ApplicationsClient) listTokensCreateRequest(ctx context.Context, resourceGroupName string, applicationName string, parameters ListTokenRequest, options *ApplicationsClientListTokensOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listTokens" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// listTokensHandleResponse handles the ListTokens response. +func (client *ApplicationsClient) listTokensHandleResponse(resp *http.Response) (ApplicationsClientListTokensResponse, error) { + result := ApplicationsClientListTokensResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedIdentityTokenResult); err != nil { + return ApplicationsClientListTokensResponse{}, err + } + return result, nil +} + // BeginRefreshPermissions - Refresh Permissions for application. // If the operation fails it returns an *azcore.ResponseError type. // @@ -424,7 +685,10 @@ func (client *ApplicationsClient) BeginRefreshPermissions(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[ApplicationsClientRefreshPermissionsResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientRefreshPermissionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ApplicationsClientRefreshPermissionsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -435,18 +699,20 @@ func (client *ApplicationsClient) BeginRefreshPermissions(ctx context.Context, r // // Generated from API version 2021-07-01 func (client *ApplicationsClient) refreshPermissions(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientBeginRefreshPermissionsOptions) (*http.Response, error) { + var err error req, err := client.refreshPermissionsCreateRequest(ctx, resourceGroupName, applicationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // refreshPermissionsCreateRequest creates the RefreshPermissions request. @@ -475,30 +741,52 @@ func (client *ApplicationsClient) refreshPermissionsCreateRequest(ctx context.Co return req, nil } -// Update - Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. +// BeginUpdate - Updates an existing managed application. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationName - The name of the managed application. -// - options - ApplicationsClientUpdateOptions contains the optional parameters for the ApplicationsClient.Update method. -func (client *ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientUpdateOptions) (ApplicationsClientUpdateResponse, error) { +// - options - ApplicationsClientBeginUpdateOptions contains the optional parameters for the ApplicationsClient.BeginUpdate +// method. +func (client *ApplicationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientBeginUpdateOptions) (*runtime.Poller[ApplicationsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, applicationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Updates an existing managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +func (client *ApplicationsClient) update(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationName, options) if err != nil { - return ApplicationsClientUpdateResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ApplicationsClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return ApplicationsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.updateHandleResponse(resp) + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientUpdateOptions) (*policy.Request, error) { +func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, applicationName string, options *ApplicationsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -521,16 +809,150 @@ func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, resou req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { - return req, runtime.MarshalAsJSON(req, *options.Parameters) + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil } return req, nil } -// updateHandleResponse handles the Update response. -func (client *ApplicationsClient) updateHandleResponse(resp *http.Response) (ApplicationsClientUpdateResponse, error) { - result := ApplicationsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { - return ApplicationsClientUpdateResponse{}, err +// BeginUpdateAccess - Update access for application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - applicationName - The name of the managed application. +// - parameters - Request body parameters to list tokens. +// - options - ApplicationsClientBeginUpdateAccessOptions contains the optional parameters for the ApplicationsClient.BeginUpdateAccess +// method. +func (client *ApplicationsClient) BeginUpdateAccess(ctx context.Context, resourceGroupName string, applicationName string, parameters UpdateAccessDefinition, options *ApplicationsClientBeginUpdateAccessOptions) (*runtime.Poller[ApplicationsClientUpdateAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateAccess(ctx, resourceGroupName, applicationName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientUpdateAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationsClientUpdateAccessResponse](options.ResumeToken, client.internal.Pipeline(), nil) } - return result, nil +} + +// UpdateAccess - Update access for application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +func (client *ApplicationsClient) updateAccess(ctx context.Context, resourceGroupName string, applicationName string, parameters UpdateAccessDefinition, options *ApplicationsClientBeginUpdateAccessOptions) (*http.Response, error) { + var err error + req, err := client.updateAccessCreateRequest(ctx, resourceGroupName, applicationName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateAccessCreateRequest creates the UpdateAccess request. +func (client *ApplicationsClient) updateAccessCreateRequest(ctx context.Context, resourceGroupName string, applicationName string, parameters UpdateAccessDefinition, options *ApplicationsClientBeginUpdateAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/updateAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateByID - Updates an existing managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +// - applicationID - The fully qualified ID of the managed application, including the managed application name and the managed +// application resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} +// - options - ApplicationsClientBeginUpdateByIDOptions contains the optional parameters for the ApplicationsClient.BeginUpdateByID +// method. +func (client *ApplicationsClient) BeginUpdateByID(ctx context.Context, applicationID string, options *ApplicationsClientBeginUpdateByIDOptions) (*runtime.Poller[ApplicationsClientUpdateByIDResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateByID(ctx, applicationID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationsClientUpdateByIDResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationsClientUpdateByIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateByID - Updates an existing managed application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-01 +func (client *ApplicationsClient) updateByID(ctx context.Context, applicationID string, options *ApplicationsClientBeginUpdateByIDOptions) (*http.Response, error) { + var err error + req, err := client.updateByIDCreateRequest(ctx, applicationID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateByIDCreateRequest creates the UpdateByID request. +func (client *ApplicationsClient) updateByIDCreateRequest(ctx context.Context, applicationID string, options *ApplicationsClientBeginUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/{applicationId}" + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", applicationID) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil } diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/applications_client_example_test.go b/sdk/resourcemanager/solutions/armmanagedapplications/applications_client_example_test.go deleted file mode 100644 index 725d4d5f432f..000000000000 --- a/sdk/resourcemanager/solutions/armmanagedapplications/applications_client_example_test.go +++ /dev/null @@ -1,256 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmanagedapplications_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplication.json -func ExampleApplicationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().Get(ctx, "rg", "myManagedApplication", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Application = armmanagedapplications.Application{ - // Name: to.Ptr("myManagedApplication"), - // Type: to.Ptr("Microsoft.Solutions/applications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication"), - // Kind: to.Ptr("ServiceCatalog"), - // Properties: &armmanagedapplications.ApplicationProperties{ - // ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/managedApplicationDefinitions/myAppDef"), - // Artifacts: []*armmanagedapplications.ApplicationArtifact{ - // }, - // Authorizations: []*armmanagedapplications.ApplicationAuthorization{ - // { - // PrincipalID: to.Ptr("validprincipalguid"), - // RoleDefinitionID: to.Ptr("validroleguid"), - // }}, - // CreatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("ClientApplicationId"), - // Oid: to.Ptr("ClientOid"), - // Puid: to.Ptr("ClientPuid"), - // }, - // ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - // ManagementMode: to.Ptr(armmanagedapplications.ApplicationManagementModeManaged), - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // UpdatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("ClientApplicationId"), - // Oid: to.Ptr("ClientOid"), - // Puid: to.Ptr("ClientPuid"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplication.json -func ExampleApplicationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationsClient().BeginDelete(ctx, "rg", "myManagedApplication", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplication.json -func ExampleApplicationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationsClient().BeginCreateOrUpdate(ctx, "rg", "myManagedApplication", armmanagedapplications.Application{ - Kind: to.Ptr("ServiceCatalog"), - Properties: &armmanagedapplications.ApplicationProperties{ - ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), - ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Application = armmanagedapplications.Application{ - // Name: to.Ptr("myManagedApplication"), - // Type: to.Ptr("Microsoft.Solutions/applications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication"), - // Kind: to.Ptr("ServiceCatalog"), - // Properties: &armmanagedapplications.ApplicationProperties{ - // ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), - // ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplication.json -func ExampleApplicationsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().Update(ctx, "rg", "myManagedApplication", &armmanagedapplications.ApplicationsClientUpdateOptions{Parameters: &armmanagedapplications.ApplicationPatchable{ - Kind: to.Ptr("ServiceCatalog"), - Properties: &armmanagedapplications.ApplicationProperties{ - ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), - ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Application = armmanagedapplications.Application{ - // Name: to.Ptr("myManagedApplication"), - // Type: to.Ptr("Microsoft.Solutions/applications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication"), - // Kind: to.Ptr("ServiceCatalog"), - // Properties: &armmanagedapplications.ApplicationProperties{ - // ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), - // ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json -func ExampleApplicationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationsClient().NewListByResourceGroupPager("rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationListResult = armmanagedapplications.ApplicationListResult{ - // Value: []*armmanagedapplications.Application{ - // { - // Name: to.Ptr("myManagedApplication"), - // Type: to.Ptr("Microsoft.Solutions/applications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication"), - // Kind: to.Ptr("ServiceCatalog"), - // Properties: &armmanagedapplications.ApplicationProperties{ - // ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/managedApplicationDefinitions/myAppDef"), - // ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("myManagedApplication2"), - // Type: to.Ptr("Microsoft.Solutions/applications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication2"), - // Kind: to.Ptr("ServiceCatalog"), - // Properties: &armmanagedapplications.ApplicationProperties{ - // ApplicationDefinitionID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/managedApplicationDefinitions/myAppDef2"), - // ManagedResourceGroupID: to.Ptr("/subscriptions/subid/resourceGroups/myManagedRG"), - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/refreshApplicationPermissions.json -func ExampleApplicationsClient_BeginRefreshPermissions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationsClient().BeginRefreshPermissions(ctx, "rg", "myManagedApplication", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listAllowedUpgradePlans.json -func ExampleApplicationsClient_ListAllowedUpgradePlans() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewApplicationsClient().ListAllowedUpgradePlans(ctx, "rg", "myManagedApplication", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/autorest.md b/sdk/resourcemanager/solutions/armmanagedapplications/autorest.md index b14abef505c4..59b31ed3cc39 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/autorest.md +++ b/sdk/resourcemanager/solutions/armmanagedapplications/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/solutions/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/solutions/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/client_factory.go b/sdk/resourcemanager/solutions/armmanagedapplications/client_factory.go index 8cc19fbfba8f..f1c2cd5ddc50 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/client_factory.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications @@ -43,13 +42,13 @@ func (c *ClientFactory) NewApplicationClient() *ApplicationClient { return subClient } -func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { - subClient, _ := NewApplicationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewApplicationDefinitionsClient() *ApplicationDefinitionsClient { + subClient, _ := NewApplicationDefinitionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewApplicationDefinitionsClient() *ApplicationDefinitionsClient { - subClient, _ := NewApplicationDefinitionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { + subClient, _ := NewApplicationsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/constants.go b/sdk/resourcemanager/solutions/armmanagedapplications/constants.go index e6343f99c359..0869ac34ea24 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/constants.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications const ( moduleName = "armmanagedapplications" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -52,17 +51,17 @@ func PossibleApplicationArtifactNameValues() []ApplicationArtifactName { type ApplicationArtifactType string const ( + ApplicationArtifactTypeCustom ApplicationArtifactType = "Custom" ApplicationArtifactTypeNotSpecified ApplicationArtifactType = "NotSpecified" ApplicationArtifactTypeTemplate ApplicationArtifactType = "Template" - ApplicationArtifactTypeCustom ApplicationArtifactType = "Custom" ) // PossibleApplicationArtifactTypeValues returns the possible values for the ApplicationArtifactType const type. func PossibleApplicationArtifactTypeValues() []ApplicationArtifactType { return []ApplicationArtifactType{ + ApplicationArtifactTypeCustom, ApplicationArtifactTypeNotSpecified, ApplicationArtifactTypeTemplate, - ApplicationArtifactTypeCustom, } } @@ -91,16 +90,16 @@ type ApplicationLockLevel string const ( ApplicationLockLevelCanNotDelete ApplicationLockLevel = "CanNotDelete" - ApplicationLockLevelReadOnly ApplicationLockLevel = "ReadOnly" ApplicationLockLevelNone ApplicationLockLevel = "None" + ApplicationLockLevelReadOnly ApplicationLockLevel = "ReadOnly" ) // PossibleApplicationLockLevelValues returns the possible values for the ApplicationLockLevel const type. func PossibleApplicationLockLevelValues() []ApplicationLockLevel { return []ApplicationLockLevel{ ApplicationLockLevelCanNotDelete, - ApplicationLockLevelReadOnly, ApplicationLockLevelNone, + ApplicationLockLevelReadOnly, } } @@ -293,18 +292,60 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ResourceIdentityType string const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ) // PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. func PossibleResourceIdentityTypeValues() []ResourceIdentityType { return []ResourceIdentityType{ + ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, - ResourceIdentityTypeNone, + ResourceIdentityTypeUserAssigned, + } +} + +// Status - The JIT status. +type Status string + +const ( + StatusElevate Status = "Elevate" + StatusNotSpecified Status = "NotSpecified" + StatusRemove Status = "Remove" +) + +// PossibleStatusValues returns the possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ + StatusElevate, + StatusNotSpecified, + StatusRemove, + } +} + +// Substatus - The sub status. +type Substatus string + +const ( + SubstatusApproved Substatus = "Approved" + SubstatusDenied Substatus = "Denied" + SubstatusExpired Substatus = "Expired" + SubstatusFailed Substatus = "Failed" + SubstatusNotSpecified Substatus = "NotSpecified" + SubstatusTimeout Substatus = "Timeout" +) + +// PossibleSubstatusValues returns the possible values for the Substatus const type. +func PossibleSubstatusValues() []Substatus { + return []Substatus{ + SubstatusApproved, + SubstatusDenied, + SubstatusExpired, + SubstatusFailed, + SubstatusNotSpecified, + SubstatusTimeout, } } diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/go.mod b/sdk/resourcemanager/solutions/armmanagedapplications/go.mod index 21bbac300812..2572701710fc 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/go.mod +++ b/sdk/resourcemanager/solutions/armmanagedapplications/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/go.sum b/sdk/resourcemanager/solutions/armmanagedapplications/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/go.sum +++ b/sdk/resourcemanager/solutions/armmanagedapplications/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client.go b/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client.go index f1bedab17f02..601f268e6c12 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications @@ -59,9 +58,10 @@ func (client *JitRequestsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JitRequestsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JitRequestsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[JitRequestsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +72,20 @@ func (client *JitRequestsClient) BeginCreateOrUpdate(ctx context.Context, resour // // Generated from API version 2021-07-01 func (client *JitRequestsClient) createOrUpdate(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestDefinition, options *JitRequestsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, jitRequestName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,7 +111,10 @@ func (client *JitRequestsClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2021-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Delete - Deletes the JIT request. @@ -120,16 +125,18 @@ func (client *JitRequestsClient) createOrUpdateCreateRequest(ctx context.Context // - jitRequestName - The name of the JIT request. // - options - JitRequestsClientDeleteOptions contains the optional parameters for the JitRequestsClient.Delete method. func (client *JitRequestsClient) Delete(ctx context.Context, resourceGroupName string, jitRequestName string, options *JitRequestsClientDeleteOptions) (JitRequestsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, jitRequestName, options) if err != nil { return JitRequestsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JitRequestsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return JitRequestsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return JitRequestsClientDeleteResponse{}, err } return JitRequestsClientDeleteResponse{}, nil } @@ -168,18 +175,21 @@ func (client *JitRequestsClient) deleteCreateRequest(ctx context.Context, resour // - jitRequestName - The name of the JIT request. // - options - JitRequestsClientGetOptions contains the optional parameters for the JitRequestsClient.Get method. func (client *JitRequestsClient) Get(ctx context.Context, resourceGroupName string, jitRequestName string, options *JitRequestsClientGetOptions) (JitRequestsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, jitRequestName, options) if err != nil { return JitRequestsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JitRequestsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JitRequestsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return JitRequestsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -217,7 +227,7 @@ func (client *JitRequestsClient) getHandleResponse(resp *http.Response) (JitRequ return result, nil } -// ListByResourceGroup - Retrieves all JIT requests within the resource group. +// ListByResourceGroup - Lists all JIT requests within the resource group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 @@ -225,18 +235,21 @@ func (client *JitRequestsClient) getHandleResponse(resp *http.Response) (JitRequ // - options - JitRequestsClientListByResourceGroupOptions contains the optional parameters for the JitRequestsClient.ListByResourceGroup // method. func (client *JitRequestsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, options *JitRequestsClientListByResourceGroupOptions) (JitRequestsClientListByResourceGroupResponse, error) { + var err error req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) if err != nil { return JitRequestsClientListByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JitRequestsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JitRequestsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JitRequestsClientListByResourceGroupResponse{}, err } - return client.listByResourceGroupHandleResponse(resp) + resp, err := client.listByResourceGroupHandleResponse(httpResp) + return resp, err } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -270,25 +283,28 @@ func (client *JitRequestsClient) listByResourceGroupHandleResponse(resp *http.Re return result, nil } -// ListBySubscription - Retrieves all JIT requests within the subscription. +// ListBySubscription - Lists all JIT requests within the subscription. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2021-07-01 // - options - JitRequestsClientListBySubscriptionOptions contains the optional parameters for the JitRequestsClient.ListBySubscription // method. func (client *JitRequestsClient) ListBySubscription(ctx context.Context, options *JitRequestsClientListBySubscriptionOptions) (JitRequestsClientListBySubscriptionResponse, error) { + var err error req, err := client.listBySubscriptionCreateRequest(ctx, options) if err != nil { return JitRequestsClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JitRequestsClientListBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JitRequestsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JitRequestsClientListBySubscriptionResponse{}, err } - return client.listBySubscriptionHandleResponse(resp) + resp, err := client.listBySubscriptionHandleResponse(httpResp) + return resp, err } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -327,18 +343,21 @@ func (client *JitRequestsClient) listBySubscriptionHandleResponse(resp *http.Res // - parameters - Parameters supplied to the update JIT request. // - options - JitRequestsClientUpdateOptions contains the optional parameters for the JitRequestsClient.Update method. func (client *JitRequestsClient) Update(ctx context.Context, resourceGroupName string, jitRequestName string, parameters JitRequestPatchable, options *JitRequestsClientUpdateOptions) (JitRequestsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, jitRequestName, parameters, options) if err != nil { return JitRequestsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JitRequestsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JitRequestsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JitRequestsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -364,7 +383,10 @@ func (client *JitRequestsClient) updateCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2021-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client_example_test.go b/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client_example_test.go deleted file mode 100644 index 896a2e62f2c7..000000000000 --- a/sdk/resourcemanager/solutions/armmanagedapplications/jitrequests_client_example_test.go +++ /dev/null @@ -1,283 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmanagedapplications_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getJitRequest.json -func ExampleJitRequestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJitRequestsClient().Get(ctx, "rg", "myJitRequest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JitRequestDefinition = armmanagedapplications.JitRequestDefinition{ - // Name: to.Ptr("myJitRequest"), - // Type: to.Ptr("Microsoft.Solutions/jitRequests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/jitRequests/myJitRequest"), - // Properties: &armmanagedapplications.JitRequestProperties{ - // ApplicationResourceID: to.Ptr("/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158"), - // CreatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // JitAuthorizationPolicies: []*armmanagedapplications.JitAuthorizationPolicies{ - // { - // PrincipalID: to.Ptr("1db8e132e2934dbcb8e1178a61319491"), - // RoleDefinitionID: to.Ptr("ecd05a23-931a-4c38-a52b-ac7c4c583334"), - // }}, - // JitRequestState: to.Ptr(armmanagedapplications.JitRequestStatePending), - // JitSchedulingPolicy: &armmanagedapplications.JitSchedulingPolicy{ - // Type: to.Ptr(armmanagedapplications.JitSchedulingTypeOnce), - // Duration: to.Ptr("PT8H"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-22T05:48:30.6661804Z"); return t}()), - // }, - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // UpdatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateJitRequest.json -func ExampleJitRequestsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewJitRequestsClient().BeginCreateOrUpdate(ctx, "rg", "myJitRequest", armmanagedapplications.JitRequestDefinition{ - Properties: &armmanagedapplications.JitRequestProperties{ - ApplicationResourceID: to.Ptr("/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158"), - JitAuthorizationPolicies: []*armmanagedapplications.JitAuthorizationPolicies{ - { - PrincipalID: to.Ptr("1db8e132e2934dbcb8e1178a61319491"), - RoleDefinitionID: to.Ptr("ecd05a23-931a-4c38-a52b-ac7c4c583334"), - }}, - JitSchedulingPolicy: &armmanagedapplications.JitSchedulingPolicy{ - Type: to.Ptr(armmanagedapplications.JitSchedulingTypeOnce), - Duration: to.Ptr("PT8H"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-22T05:48:30.6661804Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JitRequestDefinition = armmanagedapplications.JitRequestDefinition{ - // Name: to.Ptr("myJitRequest"), - // Type: to.Ptr("Microsoft.Solutions/jitRequests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/jitRequests/myJitRequest"), - // Properties: &armmanagedapplications.JitRequestProperties{ - // ApplicationResourceID: to.Ptr("/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158"), - // CreatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // JitAuthorizationPolicies: []*armmanagedapplications.JitAuthorizationPolicies{ - // { - // PrincipalID: to.Ptr("1db8e132e2934dbcb8e1178a61319491"), - // RoleDefinitionID: to.Ptr("ecd05a23-931a-4c38-a52b-ac7c4c583334"), - // }}, - // JitRequestState: to.Ptr(armmanagedapplications.JitRequestStatePending), - // JitSchedulingPolicy: &armmanagedapplications.JitSchedulingPolicy{ - // Type: to.Ptr(armmanagedapplications.JitSchedulingTypeOnce), - // Duration: to.Ptr("PT8H"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-22T05:48:30.6661804Z"); return t}()), - // }, - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // UpdatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateJitRequest.json -func ExampleJitRequestsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJitRequestsClient().Update(ctx, "rg", "myJitRequest", armmanagedapplications.JitRequestPatchable{ - Tags: map[string]*string{ - "department": to.Ptr("Finance"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JitRequestDefinition = armmanagedapplications.JitRequestDefinition{ - // Name: to.Ptr("myJitRequest"), - // Type: to.Ptr("Microsoft.Solutions/jitRequests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/jitRequests/myJitRequest"), - // Properties: &armmanagedapplications.JitRequestProperties{ - // ApplicationResourceID: to.Ptr("/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158"), - // CreatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // JitAuthorizationPolicies: []*armmanagedapplications.JitAuthorizationPolicies{ - // { - // PrincipalID: to.Ptr("1db8e132e2934dbcb8e1178a61319491"), - // RoleDefinitionID: to.Ptr("ecd05a23-931a-4c38-a52b-ac7c4c583334"), - // }}, - // JitRequestState: to.Ptr(armmanagedapplications.JitRequestStatePending), - // JitSchedulingPolicy: &armmanagedapplications.JitSchedulingPolicy{ - // Type: to.Ptr(armmanagedapplications.JitSchedulingTypeOnce), - // Duration: to.Ptr("PT8H"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-22T05:48:30.6661804Z"); return t}()), - // }, - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // UpdatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteJitRequest.json -func ExampleJitRequestsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJitRequestsClient().Delete(ctx, "rg", "myJitRequest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json -func ExampleJitRequestsClient_ListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmanagedapplications.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJitRequestsClient().ListBySubscription(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JitRequestDefinitionListResult = armmanagedapplications.JitRequestDefinitionListResult{ - // Value: []*armmanagedapplications.JitRequestDefinition{ - // { - // Name: to.Ptr("myJitRequest"), - // Type: to.Ptr("Microsoft.Solutions/jitRequests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/jitRequests/myJitRequest"), - // Properties: &armmanagedapplications.JitRequestProperties{ - // ApplicationResourceID: to.Ptr("/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158"), - // CreatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // JitAuthorizationPolicies: []*armmanagedapplications.JitAuthorizationPolicies{ - // { - // PrincipalID: to.Ptr("1db8e132e2934dbcb8e1178a61319491"), - // RoleDefinitionID: to.Ptr("ecd05a23-931a-4c38-a52b-ac7c4c583334"), - // }}, - // JitRequestState: to.Ptr(armmanagedapplications.JitRequestStatePending), - // JitSchedulingPolicy: &armmanagedapplications.JitSchedulingPolicy{ - // Type: to.Ptr(armmanagedapplications.JitSchedulingTypeOnce), - // Duration: to.Ptr("PT8H"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-22T05:48:30.6661804Z"); return t}()), - // }, - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // UpdatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // }, - // }, - // { - // Name: to.Ptr("myJitRequest2"), - // Type: to.Ptr("Microsoft.Solutions/jitRequests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/jitRequests/myJitRequest2"), - // Properties: &armmanagedapplications.JitRequestProperties{ - // ApplicationResourceID: to.Ptr("/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158"), - // CreatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // JitAuthorizationPolicies: []*armmanagedapplications.JitAuthorizationPolicies{ - // { - // PrincipalID: to.Ptr("1db8e132e2934dbcb8e1178a61319491"), - // RoleDefinitionID: to.Ptr("ecd05a23-931a-4c38-a52b-ac7c4c583334"), - // }}, - // JitRequestState: to.Ptr(armmanagedapplications.JitRequestStatePending), - // JitSchedulingPolicy: &armmanagedapplications.JitSchedulingPolicy{ - // Type: to.Ptr(armmanagedapplications.JitSchedulingTypeOnce), - // Duration: to.Ptr("PT8H"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-22T05:48:30.6661804Z"); return t}()), - // }, - // ProvisioningState: to.Ptr(armmanagedapplications.ProvisioningStateSucceeded), - // UpdatedBy: &armmanagedapplications.ApplicationClientDetails{ - // ApplicationID: to.Ptr("33a83f1f-c363-4ae7-9e0a-a0c08466354d"), - // Oid: to.Ptr(""), - // }, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/models.go b/sdk/resourcemanager/solutions/armmanagedapplications/models.go index 90179181732b..84f2e1aedf91 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/models.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/models.go @@ -3,14 +3,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications import "time" +// AllowedUpgradePlansResult - The array of plan. +type AllowedUpgradePlansResult struct { + // The array of plans. + Value []*Plan +} + // Application - Information about managed application. type Application struct { // REQUIRED; The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. @@ -92,12 +97,6 @@ type ApplicationClientDetails struct { Puid *string } -// ApplicationClientListOperationsOptions contains the optional parameters for the ApplicationClient.NewListOperationsPager -// method. -type ApplicationClientListOperationsOptions struct { - // placeholder for future optional parameters -} - // ApplicationDefinition - Information about managed application definition. type ApplicationDefinition struct { // REQUIRED; The managed application definition properties. @@ -204,46 +203,6 @@ type ApplicationDefinitionProperties struct { // The storage account id for bring your own storage scenario. StorageAccountID *string - - // READ-ONLY; Provisioning state. - ProvisioningState *ProvisioningState -} - -// ApplicationDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.BeginCreateOrUpdate -// method. -type ApplicationDefinitionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ApplicationDefinitionsClientBeginDeleteOptions contains the optional parameters for the ApplicationDefinitionsClient.BeginDelete -// method. -type ApplicationDefinitionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ApplicationDefinitionsClientGetOptions contains the optional parameters for the ApplicationDefinitionsClient.Get method. -type ApplicationDefinitionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ApplicationDefinitionsClientListByResourceGroupOptions contains the optional parameters for the ApplicationDefinitionsClient.NewListByResourceGroupPager -// method. -type ApplicationDefinitionsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ApplicationDefinitionsClientListBySubscriptionOptions contains the optional parameters for the ApplicationDefinitionsClient.NewListBySubscriptionPager -// method. -type ApplicationDefinitionsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ApplicationDefinitionsClientUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.Update -// method. -type ApplicationDefinitionsClientUpdateOptions struct { - // placeholder for future optional parameters } // ApplicationDeploymentPolicy - Managed application deployment policy. @@ -423,73 +382,6 @@ type ApplicationProperties struct { UpdatedBy *ApplicationClientDetails } -// ApplicationPropertiesPatchable - The managed application properties. -type ApplicationPropertiesPatchable struct { - // The fully qualified path of managed application definition Id. - ApplicationDefinitionID *string - - // The managed resource group Id. - ManagedResourceGroupID *string - - // Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. - Parameters any - - // READ-ONLY; Name and value pairs that define the managed application outputs. - Outputs any - - // READ-ONLY; The managed application provisioning state. - ProvisioningState *ProvisioningState -} - -// ApplicationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.BeginCreateOrUpdate -// method. -type ApplicationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ApplicationsClientBeginDeleteOptions contains the optional parameters for the ApplicationsClient.BeginDelete method. -type ApplicationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ApplicationsClientBeginRefreshPermissionsOptions contains the optional parameters for the ApplicationsClient.BeginRefreshPermissions -// method. -type ApplicationsClientBeginRefreshPermissionsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. -type ApplicationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientListAllowedUpgradePlansOptions contains the optional parameters for the ApplicationsClient.ListAllowedUpgradePlans -// method. -type ApplicationsClientListAllowedUpgradePlansOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientListByResourceGroupOptions contains the optional parameters for the ApplicationsClient.NewListByResourceGroupPager -// method. -type ApplicationsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientListBySubscriptionOptions contains the optional parameters for the ApplicationsClient.NewListBySubscriptionPager -// method. -type ApplicationsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientUpdateOptions contains the optional parameters for the ApplicationsClient.Update method. -type ApplicationsClientUpdateOptions struct { - // Parameters supplied to update an existing managed application. - Parameters *ApplicationPatchable -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -622,6 +514,21 @@ type JitRequestDefinitionListResult struct { Value []*JitRequestDefinition } +// JitRequestMetadata - The JIT request metadata. +type JitRequestMetadata struct { + // The origin request id. + OriginRequestID *string + + // The requestor id. + RequestorID *string + + // The subject display name. + SubjectDisplayName *string + + // The publisher's tenant name. + TenantDisplayName *string +} + // JitRequestPatchable - Information about JIT request. type JitRequestPatchable struct { // Jit request tags @@ -655,40 +562,6 @@ type JitRequestProperties struct { UpdatedBy *ApplicationClientDetails } -// JitRequestsClientBeginCreateOrUpdateOptions contains the optional parameters for the JitRequestsClient.BeginCreateOrUpdate -// method. -type JitRequestsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// JitRequestsClientDeleteOptions contains the optional parameters for the JitRequestsClient.Delete method. -type JitRequestsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// JitRequestsClientGetOptions contains the optional parameters for the JitRequestsClient.Get method. -type JitRequestsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JitRequestsClientListByResourceGroupOptions contains the optional parameters for the JitRequestsClient.ListByResourceGroup -// method. -type JitRequestsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// JitRequestsClientListBySubscriptionOptions contains the optional parameters for the JitRequestsClient.ListBySubscription -// method. -type JitRequestsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// JitRequestsClientUpdateOptions contains the optional parameters for the JitRequestsClient.Update method. -type JitRequestsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // JitSchedulingPolicy - The JIT scheduling policies. type JitSchedulingPolicy struct { // REQUIRED; The required duration of the JIT request. @@ -701,6 +574,45 @@ type JitSchedulingPolicy struct { Type *JitSchedulingType } +// ListTokenRequest - List token request body. +type ListTokenRequest struct { + // The authorization audience. + AuthorizationAudience *string + + // The user assigned identities. + UserAssignedIdentities []*string +} + +// ManagedIdentityToken - The managed identity token for the managed app resource. +type ManagedIdentityToken struct { + // The requested access token. + AccessToken *string + + // The aud (audience) the access token was request for. This is the same as what was provided in the listTokens request. + AuthorizationAudience *string + + // The number of seconds the access token will be valid. + ExpiresIn *string + + // The timespan when the access token expires. This is represented as the number of seconds from epoch. + ExpiresOn *string + + // The timespan when the access token takes effect. This is represented as the number of seconds from epoch. + NotBefore *string + + // The Azure resource ID for the issued token. This is either the managed application ID or the user-assigned identity ID. + ResourceID *string + + // The type of the token. + TokenType *string +} + +// ManagedIdentityTokenResult - The array of managed identity tokens. +type ManagedIdentityTokenResult struct { + // The array of managed identity tokens. + Value []*ManagedIdentityToken +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -849,6 +761,21 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// UpdateAccessDefinition - Update access request definition. +type UpdateAccessDefinition struct { + // REQUIRED; The JIT request metadata. + Metadata *JitRequestMetadata + + // REQUIRED; The JIT status. + Status *Status + + // REQUIRED; The JIT status. + SubStatus *Substatus + + // The approver name. + Approver *string +} + // UserAssignedResourceIdentity - Represents the user assigned identity that is contained within the UserAssignedIdentities // dictionary on ResourceIdentity type UserAssignedResourceIdentity struct { diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/models_serde.go b/sdk/resourcemanager/solutions/armmanagedapplications/models_serde.go index e0180a31ff5a..1ddfed9594f9 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/models_serde.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications @@ -16,6 +15,33 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AllowedUpgradePlansResult. +func (a AllowedUpgradePlansResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedUpgradePlansResult. +func (a *AllowedUpgradePlansResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Application. func (a Application) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -384,7 +410,6 @@ func (a ApplicationDefinitionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "notificationPolicy", a.NotificationPolicy) populate(objectMap, "packageFileUri", a.PackageFileURI) populate(objectMap, "policies", a.Policies) - populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "storageAccountId", a.StorageAccountID) return json.Marshal(objectMap) } @@ -440,9 +465,6 @@ func (a *ApplicationDefinitionProperties) UnmarshalJSON(data []byte) error { case "policies": err = unpopulate(val, "Policies", &a.Policies) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) case "storageAccountId": err = unpopulate(val, "StorageAccountID", &a.StorageAccountID) delete(rawMsg, key) @@ -918,49 +940,6 @@ func (a *ApplicationProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ApplicationPropertiesPatchable. -func (a ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "applicationDefinitionId", a.ApplicationDefinitionID) - populate(objectMap, "managedResourceGroupId", a.ManagedResourceGroupID) - populateAny(objectMap, "outputs", a.Outputs) - populateAny(objectMap, "parameters", a.Parameters) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPropertiesPatchable. -func (a *ApplicationPropertiesPatchable) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "applicationDefinitionId": - err = unpopulate(val, "ApplicationDefinitionID", &a.ApplicationDefinitionID) - delete(rawMsg, key) - case "managedResourceGroupId": - err = unpopulate(val, "ManagedResourceGroupID", &a.ManagedResourceGroupID) - delete(rawMsg, key) - case "outputs": - err = unpopulate(val, "Outputs", &a.Outputs) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, "Parameters", &a.Parameters) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1304,6 +1283,45 @@ func (j *JitRequestDefinitionListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type JitRequestMetadata. +func (j JitRequestMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "originRequestId", j.OriginRequestID) + populate(objectMap, "requestorId", j.RequestorID) + populate(objectMap, "subjectDisplayName", j.SubjectDisplayName) + populate(objectMap, "tenantDisplayName", j.TenantDisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitRequestMetadata. +func (j *JitRequestMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "originRequestId": + err = unpopulate(val, "OriginRequestID", &j.OriginRequestID) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &j.RequestorID) + delete(rawMsg, key) + case "subjectDisplayName": + err = unpopulate(val, "SubjectDisplayName", &j.SubjectDisplayName) + delete(rawMsg, key) + case "tenantDisplayName": + err = unpopulate(val, "TenantDisplayName", &j.TenantDisplayName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type JitRequestPatchable. func (j JitRequestPatchable) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1421,6 +1439,115 @@ func (j *JitSchedulingPolicy) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ListTokenRequest. +func (l ListTokenRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizationAudience", l.AuthorizationAudience) + populate(objectMap, "userAssignedIdentities", l.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListTokenRequest. +func (l *ListTokenRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationAudience": + err = unpopulate(val, "AuthorizationAudience", &l.AuthorizationAudience) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &l.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentityToken. +func (m ManagedIdentityToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessToken", m.AccessToken) + populate(objectMap, "authorizationAudience", m.AuthorizationAudience) + populate(objectMap, "expiresIn", m.ExpiresIn) + populate(objectMap, "expiresOn", m.ExpiresOn) + populate(objectMap, "notBefore", m.NotBefore) + populate(objectMap, "resourceId", m.ResourceID) + populate(objectMap, "tokenType", m.TokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentityToken. +func (m *ManagedIdentityToken) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessToken": + err = unpopulate(val, "AccessToken", &m.AccessToken) + delete(rawMsg, key) + case "authorizationAudience": + err = unpopulate(val, "AuthorizationAudience", &m.AuthorizationAudience) + delete(rawMsg, key) + case "expiresIn": + err = unpopulate(val, "ExpiresIn", &m.ExpiresIn) + delete(rawMsg, key) + case "expiresOn": + err = unpopulate(val, "ExpiresOn", &m.ExpiresOn) + delete(rawMsg, key) + case "notBefore": + err = unpopulate(val, "NotBefore", &m.NotBefore) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &m.ResourceID) + delete(rawMsg, key) + case "tokenType": + err = unpopulate(val, "TokenType", &m.TokenType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentityTokenResult. +func (m ManagedIdentityTokenResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentityTokenResult. +func (m *ManagedIdentityTokenResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1761,6 +1888,45 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UpdateAccessDefinition. +func (u UpdateAccessDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "approver", u.Approver) + populate(objectMap, "metadata", u.Metadata) + populate(objectMap, "status", u.Status) + populate(objectMap, "subStatus", u.SubStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateAccessDefinition. +func (u *UpdateAccessDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "approver": + err = unpopulate(val, "Approver", &u.Approver) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &u.Metadata) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &u.Status) + delete(rawMsg, key) + case "subStatus": + err = unpopulate(val, "SubStatus", &u.SubStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UserAssignedResourceIdentity. func (u UserAssignedResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/options.go b/sdk/resourcemanager/solutions/armmanagedapplications/options.go new file mode 100644 index 000000000000..6830942bebc2 --- /dev/null +++ b/sdk/resourcemanager/solutions/armmanagedapplications/options.go @@ -0,0 +1,199 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmanagedapplications + +// ApplicationClientListOperationsOptions contains the optional parameters for the ApplicationClient.NewListOperationsPager +// method. +type ApplicationClientListOperationsOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.CreateOrUpdateByID +// method. +type ApplicationDefinitionsClientCreateOrUpdateByIDOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.CreateOrUpdate +// method. +type ApplicationDefinitionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientDeleteByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.DeleteByID +// method. +type ApplicationDefinitionsClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientDeleteOptions contains the optional parameters for the ApplicationDefinitionsClient.Delete +// method. +type ApplicationDefinitionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientGetByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.GetByID +// method. +type ApplicationDefinitionsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientGetOptions contains the optional parameters for the ApplicationDefinitionsClient.Get method. +type ApplicationDefinitionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientListByResourceGroupOptions contains the optional parameters for the ApplicationDefinitionsClient.NewListByResourceGroupPager +// method. +type ApplicationDefinitionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientListBySubscriptionOptions contains the optional parameters for the ApplicationDefinitionsClient.NewListBySubscriptionPager +// method. +type ApplicationDefinitionsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientUpdateByIDOptions contains the optional parameters for the ApplicationDefinitionsClient.UpdateByID +// method. +type ApplicationDefinitionsClientUpdateByIDOptions struct { + // placeholder for future optional parameters +} + +// ApplicationDefinitionsClientUpdateOptions contains the optional parameters for the ApplicationDefinitionsClient.Update +// method. +type ApplicationDefinitionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientBeginCreateOrUpdateByIDOptions contains the optional parameters for the ApplicationsClient.BeginCreateOrUpdateByID +// method. +type ApplicationsClientBeginCreateOrUpdateByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.BeginCreateOrUpdate +// method. +type ApplicationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginDeleteByIDOptions contains the optional parameters for the ApplicationsClient.BeginDeleteByID method. +type ApplicationsClientBeginDeleteByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginDeleteOptions contains the optional parameters for the ApplicationsClient.BeginDelete method. +type ApplicationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginRefreshPermissionsOptions contains the optional parameters for the ApplicationsClient.BeginRefreshPermissions +// method. +type ApplicationsClientBeginRefreshPermissionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginUpdateAccessOptions contains the optional parameters for the ApplicationsClient.BeginUpdateAccess +// method. +type ApplicationsClientBeginUpdateAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginUpdateByIDOptions contains the optional parameters for the ApplicationsClient.BeginUpdateByID method. +type ApplicationsClientBeginUpdateByIDOptions struct { + // Parameters supplied to update an existing managed application. + Parameters *ApplicationPatchable + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientBeginUpdateOptions contains the optional parameters for the ApplicationsClient.BeginUpdate method. +type ApplicationsClientBeginUpdateOptions struct { + // Parameters supplied to update an existing managed application. + Parameters *ApplicationPatchable + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationsClientGetByIDOptions contains the optional parameters for the ApplicationsClient.GetByID method. +type ApplicationsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. +type ApplicationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListAllowedUpgradePlansOptions contains the optional parameters for the ApplicationsClient.ListAllowedUpgradePlans +// method. +type ApplicationsClientListAllowedUpgradePlansOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListByResourceGroupOptions contains the optional parameters for the ApplicationsClient.NewListByResourceGroupPager +// method. +type ApplicationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListBySubscriptionOptions contains the optional parameters for the ApplicationsClient.NewListBySubscriptionPager +// method. +type ApplicationsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListTokensOptions contains the optional parameters for the ApplicationsClient.ListTokens method. +type ApplicationsClientListTokensOptions struct { + // placeholder for future optional parameters +} + +// JitRequestsClientBeginCreateOrUpdateOptions contains the optional parameters for the JitRequestsClient.BeginCreateOrUpdate +// method. +type JitRequestsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JitRequestsClientDeleteOptions contains the optional parameters for the JitRequestsClient.Delete method. +type JitRequestsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// JitRequestsClientGetOptions contains the optional parameters for the JitRequestsClient.Get method. +type JitRequestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JitRequestsClientListByResourceGroupOptions contains the optional parameters for the JitRequestsClient.ListByResourceGroup +// method. +type JitRequestsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// JitRequestsClientListBySubscriptionOptions contains the optional parameters for the JitRequestsClient.ListBySubscription +// method. +type JitRequestsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// JitRequestsClientUpdateOptions contains the optional parameters for the JitRequestsClient.Update method. +type JitRequestsClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/response_types.go b/sdk/resourcemanager/solutions/armmanagedapplications/response_types.go index a88163282a35..6b21e8e4de0f 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/response_types.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/response_types.go @@ -3,89 +3,159 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications // ApplicationClientListOperationsResponse contains the response from method ApplicationClient.NewListOperationsPager. type ApplicationClientListOperationsResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } -// ApplicationDefinitionsClientCreateOrUpdateResponse contains the response from method ApplicationDefinitionsClient.BeginCreateOrUpdate. +// ApplicationDefinitionsClientCreateOrUpdateByIDResponse contains the response from method ApplicationDefinitionsClient.CreateOrUpdateByID. +type ApplicationDefinitionsClientCreateOrUpdateByIDResponse struct { + // Information about managed application definition. + ApplicationDefinition +} + +// ApplicationDefinitionsClientCreateOrUpdateResponse contains the response from method ApplicationDefinitionsClient.CreateOrUpdate. type ApplicationDefinitionsClientCreateOrUpdateResponse struct { + // Information about managed application definition. ApplicationDefinition } -// ApplicationDefinitionsClientDeleteResponse contains the response from method ApplicationDefinitionsClient.BeginDelete. +// ApplicationDefinitionsClientDeleteByIDResponse contains the response from method ApplicationDefinitionsClient.DeleteByID. +type ApplicationDefinitionsClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// ApplicationDefinitionsClientDeleteResponse contains the response from method ApplicationDefinitionsClient.Delete. type ApplicationDefinitionsClientDeleteResponse struct { // placeholder for future response values } +// ApplicationDefinitionsClientGetByIDResponse contains the response from method ApplicationDefinitionsClient.GetByID. +type ApplicationDefinitionsClientGetByIDResponse struct { + // Information about managed application definition. + ApplicationDefinition +} + // ApplicationDefinitionsClientGetResponse contains the response from method ApplicationDefinitionsClient.Get. type ApplicationDefinitionsClientGetResponse struct { + // Information about managed application definition. ApplicationDefinition } // ApplicationDefinitionsClientListByResourceGroupResponse contains the response from method ApplicationDefinitionsClient.NewListByResourceGroupPager. type ApplicationDefinitionsClientListByResourceGroupResponse struct { + // List of managed application definitions. ApplicationDefinitionListResult } // ApplicationDefinitionsClientListBySubscriptionResponse contains the response from method ApplicationDefinitionsClient.NewListBySubscriptionPager. type ApplicationDefinitionsClientListBySubscriptionResponse struct { + // List of managed application definitions. ApplicationDefinitionListResult } +// ApplicationDefinitionsClientUpdateByIDResponse contains the response from method ApplicationDefinitionsClient.UpdateByID. +type ApplicationDefinitionsClientUpdateByIDResponse struct { + // Information about managed application definition. + ApplicationDefinition +} + // ApplicationDefinitionsClientUpdateResponse contains the response from method ApplicationDefinitionsClient.Update. type ApplicationDefinitionsClientUpdateResponse struct { + // Information about managed application definition. ApplicationDefinition } +// ApplicationsClientCreateOrUpdateByIDResponse contains the response from method ApplicationsClient.BeginCreateOrUpdateByID. +type ApplicationsClientCreateOrUpdateByIDResponse struct { + // Information about managed application. + Application +} + // ApplicationsClientCreateOrUpdateResponse contains the response from method ApplicationsClient.BeginCreateOrUpdate. type ApplicationsClientCreateOrUpdateResponse struct { + // Information about managed application. Application } +// ApplicationsClientDeleteByIDResponse contains the response from method ApplicationsClient.BeginDeleteByID. +type ApplicationsClientDeleteByIDResponse struct { + // placeholder for future response values +} + // ApplicationsClientDeleteResponse contains the response from method ApplicationsClient.BeginDelete. type ApplicationsClientDeleteResponse struct { // placeholder for future response values } +// ApplicationsClientGetByIDResponse contains the response from method ApplicationsClient.GetByID. +type ApplicationsClientGetByIDResponse struct { + // Information about managed application. + Application +} + // ApplicationsClientGetResponse contains the response from method ApplicationsClient.Get. type ApplicationsClientGetResponse struct { + // Information about managed application. Application } // ApplicationsClientListAllowedUpgradePlansResponse contains the response from method ApplicationsClient.ListAllowedUpgradePlans. type ApplicationsClientListAllowedUpgradePlansResponse struct { - // placeholder for future response values + // The array of plan. + AllowedUpgradePlansResult } // ApplicationsClientListByResourceGroupResponse contains the response from method ApplicationsClient.NewListByResourceGroupPager. type ApplicationsClientListByResourceGroupResponse struct { + // List of managed applications. ApplicationListResult } // ApplicationsClientListBySubscriptionResponse contains the response from method ApplicationsClient.NewListBySubscriptionPager. type ApplicationsClientListBySubscriptionResponse struct { + // List of managed applications. ApplicationListResult } +// ApplicationsClientListTokensResponse contains the response from method ApplicationsClient.ListTokens. +type ApplicationsClientListTokensResponse struct { + // The array of managed identity tokens. + ManagedIdentityTokenResult +} + // ApplicationsClientRefreshPermissionsResponse contains the response from method ApplicationsClient.BeginRefreshPermissions. type ApplicationsClientRefreshPermissionsResponse struct { // placeholder for future response values } -// ApplicationsClientUpdateResponse contains the response from method ApplicationsClient.Update. +// ApplicationsClientUpdateAccessResponse contains the response from method ApplicationsClient.BeginUpdateAccess. +type ApplicationsClientUpdateAccessResponse struct { + // Update access request definition. + UpdateAccessDefinition +} + +// ApplicationsClientUpdateByIDResponse contains the response from method ApplicationsClient.BeginUpdateByID. +type ApplicationsClientUpdateByIDResponse struct { + // Information about managed application. + ApplicationPatchable +} + +// ApplicationsClientUpdateResponse contains the response from method ApplicationsClient.BeginUpdate. type ApplicationsClientUpdateResponse struct { - Application + // Information about managed application. + ApplicationPatchable } // JitRequestsClientCreateOrUpdateResponse contains the response from method JitRequestsClient.BeginCreateOrUpdate. type JitRequestsClientCreateOrUpdateResponse struct { + // Information about JIT request definition. JitRequestDefinition } @@ -96,20 +166,24 @@ type JitRequestsClientDeleteResponse struct { // JitRequestsClientGetResponse contains the response from method JitRequestsClient.Get. type JitRequestsClientGetResponse struct { + // Information about JIT request definition. JitRequestDefinition } // JitRequestsClientListByResourceGroupResponse contains the response from method JitRequestsClient.ListByResourceGroup. type JitRequestsClientListByResourceGroupResponse struct { + // List of JIT requests. JitRequestDefinitionListResult } // JitRequestsClientListBySubscriptionResponse contains the response from method JitRequestsClient.ListBySubscription. type JitRequestsClientListBySubscriptionResponse struct { + // List of JIT requests. JitRequestDefinitionListResult } // JitRequestsClientUpdateResponse contains the response from method JitRequestsClient.Update. type JitRequestsClientUpdateResponse struct { + // Information about JIT request definition. JitRequestDefinition } diff --git a/sdk/resourcemanager/solutions/armmanagedapplications/time_rfc3339.go b/sdk/resourcemanager/solutions/armmanagedapplications/time_rfc3339.go index 61be6aa86195..c9abf9e50664 100644 --- a/sdk/resourcemanager/solutions/armmanagedapplications/time_rfc3339.go +++ b/sdk/resourcemanager/solutions/armmanagedapplications/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmanagedapplications