From 33b1e225d98850a3119c0d2276f365e86adefb7a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 9 Aug 2023 03:39:32 +0000 Subject: [PATCH] CodeGen from PR 25219 in Azure/azure-rest-api-specs Merge 0a6d8fa2d06e786f86d8e138f0f3413fe522ec99 into 2735b620aeb695c106fecd9bf28d719aa0b75b43 --- .../armdesktopvirtualization/CHANGELOG.md | 36 + .../applicationgroups_client.go | 78 +- .../applicationgroups_client_example_test.go | 367 ----- .../applications_client.go | 74 +- .../applications_client_example_test.go | 286 ---- .../armdesktopvirtualization/autorest.md | 7 +- .../client_factory.go | 61 +- .../armdesktopvirtualization/constants.go | 129 +- .../desktops_client.go | 42 +- .../desktops_client_example_test.go | 156 -- .../armdesktopvirtualization/go.mod | 20 +- .../armdesktopvirtualization/go.sum | 38 +- .../hostpools_client.go | 93 +- .../hostpools_client_example_test.go | 639 -------- .../armdesktopvirtualization/models.go | 1407 +++++++---------- .../armdesktopvirtualization/models_serde.go | 342 +++- .../msiximages_client.go | 12 +- .../msiximages_client_example_test.go | 127 -- .../msixpackages_client.go | 74 +- .../msixpackages_client_example_test.go | 364 ----- .../operations_client.go | 7 +- .../operations_client_example_test.go | 83 - .../armdesktopvirtualization/options.go | 519 ++++++ .../privateendpointconnections_client.go | 578 +++++++ .../privatelinkresources_client.go | 203 +++ .../response_types.go | 107 +- .../scalingplanpooledschedules_client.go | 74 +- ...planpooledschedules_client_example_test.go | 419 ----- .../scalingplans_client.go | 82 +- .../scalingplans_client_example_test.go | 786 --------- .../sessionhosts_client.go | 54 +- .../sessionhosts_client_example_test.go | 279 ---- .../startmenuitems_client.go | 7 +- .../startmenuitems_client_example_test.go | 73 - .../armdesktopvirtualization/time_rfc3339.go | 3 +- .../usersessions_client.go | 67 +- .../usersessions_client_example_test.go | 262 --- .../workspaces_client.go | 78 +- .../workspaces_client_example_test.go | 343 ---- 39 files changed, 2953 insertions(+), 5423 deletions(-) delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client_example_test.go create mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/options.go create mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privatelinkresources_client.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client_example_test.go delete mode 100644 sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client_example_test.go diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/CHANGELOG.md b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/CHANGELOG.md index 98911cdc344b..889841464e1e 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/CHANGELOG.md +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/CHANGELOG.md @@ -1,5 +1,41 @@ # Release History +## 2.1.0-beta.1 (2023-08-09) +### Features Added + +- New enum type `HostpoolPublicNetworkAccess` with values `HostpoolPublicNetworkAccessDisabled`, `HostpoolPublicNetworkAccessEnabled`, `HostpoolPublicNetworkAccessEnabledForClientsOnly`, `HostpoolPublicNetworkAccessEnabledForSessionHostsOnly` +- New enum type `PrivateEndpointConnectionProvisioningState` with values `PrivateEndpointConnectionProvisioningStateCreating`, `PrivateEndpointConnectionProvisioningStateDeleting`, `PrivateEndpointConnectionProvisioningStateFailed`, `PrivateEndpointConnectionProvisioningStateSucceeded` +- New enum type `PrivateEndpointServiceConnectionStatus` with values `PrivateEndpointServiceConnectionStatusApproved`, `PrivateEndpointServiceConnectionStatusPending`, `PrivateEndpointServiceConnectionStatusRejected` +- New enum type `PublicNetworkAccess` with values `PublicNetworkAccessDisabled`, `PublicNetworkAccessEnabled` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New function `NewPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.DeleteByHostPool(context.Context, string, string, string, *PrivateEndpointConnectionsClientDeleteByHostPoolOptions) (PrivateEndpointConnectionsClientDeleteByHostPoolResponse, error)` +- New function `*PrivateEndpointConnectionsClient.DeleteByWorkspace(context.Context, string, string, string, *PrivateEndpointConnectionsClientDeleteByWorkspaceOptions) (PrivateEndpointConnectionsClientDeleteByWorkspaceResponse, error)` +- New function `*PrivateEndpointConnectionsClient.GetByHostPool(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetByHostPoolOptions) (PrivateEndpointConnectionsClientGetByHostPoolResponse, error)` +- New function `*PrivateEndpointConnectionsClient.GetByWorkspace(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetByWorkspaceOptions) (PrivateEndpointConnectionsClientGetByWorkspaceResponse, error)` +- New function `*PrivateEndpointConnectionsClient.NewListByHostPoolPager(string, string, *PrivateEndpointConnectionsClientListByHostPoolOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByHostPoolResponse]` +- New function `*PrivateEndpointConnectionsClient.NewListByWorkspacePager(string, string, *PrivateEndpointConnectionsClientListByWorkspaceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByWorkspaceResponse]` +- New function `*PrivateEndpointConnectionsClient.UpdateByHostPool(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientUpdateByHostPoolOptions) (PrivateEndpointConnectionsClientUpdateByHostPoolResponse, error)` +- New function `*PrivateEndpointConnectionsClient.UpdateByWorkspace(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientUpdateByWorkspaceOptions) (PrivateEndpointConnectionsClientUpdateByWorkspaceResponse, error)` +- New function `NewPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateLinkResourcesClient, error)` +- New function `*PrivateLinkResourcesClient.NewListByHostPoolPager(string, string, *PrivateLinkResourcesClientListByHostPoolOptions) *runtime.Pager[PrivateLinkResourcesClientListByHostPoolResponse]` +- New function `*PrivateLinkResourcesClient.NewListByWorkspacePager(string, string, *PrivateLinkResourcesClientListByWorkspaceOptions) *runtime.Pager[PrivateLinkResourcesClientListByWorkspaceResponse]` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResultWithSystemData` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateEndpointConnectionWithSystemData` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnectionState` +- New field `PublicNetworkAccess` in struct `HostPoolPatchProperties` +- New field `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `HostPoolProperties` +- New field `PublicNetworkAccess` in struct `WorkspacePatchProperties` +- New field `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `WorkspaceProperties` + + ## 2.0.0 (2023-03-24) ### Breaking Changes diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client.go index 93ccdf30ebe4..8a64c83e5a6d 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_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 armdesktopvirtualization @@ -48,25 +47,28 @@ func NewApplicationGroupsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Create or update an applicationGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - applicationGroup - Object containing ApplicationGroup definitions. // - options - ApplicationGroupsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationGroupsClient.CreateOrUpdate // method. func (client *ApplicationGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup ApplicationGroup, options *ApplicationGroupsClientCreateOrUpdateOptions) (ApplicationGroupsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationGroupName, applicationGroup, options) if err != nil { return ApplicationGroupsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationGroupsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ApplicationGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ApplicationGroupsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -89,10 +91,13 @@ func (client *ApplicationGroupsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, applicationGroup) + if err := runtime.MarshalAsJSON(req, applicationGroup); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -107,22 +112,24 @@ func (client *ApplicationGroupsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Remove an applicationGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - options - ApplicationGroupsClientDeleteOptions contains the optional parameters for the ApplicationGroupsClient.Delete // method. func (client *ApplicationGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationGroupName string, options *ApplicationGroupsClientDeleteOptions) (ApplicationGroupsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGroupName, options) if err != nil { return ApplicationGroupsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationGroupsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ApplicationGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ApplicationGroupsClientDeleteResponse{}, err } return ApplicationGroupsClientDeleteResponse{}, nil } @@ -147,7 +154,7 @@ func (client *ApplicationGroupsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -156,23 +163,26 @@ func (client *ApplicationGroupsClient) deleteCreateRequest(ctx context.Context, // Get - Get an application group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - options - ApplicationGroupsClientGetOptions contains the optional parameters for the ApplicationGroupsClient.Get method. func (client *ApplicationGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, options *ApplicationGroupsClientGetOptions) (ApplicationGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGroupName, options) if err != nil { return ApplicationGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -195,7 +205,7 @@ func (client *ApplicationGroupsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +222,7 @@ func (client *ApplicationGroupsClient) getHandleResponse(resp *http.Response) (A // NewListByResourceGroupPager - List applicationGroups. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ApplicationGroupsClientListByResourceGroupOptions contains the optional parameters for the ApplicationGroupsClient.NewListByResourceGroupPager // method. @@ -260,7 +270,7 @@ func (client *ApplicationGroupsClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -289,7 +299,7 @@ func (client *ApplicationGroupsClient) listByResourceGroupHandleResponse(resp *h // NewListBySubscriptionPager - List applicationGroups in subscription. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - options - ApplicationGroupsClientListBySubscriptionOptions contains the optional parameters for the ApplicationGroupsClient.NewListBySubscriptionPager // method. func (client *ApplicationGroupsClient) NewListBySubscriptionPager(options *ApplicationGroupsClientListBySubscriptionOptions) *runtime.Pager[ApplicationGroupsClientListBySubscriptionResponse] { @@ -332,7 +342,7 @@ func (client *ApplicationGroupsClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -353,24 +363,27 @@ func (client *ApplicationGroupsClient) listBySubscriptionHandleResponse(resp *ht // Update - Update an applicationGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - options - ApplicationGroupsClientUpdateOptions contains the optional parameters for the ApplicationGroupsClient.Update // method. func (client *ApplicationGroupsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, options *ApplicationGroupsClientUpdateOptions) (ApplicationGroupsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationGroupName, options) if err != nil { return ApplicationGroupsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationGroupsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGroupsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -393,11 +406,14 @@ func (client *ApplicationGroupsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ApplicationGroup != nil { - return req, runtime.MarshalAsJSON(req, *options.ApplicationGroup) + if err := runtime.MarshalAsJSON(req, *options.ApplicationGroup); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client_example_test.go deleted file mode 100644 index 230428f00c6d..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applicationgroups_client_example_test.go +++ /dev/null @@ -1,367 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_Get.json -func ExampleApplicationGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGroupsClient().Get(ctx, "resourceGroup1", "applicationGroup1", 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.ApplicationGroup = armdesktopvirtualization.ApplicationGroup{ - // Name: to.Ptr("applicationGroup1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_Create.json -func ExampleApplicationGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGroupsClient().CreateOrUpdate(ctx, "resourceGroup1", "applicationGroup1", armdesktopvirtualization.ApplicationGroup{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - Description: to.Ptr("des1"), - ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - FriendlyName: to.Ptr("friendly"), - HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - }, - }, 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.ApplicationGroup = armdesktopvirtualization.ApplicationGroup{ - // Name: to.Ptr("applicationGroup1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_Delete.json -func ExampleApplicationGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewApplicationGroupsClient().Delete(ctx, "resourceGroup1", "applicationGroup1", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_Update.json -func ExampleApplicationGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGroupsClient().Update(ctx, "resourceGroup1", "applicationGroup1", &armdesktopvirtualization.ApplicationGroupsClientUpdateOptions{ApplicationGroup: &armdesktopvirtualization.ApplicationGroupPatch{ - Properties: &armdesktopvirtualization.ApplicationGroupPatchProperties{ - Description: to.Ptr("des1"), - FriendlyName: to.Ptr("friendly"), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - }) - 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.ApplicationGroup = armdesktopvirtualization.ApplicationGroup{ - // Name: to.Ptr("applicationGroup1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_ListByResourceGroup.json -func ExampleApplicationGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGroupsClient().NewListByResourceGroupPager("resourceGroup1", &armdesktopvirtualization.ApplicationGroupsClientListByResourceGroupOptions{Filter: to.Ptr("applicationGroupType eq 'RailApplication'"), - PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.ApplicationGroupList = armdesktopvirtualization.ApplicationGroupList{ - // Value: []*armdesktopvirtualization.ApplicationGroup{ - // { - // Name: to.Ptr("applicationGroup1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("applicationGroup2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_ListBySubscription.json -func ExampleApplicationGroupsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGroupsClient().NewListBySubscriptionPager(&armdesktopvirtualization.ApplicationGroupsClientListBySubscriptionOptions{Filter: to.Ptr("applicationGroupType eq 'RailApplication'")}) - 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.ApplicationGroupList = armdesktopvirtualization.ApplicationGroupList{ - // Value: []*armdesktopvirtualization.ApplicationGroup{ - // { - // Name: to.Ptr("applicationGroup1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("applicationGroup2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ApplicationGroupProperties{ - // Description: to.Ptr("des1"), - // ApplicationGroupType: to.Ptr(armdesktopvirtualization.ApplicationGroupTypeRemoteApp), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // WorkspaceArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client.go index 793fdb53088b..caa81e1503bc 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/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 armdesktopvirtualization @@ -48,7 +47,7 @@ func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or update an application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - applicationName - The name of the application within the specified application group @@ -56,18 +55,21 @@ func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredent // - options - ApplicationsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.CreateOrUpdate // method. func (client *ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application Application, options *ApplicationsClientCreateOrUpdateOptions) (ApplicationsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationGroupName, applicationName, application, options) if err != nil { return ApplicationsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ApplicationsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -94,10 +96,13 @@ func (client *ApplicationsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, application) + if err := runtime.MarshalAsJSON(req, application); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -112,22 +117,24 @@ func (client *ApplicationsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Remove an application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - applicationName - The name of the application within the specified application group // - options - ApplicationsClientDeleteOptions contains the optional parameters for the ApplicationsClient.Delete method. func (client *ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, options *ApplicationsClientDeleteOptions) (ApplicationsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGroupName, applicationName, options) if err != nil { return ApplicationsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ApplicationsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientDeleteResponse{}, err } return ApplicationsClientDeleteResponse{}, nil } @@ -156,7 +163,7 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -165,24 +172,27 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou // Get - Get an application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - applicationName - The name of the application within the specified application group // - options - ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. func (client *ApplicationsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, options *ApplicationsClientGetOptions) (ApplicationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGroupName, 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) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -209,7 +219,7 @@ func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -226,7 +236,7 @@ func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (Applic // NewListPager - List applications. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - options - ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.NewListPager method. @@ -278,7 +288,7 @@ func (client *ApplicationsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -305,24 +315,27 @@ func (client *ApplicationsClient) listHandleResponse(resp *http.Response) (Appli // Update - Update an application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - applicationName - The name of the application within the specified application group // - options - ApplicationsClientUpdateOptions contains the optional parameters for the ApplicationsClient.Update method. func (client *ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, options *ApplicationsClientUpdateOptions) (ApplicationsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationGroupName, applicationName, options) if err != nil { return ApplicationsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ApplicationsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -349,11 +362,14 @@ func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Application != nil { - return req, runtime.MarshalAsJSON(req, *options.Application) + if err := runtime.MarshalAsJSON(req, *options.Application); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client_example_test.go deleted file mode 100644 index 59fb79f394b7..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/applications_client_example_test.go +++ /dev/null @@ -1,286 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Application_Get.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 := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().Get(ctx, "resourceGroup1", "applicationGroup1", "application1", 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 = armdesktopvirtualization.Application{ - // Name: to.Ptr("applicationGroup1/application1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/applications"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/application1"), - // Properties: &armdesktopvirtualization.ApplicationProperties{ - // Description: to.Ptr("des1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.RemoteApplicationTypeInBuilt), - // CommandLineArguments: to.Ptr("arguments"), - // CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - // FilePath: to.Ptr("path"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("icon"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // ShowInPortal: to.Ptr(true), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Application_Create.json -func ExampleApplicationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().CreateOrUpdate(ctx, "resourceGroup1", "applicationGroup1", "application1", armdesktopvirtualization.Application{ - Properties: &armdesktopvirtualization.ApplicationProperties{ - Description: to.Ptr("des1"), - CommandLineArguments: to.Ptr("arguments"), - CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - FilePath: to.Ptr("path"), - FriendlyName: to.Ptr("friendly"), - IconIndex: to.Ptr[int32](1), - IconPath: to.Ptr("icon"), - ShowInPortal: to.Ptr(true), - }, - }, 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 = armdesktopvirtualization.Application{ - // Name: to.Ptr("applicationGroup1/application1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/applications"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/application1"), - // Properties: &armdesktopvirtualization.ApplicationProperties{ - // Description: to.Ptr("des1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.RemoteApplicationTypeInBuilt), - // CommandLineArguments: to.Ptr("arguments"), - // CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - // FilePath: to.Ptr("path"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("icon"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // ShowInPortal: to.Ptr(true), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Application_Delete.json -func ExampleApplicationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewApplicationsClient().Delete(ctx, "resourceGroup1", "applicationGroup1", "application1", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Application_Update.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 := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().Update(ctx, "resourceGroup1", "applicationGroup1", "application1", &armdesktopvirtualization.ApplicationsClientUpdateOptions{Application: &armdesktopvirtualization.ApplicationPatch{ - Properties: &armdesktopvirtualization.ApplicationPatchProperties{ - Description: to.Ptr("des1"), - ApplicationType: to.Ptr(armdesktopvirtualization.RemoteApplicationTypeInBuilt), - CommandLineArguments: to.Ptr("arguments"), - CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - FilePath: to.Ptr("path"), - FriendlyName: to.Ptr("friendly"), - IconIndex: to.Ptr[int32](1), - IconPath: to.Ptr("icon"), - ShowInPortal: to.Ptr(true), - }, - }, - }) - 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 = armdesktopvirtualization.Application{ - // Name: to.Ptr("applicationGroup1/application1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/applications"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/application1"), - // Properties: &armdesktopvirtualization.ApplicationProperties{ - // Description: to.Ptr("des1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.RemoteApplicationTypeInBuilt), - // CommandLineArguments: to.Ptr("arguments"), - // CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - // FilePath: to.Ptr("path"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("icon"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // ShowInPortal: to.Ptr(true), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Application_List.json -func ExampleApplicationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationsClient().NewListPager("resourceGroup1", "applicationGroup1", &armdesktopvirtualization.ApplicationsClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.ApplicationList = armdesktopvirtualization.ApplicationList{ - // Value: []*armdesktopvirtualization.Application{ - // { - // Name: to.Ptr("applicationGroup1/application1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/applications"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/application1"), - // Properties: &armdesktopvirtualization.ApplicationProperties{ - // Description: to.Ptr("des1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.RemoteApplicationTypeInBuilt), - // CommandLineArguments: to.Ptr("arguments"), - // CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - // FilePath: to.Ptr("path"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("icon"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // ShowInPortal: to.Ptr(true), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("applicationGroup1/application2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/applications"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/application2"), - // Properties: &armdesktopvirtualization.ApplicationProperties{ - // Description: to.Ptr("des2"), - // ApplicationType: to.Ptr(armdesktopvirtualization.RemoteApplicationTypeInBuilt), - // CommandLineArguments: to.Ptr("arguments"), - // CommandLineSetting: to.Ptr(armdesktopvirtualization.CommandLineSettingAllow), - // FilePath: to.Ptr("path"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("icon"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // ShowInPortal: to.Ptr(true), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/autorest.md b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/autorest.md index d63a4e1170de..1ba9b627bff1 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/autorest.md +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2022-09 +module-version: 2.1.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/client_factory.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/client_factory.go index 44cce234f196..21063cd08e90 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/client_factory.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/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 armdesktopvirtualization @@ -38,53 +37,58 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewApplicationGroupsClient() *ApplicationGroupsClient { + subClient, _ := NewApplicationGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewWorkspacesClient() *WorkspacesClient { - subClient, _ := NewWorkspacesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { + subClient, _ := NewApplicationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewScalingPlansClient() *ScalingPlansClient { - subClient, _ := NewScalingPlansClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDesktopsClient() *DesktopsClient { + subClient, _ := NewDesktopsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewScalingPlanPooledSchedulesClient() *ScalingPlanPooledSchedulesClient { - subClient, _ := NewScalingPlanPooledSchedulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewHostPoolsClient() *HostPoolsClient { + subClient, _ := NewHostPoolsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewApplicationGroupsClient() *ApplicationGroupsClient { - subClient, _ := NewApplicationGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMSIXPackagesClient() *MSIXPackagesClient { + subClient, _ := NewMSIXPackagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewStartMenuItemsClient() *StartMenuItemsClient { - subClient, _ := NewStartMenuItemsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMsixImagesClient() *MsixImagesClient { + subClient, _ := NewMsixImagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { - subClient, _ := NewApplicationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewDesktopsClient() *DesktopsClient { - subClient, _ := NewDesktopsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewHostPoolsClient() *HostPoolsClient { - subClient, _ := NewHostPoolsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewUserSessionsClient() *UserSessionsClient { - subClient, _ := NewUserSessionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewScalingPlanPooledSchedulesClient() *ScalingPlanPooledSchedulesClient { + subClient, _ := NewScalingPlanPooledSchedulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScalingPlansClient() *ScalingPlansClient { + subClient, _ := NewScalingPlansClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -93,12 +97,17 @@ func (c *ClientFactory) NewSessionHostsClient() *SessionHostsClient { return subClient } -func (c *ClientFactory) NewMSIXPackagesClient() *MSIXPackagesClient { - subClient, _ := NewMSIXPackagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewStartMenuItemsClient() *StartMenuItemsClient { + subClient, _ := NewStartMenuItemsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMsixImagesClient() *MsixImagesClient { - subClient, _ := NewMsixImagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewUserSessionsClient() *UserSessionsClient { + subClient, _ := NewUserSessionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWorkspacesClient() *WorkspacesClient { + subClient, _ := NewWorkspacesClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/constants.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/constants.go index c5a5e85c6c98..23ba9dafb101 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/constants.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/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 armdesktopvirtualization const ( moduleName = "armdesktopvirtualization" - moduleVersion = "v2.0.0" + moduleVersion = "v2.1.0-beta.1" ) // ApplicationGroupType - Resource Type of ApplicationGroup. @@ -89,25 +88,25 @@ func PossibleCreatedByTypeValues() []CreatedByType { type DayOfWeek string const ( - DayOfWeekMonday DayOfWeek = "Monday" - DayOfWeekTuesday DayOfWeek = "Tuesday" - DayOfWeekWednesday DayOfWeek = "Wednesday" - DayOfWeekThursday DayOfWeek = "Thursday" DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" DayOfWeekSaturday DayOfWeek = "Saturday" DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" ) // PossibleDayOfWeekValues returns the possible values for the DayOfWeek const type. func PossibleDayOfWeekValues() []DayOfWeek { return []DayOfWeek{ - DayOfWeekMonday, - DayOfWeekTuesday, - DayOfWeekWednesday, - DayOfWeekThursday, DayOfWeekFriday, + DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, + DayOfWeekThursday, + DayOfWeekTuesday, + DayOfWeekWednesday, } } @@ -119,45 +118,47 @@ const ( // staging). The AppAttachService is used to enable the staging/registration (and eventual deregistration/destaging) of MSIX // apps that have been set up by the tenant admin. This checks whether the component had any failures during package staging. // Failures in staging will prevent some MSIX apps from working properly for the end user. If this check fails, it is non - // fatal and the machine still can service connections, main issue may be certain apps will not work for end-users. + // fatal and the machine still can service connections, main issue may be certain apps will not work for end-users. (Currently + // Enabled) HealthCheckNameAppAttachHealthCheck HealthCheckName = "AppAttachHealthCheck" // HealthCheckNameDomainJoinedCheck - Verifies the SessionHost is joined to a domain. If this check fails is classified as - // fatal as no connection can succeed if the SessionHost is not joined to the domain. + // fatal as no connection can succeed if the SessionHost is not joined to the domain. (Currently Enabled) HealthCheckNameDomainJoinedCheck HealthCheckName = "DomainJoinedCheck" // HealthCheckNameDomainReachable - Verifies the domain the SessionHost is joined to is still reachable. If this check fails // is classified as fatal as no connection can succeed if the domain the SessionHost is joined is not reachable at the time - // of connection. + // of connection. (Currently Disabled) HealthCheckNameDomainReachable HealthCheckName = "DomainReachable" // HealthCheckNameDomainTrustCheck - Verifies the SessionHost is not experiencing domain trust issues that will prevent authentication // on SessionHost at connection time when session is created. If this check fails is classified as fatal as no connection - // can succeed if we cannot reach the domain for authentication on the SessionHost. + // can succeed if we cannot reach the domain for authentication on the SessionHost. (Currently Enabled) HealthCheckNameDomainTrustCheck HealthCheckName = "DomainTrustCheck" // HealthCheckNameFSLogixHealthCheck - Verifies the FSLogix service is up and running to make sure users' profiles are loaded // in the session. If this check fails is classified as fatal as even if the connection can succeed, user experience is bad - // as the user profile cannot be loaded and user will get a temporary profile in the session. + // as the user profile cannot be loaded and user will get a temporary profile in the session. (Currently Disabled) HealthCheckNameFSLogixHealthCheck HealthCheckName = "FSLogixHealthCheck" - // HealthCheckNameMetaDataServiceCheck - Verifies the metadata service is accessible and return compute properties. + // HealthCheckNameMetaDataServiceCheck - Verifies the metadata service is accessible and return compute properties. (Currently + // Enabled) HealthCheckNameMetaDataServiceCheck HealthCheckName = "MetaDataServiceCheck" // HealthCheckNameMonitoringAgentCheck - Verifies that the required Geneva agent is running. If this check fails, it is non // fatal and the machine still can service connections, main issue may be that monitoring agent is missing or running (possibly) - // older version. + // older version. (Currently Enabled) HealthCheckNameMonitoringAgentCheck HealthCheckName = "MonitoringAgentCheck" // HealthCheckNameSupportedEncryptionCheck - Verifies the value of SecurityLayer registration key. If the value is 0 (SecurityLayer.RDP) // this check fails with Error code = NativeMethodErrorCode.E_FAIL and is fatal. If the value is 1 (SecurityLayer.Negotiate) - // this check fails with Error code = NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. + // this check fails with Error code = NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. (Currently Disabled) HealthCheckNameSupportedEncryptionCheck HealthCheckName = "SupportedEncryptionCheck" // HealthCheckNameSxSStackListenerCheck - Verifies that the SxS stack is up and running so connections can succeed. If this - // check fails is classified as fatal as no connection can succeed if the SxS stack is not ready. + // check fails is classified as fatal as no connection can succeed if the SxS stack is not ready. (Currently Enabled) HealthCheckNameSxSStackListenerCheck HealthCheckName = "SxSStackListenerCheck" // HealthCheckNameUrlsAccessibleCheck - Verifies that the required WVD service and Geneva URLs are reachable from the SessionHost. // These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs for agent monitoring (geneva). If this // check fails, it is non fatal and the machine still can service connections, main issue may be that monitoring agent is - // unable to store warm path data (logs, operations ...). + // unable to store warm path data (logs, operations ...). (Currently Disabled) HealthCheckNameUrlsAccessibleCheck HealthCheckName = "UrlsAccessibleCheck" // HealthCheckNameWebRTCRedirectorCheck - Verifies whether the WebRTCRedirector component is healthy. The WebRTCRedirector // component is used to optimize video and audio performance in Microsoft Teams. This checks whether the component is still // running, and whether there is a higher version available. If this check fails, it is non fatal and the machine still can - // service connections, main issue may be the WebRTCRedirector component has to be restarted or updated. + // service connections, main issue may be the WebRTCRedirector component has to be restarted or updated. (Currently Disabled) HealthCheckNameWebRTCRedirectorCheck HealthCheckName = "WebRTCRedirectorCheck" ) @@ -226,6 +227,27 @@ func PossibleHostPoolTypeValues() []HostPoolType { } } +// HostpoolPublicNetworkAccess - Enabled allows this resource to be accessed from both public and private networks, Disabled +// allows this resource to only be accessed via private endpoints +type HostpoolPublicNetworkAccess string + +const ( + HostpoolPublicNetworkAccessDisabled HostpoolPublicNetworkAccess = "Disabled" + HostpoolPublicNetworkAccessEnabled HostpoolPublicNetworkAccess = "Enabled" + HostpoolPublicNetworkAccessEnabledForClientsOnly HostpoolPublicNetworkAccess = "EnabledForClientsOnly" + HostpoolPublicNetworkAccessEnabledForSessionHostsOnly HostpoolPublicNetworkAccess = "EnabledForSessionHostsOnly" +) + +// PossibleHostpoolPublicNetworkAccessValues returns the possible values for the HostpoolPublicNetworkAccess const type. +func PossibleHostpoolPublicNetworkAccessValues() []HostpoolPublicNetworkAccess { + return []HostpoolPublicNetworkAccess{ + HostpoolPublicNetworkAccessDisabled, + HostpoolPublicNetworkAccessEnabled, + HostpoolPublicNetworkAccessEnabledForClientsOnly, + HostpoolPublicNetworkAccessEnabledForSessionHostsOnly, + } +} + // LoadBalancerType - The type of the load balancer. type LoadBalancerType string @@ -278,6 +300,61 @@ func PossiblePreferredAppGroupTypeValues() []PreferredAppGroupType { } } +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// PublicNetworkAccess - Enabled allows this resource to be accessed from both public and private networks, Disabled allows +// this resource to only be accessed via private endpoints +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + // RegistrationTokenOperation - The type of resetting the token. type RegistrationTokenOperation string @@ -317,19 +394,19 @@ func PossibleRemoteApplicationTypeValues() []RemoteApplicationType { type SKUTier string const ( - SKUTierFree SKUTier = "Free" SKUTierBasic SKUTier = "Basic" - SKUTierStandard SKUTier = "Standard" + SKUTierFree SKUTier = "Free" SKUTierPremium SKUTier = "Premium" + SKUTierStandard SKUTier = "Standard" ) // PossibleSKUTierValues returns the possible values for the SKUTier const type. func PossibleSKUTierValues() []SKUTier { return []SKUTier{ - SKUTierFree, SKUTierBasic, - SKUTierStandard, + SKUTierFree, SKUTierPremium, + SKUTierStandard, } } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client.go index 98839251a2c7..7fbbe9da3060 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_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 armdesktopvirtualization @@ -48,24 +47,27 @@ func NewDesktopsClient(subscriptionID string, credential azcore.TokenCredential, // Get - Get a desktop. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - desktopName - The name of the desktop within the specified desktop group // - options - DesktopsClientGetOptions contains the optional parameters for the DesktopsClient.Get method. func (client *DesktopsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string, options *DesktopsClientGetOptions) (DesktopsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGroupName, desktopName, options) if err != nil { return DesktopsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DesktopsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DesktopsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DesktopsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *DesktopsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,7 @@ func (client *DesktopsClient) getHandleResponse(resp *http.Response) (DesktopsCl // NewListPager - List desktops. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - options - DesktopsClientListOptions contains the optional parameters for the DesktopsClient.NewListPager method. @@ -161,7 +163,7 @@ func (client *DesktopsClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -188,24 +190,27 @@ func (client *DesktopsClient) listHandleResponse(resp *http.Response) (DesktopsC // Update - Update a desktop. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - desktopName - The name of the desktop within the specified desktop group // - options - DesktopsClientUpdateOptions contains the optional parameters for the DesktopsClient.Update method. func (client *DesktopsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string, options *DesktopsClientUpdateOptions) (DesktopsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationGroupName, desktopName, options) if err != nil { return DesktopsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DesktopsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DesktopsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DesktopsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -232,11 +237,14 @@ func (client *DesktopsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Desktop != nil { - return req, runtime.MarshalAsJSON(req, *options.Desktop) + if err := runtime.MarshalAsJSON(req, *options.Desktop); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client_example_test.go deleted file mode 100644 index 6d16d3921ca2..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/desktops_client_example_test.go +++ /dev/null @@ -1,156 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Desktop_Get.json -func ExampleDesktopsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDesktopsClient().Get(ctx, "resourceGroup1", "applicationGroup1", "SessionDesktop", 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.Desktop = armdesktopvirtualization.Desktop{ - // Name: to.Ptr("applicationGroup1/SessionDesktop"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/desktops"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/SessionDesktop"), - // Properties: &armdesktopvirtualization.DesktopProperties{ - // Description: to.Ptr("des1"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Desktop_Update.json -func ExampleDesktopsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDesktopsClient().Update(ctx, "resourceGroup1", "applicationGroup1", "SessionDesktop", &armdesktopvirtualization.DesktopsClientUpdateOptions{Desktop: &armdesktopvirtualization.DesktopPatch{ - Properties: &armdesktopvirtualization.DesktopPatchProperties{ - Description: to.Ptr("des1"), - FriendlyName: to.Ptr("friendly"), - }, - }, - }) - 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.Desktop = armdesktopvirtualization.Desktop{ - // Name: to.Ptr("applicationGroup1/SessionDesktop"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/desktops"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/desktops/SessionDesktop"), - // Properties: &armdesktopvirtualization.DesktopProperties{ - // Description: to.Ptr("des1"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Desktop_List.json -func ExampleDesktopsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDesktopsClient().NewListPager("resourceGroup1", "applicationGroup1", &armdesktopvirtualization.DesktopsClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.DesktopList = armdesktopvirtualization.DesktopList{ - // Value: []*armdesktopvirtualization.Desktop{ - // { - // Name: to.Ptr("applicationGroup1/SessionDesktop"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/desktops"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/SessionDesktop"), - // Properties: &armdesktopvirtualization.DesktopProperties{ - // Description: to.Ptr("des1"), - // FriendlyName: to.Ptr("friendly"), - // IconContent: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // IconHash: to.Ptr("bEQ1n2HysrGxCDvgt4bfOtkET8ydzh5SXGM0KGTBPVc"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/go.mod b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/go.mod index 8a9e633fc6b1..49ecaf2683e8 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/go.mod +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/desktopvirtualizati 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/desktopvirtualization/armdesktopvirtualization/go.sum b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/go.sum +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/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/desktopvirtualization/armdesktopvirtualization/hostpools_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_client.go index 311ce1d64140..c4c5e993eb99 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_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 armdesktopvirtualization @@ -48,25 +47,28 @@ func NewHostPoolsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Create or update a host pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - hostPool - Object containing HostPool definitions. // - options - HostPoolsClientCreateOrUpdateOptions contains the optional parameters for the HostPoolsClient.CreateOrUpdate // method. func (client *HostPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool HostPool, options *HostPoolsClientCreateOrUpdateOptions) (HostPoolsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostPoolName, hostPool, options) if err != nil { return HostPoolsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostPoolsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return HostPoolsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return HostPoolsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -89,10 +91,13 @@ func (client *HostPoolsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, hostPool) + if err := runtime.MarshalAsJSON(req, hostPool); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -107,21 +112,23 @@ func (client *HostPoolsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Remove a host pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - HostPoolsClientDeleteOptions contains the optional parameters for the HostPoolsClient.Delete method. func (client *HostPoolsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, options *HostPoolsClientDeleteOptions) (HostPoolsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostPoolName, options) if err != nil { return HostPoolsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostPoolsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return HostPoolsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return HostPoolsClientDeleteResponse{}, err } return HostPoolsClientDeleteResponse{}, nil } @@ -146,7 +153,7 @@ func (client *HostPoolsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -158,23 +165,26 @@ func (client *HostPoolsClient) deleteCreateRequest(ctx context.Context, resource // Get - Get a host pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - HostPoolsClientGetOptions contains the optional parameters for the HostPoolsClient.Get method. func (client *HostPoolsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, options *HostPoolsClientGetOptions) (HostPoolsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, hostPoolName, options) if err != nil { return HostPoolsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostPoolsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HostPoolsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HostPoolsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -197,7 +207,7 @@ func (client *HostPoolsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +224,7 @@ func (client *HostPoolsClient) getHandleResponse(resp *http.Response) (HostPools // NewListPager - List hostPools in subscription. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - options - HostPoolsClientListOptions contains the optional parameters for the HostPoolsClient.NewListPager method. func (client *HostPoolsClient) NewListPager(options *HostPoolsClientListOptions) *runtime.Pager[HostPoolsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[HostPoolsClientListResponse]{ @@ -256,7 +266,7 @@ func (client *HostPoolsClient) listCreateRequest(ctx context.Context, options *H return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -282,7 +292,7 @@ func (client *HostPoolsClient) listHandleResponse(resp *http.Response) (HostPool // NewListByResourceGroupPager - List hostPools. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - HostPoolsClientListByResourceGroupOptions contains the optional parameters for the HostPoolsClient.NewListByResourceGroupPager // method. @@ -330,7 +340,7 @@ func (client *HostPoolsClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -357,24 +367,27 @@ func (client *HostPoolsClient) listByResourceGroupHandleResponse(resp *http.Resp // RetrieveRegistrationToken - Registration token of the host pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - HostPoolsClientRetrieveRegistrationTokenOptions contains the optional parameters for the HostPoolsClient.RetrieveRegistrationToken // method. func (client *HostPoolsClient) RetrieveRegistrationToken(ctx context.Context, resourceGroupName string, hostPoolName string, options *HostPoolsClientRetrieveRegistrationTokenOptions) (HostPoolsClientRetrieveRegistrationTokenResponse, error) { + var err error req, err := client.retrieveRegistrationTokenCreateRequest(ctx, resourceGroupName, hostPoolName, options) if err != nil { return HostPoolsClientRetrieveRegistrationTokenResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostPoolsClientRetrieveRegistrationTokenResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HostPoolsClientRetrieveRegistrationTokenResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HostPoolsClientRetrieveRegistrationTokenResponse{}, err } - return client.retrieveRegistrationTokenHandleResponse(resp) + resp, err := client.retrieveRegistrationTokenHandleResponse(httpResp) + return resp, err } // retrieveRegistrationTokenCreateRequest creates the RetrieveRegistrationToken request. @@ -397,7 +410,7 @@ func (client *HostPoolsClient) retrieveRegistrationTokenCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -415,23 +428,26 @@ func (client *HostPoolsClient) retrieveRegistrationTokenHandleResponse(resp *htt // Update - Update a host pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - HostPoolsClientUpdateOptions contains the optional parameters for the HostPoolsClient.Update method. func (client *HostPoolsClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, options *HostPoolsClientUpdateOptions) (HostPoolsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, hostPoolName, options) if err != nil { return HostPoolsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HostPoolsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HostPoolsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HostPoolsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -454,11 +470,14 @@ func (client *HostPoolsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.HostPool != nil { - return req, runtime.MarshalAsJSON(req, *options.HostPool) + if err := runtime.MarshalAsJSON(req, *options.HostPool); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_client_example_test.go deleted file mode 100644 index f5a00114103c..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/hostpools_client_example_test.go +++ /dev/null @@ -1,639 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_Get.json -func ExampleHostPoolsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHostPoolsClient().Get(ctx, "resourceGroup1", "hostPool1", 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.HostPool = armdesktopvirtualization.HostPool{ - // Name: to.Ptr("hostPool1"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_Create.json -func ExampleHostPoolsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHostPoolsClient().CreateOrUpdate(ctx, "resourceGroup1", "hostPool1", armdesktopvirtualization.HostPool{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armdesktopvirtualization.HostPoolProperties{ - Description: to.Ptr("des1"), - AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - { - DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - Hour: to.Ptr[int32](7), - }, - { - DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - Hour: to.Ptr[int32](8), - }}, - UseSessionHostLocalTime: to.Ptr(false), - }, - FriendlyName: to.Ptr("friendly"), - HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - MaxSessionLimit: to.Ptr[int32](999999), - PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T14:01:54.9571247Z"); return t }()), - RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - }, - SsoClientID: to.Ptr("client"), - SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - SsoadfsAuthority: to.Ptr("https://adfs"), - StartVMOnConnect: to.Ptr(false), - VMTemplate: to.Ptr("{json:json}"), - }, - }, 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.HostPool = armdesktopvirtualization.HostPool{ - // Name: to.Ptr("hostPool1"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_Delete.json -func ExampleHostPoolsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHostPoolsClient().Delete(ctx, "resourceGroup1", "hostPool1", &armdesktopvirtualization.HostPoolsClientDeleteOptions{Force: to.Ptr(true)}) - 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_Update.json -func ExampleHostPoolsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHostPoolsClient().Update(ctx, "resourceGroup1", "hostPool1", &armdesktopvirtualization.HostPoolsClientUpdateOptions{HostPool: &armdesktopvirtualization.HostPoolPatch{ - Properties: &armdesktopvirtualization.HostPoolPatchProperties{ - Description: to.Ptr("des1"), - AgentUpdate: &armdesktopvirtualization.AgentUpdatePatchProperties{ - Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowPatchProperties{ - { - DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - Hour: to.Ptr[int32](7), - }, - { - DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - Hour: to.Ptr[int32](8), - }}, - UseSessionHostLocalTime: to.Ptr(false), - }, - FriendlyName: to.Ptr("friendly"), - LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - MaxSessionLimit: to.Ptr[int32](999999), - PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - RegistrationInfo: &armdesktopvirtualization.RegistrationInfoPatch{ - ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T15:01:54.9571247Z"); return t }()), - RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - }, - SsoClientID: to.Ptr("client"), - SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - SsoadfsAuthority: to.Ptr("https://adfs"), - StartVMOnConnect: to.Ptr(false), - VMTemplate: to.Ptr("{json:json}"), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - }) - 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.HostPool = armdesktopvirtualization.HostPool{ - // Name: to.Ptr("hostPool1"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_ListByResourceGroup.json -func ExampleHostPoolsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHostPoolsClient().NewListByResourceGroupPager("resourceGroup1", &armdesktopvirtualization.HostPoolsClientListByResourceGroupOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.HostPoolList = armdesktopvirtualization.HostPoolList{ - // Value: []*armdesktopvirtualization.HostPool{ - // { - // Name: to.Ptr("hostPool1"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("hostPool2"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_List.json -func ExampleHostPoolsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHostPoolsClient().NewListPager(&armdesktopvirtualization.HostPoolsClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.HostPoolList = armdesktopvirtualization.HostPoolList{ - // Value: []*armdesktopvirtualization.HostPool{ - // { - // Name: to.Ptr("hostPool1"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("hostPool2"), - // Type: to.Ptr("/Microsoft.DesktopVirtualization/hostPools"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.HostPoolProperties{ - // Description: to.Ptr("des1"), - // AgentUpdate: &armdesktopvirtualization.AgentUpdateProperties{ - // Type: to.Ptr(armdesktopvirtualization.SessionHostComponentUpdateTypeScheduled), - // MaintenanceWindowTimeZone: to.Ptr("Alaskan Standard Time"), - // MaintenanceWindows: []*armdesktopvirtualization.MaintenanceWindowProperties{ - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekFriday), - // Hour: to.Ptr[int32](7), - // }, - // { - // DayOfWeek: to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // Hour: to.Ptr[int32](8), - // }}, - // UseSessionHostLocalTime: to.Ptr(false), - // }, - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // HostPoolType: to.Ptr(armdesktopvirtualization.HostPoolTypePooled), - // LoadBalancerType: to.Ptr(armdesktopvirtualization.LoadBalancerTypeBreadthFirst), - // MaxSessionLimit: to.Ptr[int32](999999), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // PersonalDesktopAssignmentType: to.Ptr(armdesktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - // PreferredAppGroupType: to.Ptr(armdesktopvirtualization.PreferredAppGroupTypeDesktop), - // RegistrationInfo: &armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // }, - // SsoClientID: to.Ptr("client"), - // SsoClientSecretKeyVaultPath: to.Ptr("https://keyvault/secret"), - // SsoSecretType: to.Ptr(armdesktopvirtualization.SSOSecretTypeSharedKey), - // SsoadfsAuthority: to.Ptr("https://adfs"), - // StartVMOnConnect: to.Ptr(false), - // VMTemplate: to.Ptr("{json:json}"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPools_RetrieveRegistrationToken_Post.json -func ExampleHostPoolsClient_RetrieveRegistrationToken() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHostPoolsClient().RetrieveRegistrationToken(ctx, "resourceGroup1", "hostPool1", 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.RegistrationInfo = armdesktopvirtualization.RegistrationInfo{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // RegistrationTokenOperation: to.Ptr(armdesktopvirtualization.RegistrationTokenOperationUpdate), - // Token: to.Ptr("token"), - // } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models.go index 3517bc22eaab..747b9a523200 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models.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 armdesktopvirtualization @@ -15,1984 +14,1718 @@ import "time" type AgentUpdatePatchProperties struct { // Time zone for maintenance as defined in https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. // Must be set if useLocalTime is true. - MaintenanceWindowTimeZone *string `json:"maintenanceWindowTimeZone,omitempty"` + MaintenanceWindowTimeZone *string // List of maintenance windows. Maintenance windows are 2 hours long. - MaintenanceWindows []*MaintenanceWindowPatchProperties `json:"maintenanceWindows,omitempty"` + MaintenanceWindows []*MaintenanceWindowPatchProperties // The type of maintenance for session host components. - Type *SessionHostComponentUpdateType `json:"type,omitempty"` + Type *SessionHostComponentUpdateType // Whether to use localTime of the virtual machine. - UseSessionHostLocalTime *bool `json:"useSessionHostLocalTime,omitempty"` + UseSessionHostLocalTime *bool } // AgentUpdateProperties - The session host configuration for updating agent, monitoring agent, and stack component. type AgentUpdateProperties struct { // Time zone for maintenance as defined in https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. // Must be set if useLocalTime is true. - MaintenanceWindowTimeZone *string `json:"maintenanceWindowTimeZone,omitempty"` + MaintenanceWindowTimeZone *string // List of maintenance windows. Maintenance windows are 2 hours long. - MaintenanceWindows []*MaintenanceWindowProperties `json:"maintenanceWindows,omitempty"` + MaintenanceWindows []*MaintenanceWindowProperties // The type of maintenance for session host components. - Type *SessionHostComponentUpdateType `json:"type,omitempty"` + Type *SessionHostComponentUpdateType // Whether to use localTime of the virtual machine. - UseSessionHostLocalTime *bool `json:"useSessionHostLocalTime,omitempty"` + UseSessionHostLocalTime *bool } // Application - Schema for Application properties. type Application struct { // REQUIRED; Detailed properties for Application - Properties *ApplicationProperties `json:"properties,omitempty"` + Properties *ApplicationProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ApplicationGroup - Represents a ApplicationGroup definition. type ApplicationGroup struct { // REQUIRED; Detailed properties for ApplicationGroup - Properties *ApplicationGroupProperties `json:"properties,omitempty"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Properties *ApplicationGroupProperties + Identity *ResourceModelWithAllowedPropertySetIdentity // Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are // a kind of Microsoft.Web/sites type. If supported, the resource provider must // validate and persist this value. - Kind *string `json:"kind,omitempty"` + Kind *string // The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another // Azure resource. If this is present, complete mode deployment will not // delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` - SKU *ResourceModelWithAllowedPropertySetSKU `json:"sku,omitempty"` + ManagedBy *string + Plan *ResourceModelWithAllowedPropertySetPlan + SKU *ResourceModelWithAllowedPropertySetSKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header // per the normal etag convention. Entity tags are used for comparing two or more entities // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ApplicationGroupList - List of ApplicationGroup definitions. type ApplicationGroupList struct { // List of ApplicationGroup definitions. - Value []*ApplicationGroup `json:"value,omitempty"` + Value []*ApplicationGroup // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ApplicationGroupPatch - ApplicationGroup properties that can be patched. type ApplicationGroupPatch struct { // ApplicationGroup properties that can be patched. - Properties *ApplicationGroupPatchProperties `json:"properties,omitempty"` + Properties *ApplicationGroupPatchProperties // tags to be updated - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ApplicationGroupPatchProperties - ApplicationGroup properties that can be patched. type ApplicationGroupPatchProperties struct { // Description of ApplicationGroup. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of ApplicationGroup. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string } // ApplicationGroupProperties - Schema for ApplicationGroup properties. type ApplicationGroupProperties struct { // REQUIRED; Resource Type of ApplicationGroup. - ApplicationGroupType *ApplicationGroupType `json:"applicationGroupType,omitempty"` + ApplicationGroupType *ApplicationGroupType // REQUIRED; HostPool arm path of ApplicationGroup. - HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` + HostPoolArmPath *string // Description of ApplicationGroup. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of ApplicationGroup. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty" azure:"ro"` + CloudPcResource *bool // READ-ONLY; ObjectId of ApplicationGroup. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` + ObjectID *string // READ-ONLY; Workspace arm path of ApplicationGroup. - WorkspaceArmPath *string `json:"workspaceArmPath,omitempty" azure:"ro"` -} - -// ApplicationGroupsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationGroupsClient.CreateOrUpdate -// method. -type ApplicationGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ApplicationGroupsClientDeleteOptions contains the optional parameters for the ApplicationGroupsClient.Delete method. -type ApplicationGroupsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ApplicationGroupsClientGetOptions contains the optional parameters for the ApplicationGroupsClient.Get method. -type ApplicationGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ApplicationGroupsClientListByResourceGroupOptions contains the optional parameters for the ApplicationGroupsClient.NewListByResourceGroupPager -// method. -type ApplicationGroupsClientListByResourceGroupOptions struct { - // OData filter expression. Valid properties for filtering are applicationGroupType. - Filter *string - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// ApplicationGroupsClientListBySubscriptionOptions contains the optional parameters for the ApplicationGroupsClient.NewListBySubscriptionPager -// method. -type ApplicationGroupsClientListBySubscriptionOptions struct { - // OData filter expression. Valid properties for filtering are applicationGroupType. - Filter *string -} - -// ApplicationGroupsClientUpdateOptions contains the optional parameters for the ApplicationGroupsClient.Update method. -type ApplicationGroupsClientUpdateOptions struct { - // Object containing ApplicationGroup definitions. - ApplicationGroup *ApplicationGroupPatch + WorkspaceArmPath *string } // ApplicationList - List of Application definitions. type ApplicationList struct { // List of Application definitions. - Value []*Application `json:"value,omitempty"` + Value []*Application // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ApplicationPatch - Application properties that can be patched. type ApplicationPatch struct { // Detailed properties for Application - Properties *ApplicationPatchProperties `json:"properties,omitempty"` + Properties *ApplicationPatchProperties // tags to be updated - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // ApplicationPatchProperties - Application properties that can be patched. type ApplicationPatchProperties struct { // Resource Type of Application. - ApplicationType *RemoteApplicationType `json:"applicationType,omitempty"` + ApplicationType *RemoteApplicationType // Command Line Arguments for Application. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineArguments *string // Specifies whether this published application can be launched with command line arguments provided by the client, command // line arguments specified at publish time, or no command line arguments at all. - CommandLineSetting *CommandLineSetting `json:"commandLineSetting,omitempty"` + CommandLineSetting *CommandLineSetting // Description of Application. - Description *string `json:"description,omitempty"` + Description *string // Specifies a path for the executable file for the application. - FilePath *string `json:"filePath,omitempty"` + FilePath *string // Friendly name of Application. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` + IconIndex *int32 // Path to icon. - IconPath *string `json:"iconPath,omitempty"` + IconPath *string // Specifies the package application Id for MSIX applications - MsixPackageApplicationID *string `json:"msixPackageApplicationId,omitempty"` + MsixPackageApplicationID *string // Specifies the package family name for MSIX applications - MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` + MsixPackageFamilyName *string // Specifies whether to show the RemoteApp program in the RD Web Access server. - ShowInPortal *bool `json:"showInPortal,omitempty"` + ShowInPortal *bool } // ApplicationProperties - Schema for Application properties. type ApplicationProperties struct { // REQUIRED; Specifies whether this published application can be launched with command line arguments provided by the client, // command line arguments specified at publish time, or no command line arguments at all. - CommandLineSetting *CommandLineSetting `json:"commandLineSetting,omitempty"` + CommandLineSetting *CommandLineSetting // Resource Type of Application. - ApplicationType *RemoteApplicationType `json:"applicationType,omitempty"` + ApplicationType *RemoteApplicationType // Command Line Arguments for Application. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineArguments *string // Description of Application. - Description *string `json:"description,omitempty"` + Description *string // Specifies a path for the executable file for the application. - FilePath *string `json:"filePath,omitempty"` + FilePath *string // Friendly name of Application. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` + IconIndex *int32 // Path to icon. - IconPath *string `json:"iconPath,omitempty"` + IconPath *string // Specifies the package application Id for MSIX applications - MsixPackageApplicationID *string `json:"msixPackageApplicationId,omitempty"` + MsixPackageApplicationID *string // Specifies the package family name for MSIX applications - MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` + MsixPackageFamilyName *string // Specifies whether to show the RemoteApp program in the RD Web Access server. - ShowInPortal *bool `json:"showInPortal,omitempty"` + ShowInPortal *bool // READ-ONLY; the icon a 64 bit string as a byte array. - IconContent []byte `json:"iconContent,omitempty" azure:"ro"` + IconContent []byte // READ-ONLY; Hash of the icon. - IconHash *string `json:"iconHash,omitempty" azure:"ro"` + IconHash *string // READ-ONLY; ObjectId of Application. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` -} - -// ApplicationsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.CreateOrUpdate method. -type ApplicationsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientDeleteOptions contains the optional parameters for the ApplicationsClient.Delete method. -type ApplicationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. -type ApplicationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.NewListPager method. -type ApplicationsClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// ApplicationsClientUpdateOptions contains the optional parameters for the ApplicationsClient.Update method. -type ApplicationsClientUpdateOptions struct { - // Object containing Application definitions. - Application *ApplicationPatch + ObjectID *string } // CloudErrorProperties - Cloud error object properties. type CloudErrorProperties struct { // Error code - Code *string `json:"code,omitempty"` + Code *string // Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` + Message *string } // Desktop - Schema for Desktop properties. type Desktop struct { // Detailed properties for Desktop - Properties *DesktopProperties `json:"properties,omitempty"` + Properties *DesktopProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DesktopList - List of Desktop definitions. type DesktopList struct { // List of Desktop definitions. - Value []*Desktop `json:"value,omitempty"` + Value []*Desktop // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // DesktopPatch - Desktop properties that can be patched. type DesktopPatch struct { // Detailed properties for Desktop - Properties *DesktopPatchProperties `json:"properties,omitempty"` + Properties *DesktopPatchProperties // tags to be updated - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // DesktopPatchProperties - Desktop properties that can be patched. type DesktopPatchProperties struct { // Description of Desktop. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of Desktop. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string } // DesktopProperties - Schema for Desktop properties. type DesktopProperties struct { // Description of Desktop. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of Desktop. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // READ-ONLY; The icon a 64 bit string as a byte array. - IconContent []byte `json:"iconContent,omitempty" azure:"ro"` + IconContent []byte // READ-ONLY; Hash of the icon. - IconHash *string `json:"iconHash,omitempty" azure:"ro"` + IconHash *string // READ-ONLY; ObjectId of Desktop. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` -} - -// DesktopsClientGetOptions contains the optional parameters for the DesktopsClient.Get method. -type DesktopsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DesktopsClientListOptions contains the optional parameters for the DesktopsClient.NewListPager method. -type DesktopsClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// DesktopsClientUpdateOptions contains the optional parameters for the DesktopsClient.Update method. -type DesktopsClientUpdateOptions struct { - // Object containing Desktop definitions. - Desktop *DesktopPatch + ObjectID *string } // ExpandMsixImage - Represents the definition of contents retrieved after expanding the MSIX Image. type ExpandMsixImage struct { // Detailed properties for ExpandMsixImage - Properties *ExpandMsixImageProperties `json:"properties,omitempty"` + Properties *ExpandMsixImageProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ExpandMsixImageList - List of MSIX package properties retrieved from MSIX Image expansion. type ExpandMsixImageList struct { // List of MSIX package properties from give MSIX Image. - Value []*ExpandMsixImage `json:"value,omitempty"` + Value []*ExpandMsixImage // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ExpandMsixImageProperties - Schema for Expand MSIX Image properties. type ExpandMsixImageProperties struct { // User friendly Name to be displayed in the portal. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // VHD/CIM image path on Network Share. - ImagePath *string `json:"imagePath,omitempty"` + ImagePath *string // Make this version of the package the active one across the hostpool. - IsActive *bool `json:"isActive,omitempty"` + IsActive *bool // Specifies how to register Package in feed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` + IsRegularRegistration *bool // Date Package was last updated, found in the appxmanifest.xml. - LastUpdated *time.Time `json:"lastUpdated,omitempty"` + LastUpdated *time.Time // Alias of MSIX Package. - PackageAlias *string `json:"packageAlias,omitempty"` + PackageAlias *string // List of package applications. - PackageApplications []*MsixPackageApplications `json:"packageApplications,omitempty"` + PackageApplications []*MsixPackageApplications // List of package dependencies. - PackageDependencies []*MsixPackageDependencies `json:"packageDependencies,omitempty"` + PackageDependencies []*MsixPackageDependencies // Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - PackageFamilyName *string `json:"packageFamilyName,omitempty"` + PackageFamilyName *string // Package Full Name from appxmanifest.xml. - PackageFullName *string `json:"packageFullName,omitempty"` + PackageFullName *string // Package Name from appxmanifest.xml. - PackageName *string `json:"packageName,omitempty"` + PackageName *string // Relative Path to the package inside the image. - PackageRelativePath *string `json:"packageRelativePath,omitempty"` + PackageRelativePath *string // Package Version found in the appxmanifest.xml. - Version *string `json:"version,omitempty"` + Version *string } // HostPool - Represents a HostPool definition. type HostPool struct { // REQUIRED; Detailed properties for HostPool - Properties *HostPoolProperties `json:"properties,omitempty"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Properties *HostPoolProperties + Identity *ResourceModelWithAllowedPropertySetIdentity // Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are // a kind of Microsoft.Web/sites type. If supported, the resource provider must // validate and persist this value. - Kind *string `json:"kind,omitempty"` + Kind *string // The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another // Azure resource. If this is present, complete mode deployment will not // delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` - SKU *ResourceModelWithAllowedPropertySetSKU `json:"sku,omitempty"` + ManagedBy *string + Plan *ResourceModelWithAllowedPropertySetPlan + SKU *ResourceModelWithAllowedPropertySetSKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header // per the normal etag convention. Entity tags are used for comparing two or more entities // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // HostPoolList - List of HostPool definitions. type HostPoolList struct { // List of HostPool definitions. - Value []*HostPool `json:"value,omitempty"` + Value []*HostPool // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // HostPoolPatch - HostPool properties that can be patched. type HostPoolPatch struct { // HostPool properties that can be patched. - Properties *HostPoolPatchProperties `json:"properties,omitempty"` + Properties *HostPoolPatchProperties // tags to be updated - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // HostPoolPatchProperties - Properties of HostPool. type HostPoolPatchProperties struct { // The session host configuration for updating agent, monitoring agent, and stack component. - AgentUpdate *AgentUpdatePatchProperties `json:"agentUpdate,omitempty"` + AgentUpdate *AgentUpdatePatchProperties // Custom rdp property of HostPool. - CustomRdpProperty *string `json:"customRdpProperty,omitempty"` + CustomRdpProperty *string // Description of HostPool. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of HostPool. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // The type of the load balancer. - LoadBalancerType *LoadBalancerType `json:"loadBalancerType,omitempty"` + LoadBalancerType *LoadBalancerType // The max session limit of HostPool. - MaxSessionLimit *int32 `json:"maxSessionLimit,omitempty"` + MaxSessionLimit *int32 // PersonalDesktopAssignment type for HostPool. - PersonalDesktopAssignmentType *PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` + PersonalDesktopAssignmentType *PersonalDesktopAssignmentType // The type of preferred application group type, default to Desktop Application Group - PreferredAppGroupType *PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` + PreferredAppGroupType *PreferredAppGroupType + + // Enabled to allow this resource to be access from the public network + PublicNetworkAccess *HostpoolPublicNetworkAccess // The registration info of HostPool. - RegistrationInfo *RegistrationInfoPatch `json:"registrationInfo,omitempty"` + RegistrationInfo *RegistrationInfoPatch // The ring number of HostPool. - Ring *int32 `json:"ring,omitempty"` + Ring *int32 // ClientId for the registered Relying Party used to issue WVD SSO certificates. - SsoClientID *string `json:"ssoClientId,omitempty"` + SsoClientID *string // Path to Azure KeyVault storing the secret used for communication to ADFS. - SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` + SsoClientSecretKeyVaultPath *string // The type of single sign on Secret Type. - SsoSecretType *SSOSecretType `json:"ssoSecretType,omitempty"` + SsoSecretType *SSOSecretType // URL to customer ADFS server for signing WVD SSO certificates. - SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` + SsoadfsAuthority *string // The flag to turn on/off StartVMOnConnect feature. - StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` + StartVMOnConnect *bool // VM template for sessionhosts configuration within hostpool. - VMTemplate *string `json:"vmTemplate,omitempty"` + VMTemplate *string // Is validation environment. - ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` + ValidationEnvironment *bool } // HostPoolProperties - Properties of HostPool. type HostPoolProperties struct { // REQUIRED; HostPool type for desktop. - HostPoolType *HostPoolType `json:"hostPoolType,omitempty"` + HostPoolType *HostPoolType // REQUIRED; The type of the load balancer. - LoadBalancerType *LoadBalancerType `json:"loadBalancerType,omitempty"` + LoadBalancerType *LoadBalancerType // REQUIRED; The type of preferred application group type, default to Desktop Application Group - PreferredAppGroupType *PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` + PreferredAppGroupType *PreferredAppGroupType // The session host configuration for updating agent, monitoring agent, and stack component. - AgentUpdate *AgentUpdateProperties `json:"agentUpdate,omitempty"` + AgentUpdate *AgentUpdateProperties // Custom rdp property of HostPool. - CustomRdpProperty *string `json:"customRdpProperty,omitempty"` + CustomRdpProperty *string // Description of HostPool. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of HostPool. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // The max session limit of HostPool. - MaxSessionLimit *int32 `json:"maxSessionLimit,omitempty"` + MaxSessionLimit *int32 // PersonalDesktopAssignment type for HostPool. - PersonalDesktopAssignmentType *PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` + PersonalDesktopAssignmentType *PersonalDesktopAssignmentType + + // Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only + // be accessed via private endpoints + PublicNetworkAccess *HostpoolPublicNetworkAccess // The registration info of HostPool. - RegistrationInfo *RegistrationInfo `json:"registrationInfo,omitempty"` + RegistrationInfo *RegistrationInfo // The ring number of HostPool. - Ring *int32 `json:"ring,omitempty"` + Ring *int32 // ClientId for the registered Relying Party used to issue WVD SSO certificates. - SsoClientID *string `json:"ssoClientId,omitempty"` + SsoClientID *string // Path to Azure KeyVault storing the secret used for communication to ADFS. - SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` + SsoClientSecretKeyVaultPath *string // The type of single sign on Secret Type. - SsoSecretType *SSOSecretType `json:"ssoSecretType,omitempty"` + SsoSecretType *SSOSecretType // URL to customer ADFS server for signing WVD SSO certificates. - SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` + SsoadfsAuthority *string // The flag to turn on/off StartVMOnConnect feature. - StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` + StartVMOnConnect *bool // VM template for sessionhosts configuration within hostpool. - VMTemplate *string `json:"vmTemplate,omitempty"` + VMTemplate *string // Is validation environment. - ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` + ValidationEnvironment *bool // READ-ONLY; List of applicationGroup links. - ApplicationGroupReferences []*string `json:"applicationGroupReferences,omitempty" azure:"ro"` + ApplicationGroupReferences []*string // READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty" azure:"ro"` + CloudPcResource *bool // READ-ONLY; ObjectId of HostPool. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` -} - -// HostPoolsClientCreateOrUpdateOptions contains the optional parameters for the HostPoolsClient.CreateOrUpdate method. -type HostPoolsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// HostPoolsClientDeleteOptions contains the optional parameters for the HostPoolsClient.Delete method. -type HostPoolsClientDeleteOptions struct { - // Force flag to delete sessionHost. - Force *bool -} - -// HostPoolsClientGetOptions contains the optional parameters for the HostPoolsClient.Get method. -type HostPoolsClientGetOptions struct { - // placeholder for future optional parameters -} - -// HostPoolsClientListByResourceGroupOptions contains the optional parameters for the HostPoolsClient.NewListByResourceGroupPager -// method. -type HostPoolsClientListByResourceGroupOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// HostPoolsClientListOptions contains the optional parameters for the HostPoolsClient.NewListPager method. -type HostPoolsClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} + ObjectID *string -// HostPoolsClientRetrieveRegistrationTokenOptions contains the optional parameters for the HostPoolsClient.RetrieveRegistrationToken -// method. -type HostPoolsClientRetrieveRegistrationTokenOptions struct { - // placeholder for future optional parameters -} - -// HostPoolsClientUpdateOptions contains the optional parameters for the HostPoolsClient.Update method. -type HostPoolsClientUpdateOptions struct { - // Object containing HostPool definitions. - HostPool *HostPoolPatch + // READ-ONLY; List of private endpoint connection associated with the specified resource + PrivateEndpointConnections []*PrivateEndpointConnection } // Identity for the resource. type Identity struct { // The identity type. - Type *string `json:"type,omitempty"` + Type *string // READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + PrincipalID *string // READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + TenantID *string } // LogSpecification - Specifications of the Log for Azure Monitoring type LogSpecification struct { // Blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` + BlobDuration *string // Localized friendly display name of the log - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Name of the log - Name *string `json:"name,omitempty"` + Name *string } // MSIXImageURI - Represents URI referring to MSIX Image type MSIXImageURI struct { // URI to Image - URI *string `json:"uri,omitempty"` + URI *string } // MSIXPackage - Schema for MSIX Package properties. type MSIXPackage struct { // REQUIRED; Detailed properties for MSIX Package - Properties *MSIXPackageProperties `json:"properties,omitempty"` + Properties *MSIXPackageProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MSIXPackageList - List of MSIX Package definitions. type MSIXPackageList struct { // List of MSIX Package definitions. - Value []*MSIXPackage `json:"value,omitempty"` + Value []*MSIXPackage // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // MSIXPackagePatch - MSIX Package properties that can be patched. type MSIXPackagePatch struct { // Detailed properties for MSIX Package - Properties *MSIXPackagePatchProperties `json:"properties,omitempty"` + Properties *MSIXPackagePatchProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MSIXPackagePatchProperties - MSIX Package properties that can be patched. type MSIXPackagePatchProperties struct { // Display name for MSIX Package. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Set a version of the package to be active across hostpool. - IsActive *bool `json:"isActive,omitempty"` + IsActive *bool // Set Registration mode. Regular or Delayed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` + IsRegularRegistration *bool } // MSIXPackageProperties - Schema for MSIX Package properties. type MSIXPackageProperties struct { // User friendly Name to be displayed in the portal. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // VHD/CIM image path on Network Share. - ImagePath *string `json:"imagePath,omitempty"` + ImagePath *string // Make this version of the package the active one across the hostpool. - IsActive *bool `json:"isActive,omitempty"` + IsActive *bool // Specifies how to register Package in feed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` + IsRegularRegistration *bool // Date Package was last updated, found in the appxmanifest.xml. - LastUpdated *time.Time `json:"lastUpdated,omitempty"` + LastUpdated *time.Time // List of package applications. - PackageApplications []*MsixPackageApplications `json:"packageApplications,omitempty"` + PackageApplications []*MsixPackageApplications // List of package dependencies. - PackageDependencies []*MsixPackageDependencies `json:"packageDependencies,omitempty"` + PackageDependencies []*MsixPackageDependencies // Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - PackageFamilyName *string `json:"packageFamilyName,omitempty"` + PackageFamilyName *string // Package Name from appxmanifest.xml. - PackageName *string `json:"packageName,omitempty"` + PackageName *string // Relative Path to the package inside the image. - PackageRelativePath *string `json:"packageRelativePath,omitempty"` + PackageRelativePath *string // Package Version found in the appxmanifest.xml. - Version *string `json:"version,omitempty"` -} - -// MSIXPackagesClientCreateOrUpdateOptions contains the optional parameters for the MSIXPackagesClient.CreateOrUpdate method. -type MSIXPackagesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// MSIXPackagesClientDeleteOptions contains the optional parameters for the MSIXPackagesClient.Delete method. -type MSIXPackagesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// MSIXPackagesClientGetOptions contains the optional parameters for the MSIXPackagesClient.Get method. -type MSIXPackagesClientGetOptions struct { - // placeholder for future optional parameters -} - -// MSIXPackagesClientListOptions contains the optional parameters for the MSIXPackagesClient.NewListPager method. -type MSIXPackagesClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// MSIXPackagesClientUpdateOptions contains the optional parameters for the MSIXPackagesClient.Update method. -type MSIXPackagesClientUpdateOptions struct { - // Object containing MSIX Package definitions. - MsixPackage *MSIXPackagePatch + Version *string } // MaintenanceWindowPatchProperties - Maintenance window starting hour and day of week. type MaintenanceWindowPatchProperties struct { // Day of the week. - DayOfWeek *DayOfWeek `json:"dayOfWeek,omitempty"` + DayOfWeek *DayOfWeek // The update start hour of the day. (0 - 23) - Hour *int32 `json:"hour,omitempty"` + Hour *int32 } // MaintenanceWindowProperties - Maintenance window starting hour and day of week. type MaintenanceWindowProperties struct { // Day of the week. - DayOfWeek *DayOfWeek `json:"dayOfWeek,omitempty"` + DayOfWeek *DayOfWeek // The update start hour of the day. (0 - 23) - Hour *int32 `json:"hour,omitempty"` -} - -// MsixImagesClientExpandOptions contains the optional parameters for the MsixImagesClient.NewExpandPager method. -type MsixImagesClientExpandOptions struct { - // placeholder for future optional parameters + Hour *int32 } // MsixPackageApplications - Schema for MSIX Package Application properties. type MsixPackageApplications struct { // Package Application Id, found in appxmanifest.xml. - AppID *string `json:"appId,omitempty"` + AppID *string // Used to activate Package Application. Consists of Package Name and ApplicationID. Found in appxmanifest.xml. - AppUserModelID *string `json:"appUserModelID,omitempty"` + AppUserModelID *string // Description of Package Application. - Description *string `json:"description,omitempty"` + Description *string // User friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // User friendly name. - IconImageName *string `json:"iconImageName,omitempty"` + IconImageName *string // the icon a 64 bit string as a byte array. - RawIcon []byte `json:"rawIcon,omitempty"` + RawIcon []byte // the icon a 64 bit string as a byte array. - RawPNG []byte `json:"rawPng,omitempty"` + RawPNG []byte } // MsixPackageDependencies - Schema for MSIX Package Dependencies properties. type MsixPackageDependencies struct { // Name of package dependency. - DependencyName *string `json:"dependencyName,omitempty"` + DependencyName *string // Dependency version required. - MinVersion *string `json:"minVersion,omitempty"` + MinVersion *string // Name of dependency publisher. - Publisher *string `json:"publisher,omitempty"` + Publisher *string } // OperationProperties - Properties of the operation type OperationProperties struct { // Service specification payload - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + ServiceSpecification *ServiceSpecification } // Plan for the resource. type Plan struct { // REQUIRED; A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` + Name *string // REQUIRED; The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact // at the time of Data Market onboarding. - Product *string `json:"product,omitempty"` + Product *string // REQUIRED; The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` + Publisher *string // A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` + PromotionCode *string // The version of the desired product/artifact. - Version *string `json:"version,omitempty"` + Version *string +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionListResultWithSystemData - List of private endpoint connection associated with the specified storage +// account +type PrivateEndpointConnectionListResultWithSystemData struct { + // Array of private endpoint connections + Value []*PrivateEndpointConnectionWithSystemData + + // READ-ONLY; Link to the next page of results. + NextLink *string +} + +// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource of private end point. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateEndpointConnectionWithSystemData - The Private Endpoint Connection resource. +type PrivateEndpointConnectionWithSystemData struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource + + // READ-ONLY; Link to the next page of results. + NextLink *string +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource Private link DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus } // RegistrationInfo - Represents a RegistrationInfo definition. type RegistrationInfo struct { // Expiration time of registration token. - ExpirationTime *time.Time `json:"expirationTime,omitempty"` + ExpirationTime *time.Time // The type of resetting the token. - RegistrationTokenOperation *RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` + RegistrationTokenOperation *RegistrationTokenOperation // The registration token base64 encoded string. - Token *string `json:"token,omitempty"` + Token *string } // RegistrationInfoPatch - Represents a RegistrationInfo definition. type RegistrationInfoPatch struct { // Expiration time of registration token. - ExpirationTime *time.Time `json:"expirationTime,omitempty"` + ExpirationTime *time.Time // The type of resetting the token. - RegistrationTokenOperation *RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` + RegistrationTokenOperation *RegistrationTokenOperation } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ResourceModelWithAllowedPropertySet - The resource model definition containing the full set of allowed properties for a // resource. Except properties bag, there cannot be a top level property outside of this set. type ResourceModelWithAllowedPropertySet struct { - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Identity *ResourceModelWithAllowedPropertySetIdentity // Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are // a kind of Microsoft.Web/sites type. If supported, the resource provider must // validate and persist this value. - Kind *string `json:"kind,omitempty"` + Kind *string // The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another // Azure resource. If this is present, complete mode deployment will not // delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` - SKU *ResourceModelWithAllowedPropertySetSKU `json:"sku,omitempty"` + ManagedBy *string + Plan *ResourceModelWithAllowedPropertySetPlan + SKU *ResourceModelWithAllowedPropertySetSKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header // per the normal etag convention. Entity tags are used for comparing two or more entities // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } type ResourceModelWithAllowedPropertySetIdentity struct { // The identity type. - Type *string `json:"type,omitempty"` + Type *string // READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + PrincipalID *string // READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + TenantID *string } type ResourceModelWithAllowedPropertySetPlan struct { // REQUIRED; A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` + Name *string // REQUIRED; The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact // at the time of Data Market onboarding. - Product *string `json:"product,omitempty"` + Product *string // REQUIRED; The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` + Publisher *string // A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` + PromotionCode *string // The version of the desired product/artifact. - Version *string `json:"version,omitempty"` + Version *string } type ResourceModelWithAllowedPropertySetSKU struct { // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` + Name *string // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the // resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` + Capacity *int32 // If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` + Family *string // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - Size *string `json:"size,omitempty"` + Size *string // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required // on a PUT. - Tier *SKUTier `json:"tier,omitempty"` + Tier *SKUTier } // ResourceProviderOperation - Supported operation of this resource provider. type ResourceProviderOperation struct { // Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + Display *ResourceProviderOperationDisplay // Is a data action. - IsDataAction *bool `json:"isDataAction,omitempty"` + IsDataAction *bool // Operation name, in format of {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` + Name *string // Properties of the operation - Properties *OperationProperties `json:"properties,omitempty"` + Properties *OperationProperties } // ResourceProviderOperationDisplay - Display metadata associated with the operation. type ResourceProviderOperationDisplay struct { // Description of this operation. - Description *string `json:"description,omitempty"` + Description *string // Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` + Operation *string // Resource provider: Microsoft Desktop Virtualization. - Provider *string `json:"provider,omitempty"` + Provider *string // Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` + Resource *string } // ResourceProviderOperationList - Result of the request to list operations. type ResourceProviderOperationList struct { // List of operations supported by this resource provider. - Value []*ResourceProviderOperation `json:"value,omitempty"` + Value []*ResourceProviderOperation // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // SKU - The resource model definition representing SKU type SKU struct { // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` + Name *string // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the // resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` + Capacity *int32 // If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` + Family *string // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - Size *string `json:"size,omitempty"` + Size *string // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required // on a PUT. - Tier *SKUTier `json:"tier,omitempty"` + Tier *SKUTier } // ScalingHostPoolReference - Scaling plan reference to hostpool. type ScalingHostPoolReference struct { // Arm path of referenced hostpool. - HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` + HostPoolArmPath *string // Is the scaling plan enabled for this hostpool. - ScalingPlanEnabled *bool `json:"scalingPlanEnabled,omitempty"` + ScalingPlanEnabled *bool } // ScalingPlan - Represents a scaling plan definition. type ScalingPlan struct { // REQUIRED; Detailed properties for scaling plan. - Properties *ScalingPlanProperties `json:"properties,omitempty"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Properties *ScalingPlanProperties + Identity *ResourceModelWithAllowedPropertySetIdentity // Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are // a kind of Microsoft.Web/sites type. If supported, the resource provider must // validate and persist this value. - Kind *string `json:"kind,omitempty"` + Kind *string // The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another // Azure resource. If this is present, complete mode deployment will not // delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` - SKU *ResourceModelWithAllowedPropertySetSKU `json:"sku,omitempty"` + ManagedBy *string + Plan *ResourceModelWithAllowedPropertySetPlan + SKU *ResourceModelWithAllowedPropertySetSKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header // per the normal etag convention. Entity tags are used for comparing two or more entities // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ScalingPlanList - List of scaling plan definitions. type ScalingPlanList struct { // List of scaling plan definitions. - Value []*ScalingPlan `json:"value,omitempty"` + Value []*ScalingPlan // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ScalingPlanPatch - Scaling plan properties that can be patched. type ScalingPlanPatch struct { // Detailed properties for scaling plan - Properties *ScalingPlanPatchProperties `json:"properties,omitempty"` + Properties *ScalingPlanPatchProperties // tags to be updated - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // ScalingPlanPatchProperties - Scaling plan properties. type ScalingPlanPatchProperties struct { // Description of scaling plan. - Description *string `json:"description,omitempty"` + Description *string // Exclusion tag for scaling plan. - ExclusionTag *string `json:"exclusionTag,omitempty"` + ExclusionTag *string // User friendly name of scaling plan. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // List of ScalingHostPoolReference definitions. - HostPoolReferences []*ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` + HostPoolReferences []*ScalingHostPoolReference // List of ScalingSchedule definitions. - Schedules []*ScalingSchedule `json:"schedules,omitempty"` + Schedules []*ScalingSchedule // Timezone of the scaling plan. - TimeZone *string `json:"timeZone,omitempty"` + TimeZone *string } // ScalingPlanPooledSchedule - Represents a ScalingPlanPooledSchedule definition. type ScalingPlanPooledSchedule struct { // REQUIRED; Detailed properties for ScalingPlanPooledSchedule - Properties *ScalingPlanPooledScheduleProperties `json:"properties,omitempty"` + Properties *ScalingPlanPooledScheduleProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ScalingPlanPooledScheduleList - List of ScalingPlanPooledSchedule definitions. type ScalingPlanPooledScheduleList struct { // List of ScalingPlanPooledSchedule definitions. - Value []*ScalingPlanPooledSchedule `json:"value,omitempty"` + Value []*ScalingPlanPooledSchedule // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // ScalingPlanPooledSchedulePatch - ScalingPlanPooledSchedule properties that can be patched. type ScalingPlanPooledSchedulePatch struct { // Detailed properties for ScalingPlanPooledSchedule - Properties *ScalingPlanPooledScheduleProperties `json:"properties,omitempty"` + Properties *ScalingPlanPooledScheduleProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ScalingPlanPooledScheduleProperties - A ScalingPlanPooledSchedule. type ScalingPlanPooledScheduleProperties struct { // Set of days of the week on which this schedule is active. - DaysOfWeek []*DayOfWeek `json:"daysOfWeek,omitempty"` + DaysOfWeek []*DayOfWeek // Load balancing algorithm for off-peak period. - OffPeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"offPeakLoadBalancingAlgorithm,omitempty"` + OffPeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Starting time for off-peak period. - OffPeakStartTime *Time `json:"offPeakStartTime,omitempty"` + OffPeakStartTime *Time // Load balancing algorithm for peak period. - PeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"peakLoadBalancingAlgorithm,omitempty"` + PeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Starting time for peak period. - PeakStartTime *Time `json:"peakStartTime,omitempty"` + PeakStartTime *Time // Capacity threshold for ramp down period. - RampDownCapacityThresholdPct *int32 `json:"rampDownCapacityThresholdPct,omitempty"` + RampDownCapacityThresholdPct *int32 // Should users be logged off forcefully from hosts. - RampDownForceLogoffUsers *bool `json:"rampDownForceLogoffUsers,omitempty"` + RampDownForceLogoffUsers *bool // Load balancing algorithm for ramp down period. - RampDownLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampDownLoadBalancingAlgorithm,omitempty"` + RampDownLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Minimum host percentage for ramp down period. - RampDownMinimumHostsPct *int32 `json:"rampDownMinimumHostsPct,omitempty"` + RampDownMinimumHostsPct *int32 // Notification message for users during ramp down period. - RampDownNotificationMessage *string `json:"rampDownNotificationMessage,omitempty"` + RampDownNotificationMessage *string // Starting time for ramp down period. - RampDownStartTime *Time `json:"rampDownStartTime,omitempty"` + RampDownStartTime *Time // Specifies when to stop hosts during ramp down period. - RampDownStopHostsWhen *StopHostsWhen `json:"rampDownStopHostsWhen,omitempty"` + RampDownStopHostsWhen *StopHostsWhen // Number of minutes to wait to stop hosts during ramp down period. - RampDownWaitTimeMinutes *int32 `json:"rampDownWaitTimeMinutes,omitempty"` + RampDownWaitTimeMinutes *int32 // Capacity threshold for ramp up period. - RampUpCapacityThresholdPct *int32 `json:"rampUpCapacityThresholdPct,omitempty"` + RampUpCapacityThresholdPct *int32 // Load balancing algorithm for ramp up period. - RampUpLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampUpLoadBalancingAlgorithm,omitempty"` + RampUpLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Minimum host percentage for ramp up period. - RampUpMinimumHostsPct *int32 `json:"rampUpMinimumHostsPct,omitempty"` + RampUpMinimumHostsPct *int32 // Starting time for ramp up period. - RampUpStartTime *Time `json:"rampUpStartTime,omitempty"` -} - -// ScalingPlanPooledSchedulesClientCreateOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Create -// method. -type ScalingPlanPooledSchedulesClientCreateOptions struct { - // placeholder for future optional parameters -} - -// ScalingPlanPooledSchedulesClientDeleteOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Delete -// method. -type ScalingPlanPooledSchedulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ScalingPlanPooledSchedulesClientGetOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Get -// method. -type ScalingPlanPooledSchedulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ScalingPlanPooledSchedulesClientListOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.NewListPager -// method. -type ScalingPlanPooledSchedulesClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// ScalingPlanPooledSchedulesClientUpdateOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Update -// method. -type ScalingPlanPooledSchedulesClientUpdateOptions struct { - // Object containing ScalingPlanPooledSchedule definitions. - ScalingPlanSchedule *ScalingPlanPooledSchedulePatch + RampUpStartTime *Time } // ScalingPlanProperties - Scaling plan properties. type ScalingPlanProperties struct { // REQUIRED; Timezone of the scaling plan. - TimeZone *string `json:"timeZone,omitempty"` + TimeZone *string // Description of scaling plan. - Description *string `json:"description,omitempty"` + Description *string // Exclusion tag for scaling plan. - ExclusionTag *string `json:"exclusionTag,omitempty"` + ExclusionTag *string // User friendly name of scaling plan. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // List of ScalingHostPoolReference definitions. - HostPoolReferences []*ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` + HostPoolReferences []*ScalingHostPoolReference // HostPool type for desktop. - HostPoolType *ScalingHostPoolType `json:"hostPoolType,omitempty"` + HostPoolType *ScalingHostPoolType // List of ScalingPlanPooledSchedule definitions. - Schedules []*ScalingSchedule `json:"schedules,omitempty"` + Schedules []*ScalingSchedule // READ-ONLY; ObjectId of scaling plan. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` -} - -// ScalingPlansClientCreateOptions contains the optional parameters for the ScalingPlansClient.Create method. -type ScalingPlansClientCreateOptions struct { - // placeholder for future optional parameters -} - -// ScalingPlansClientDeleteOptions contains the optional parameters for the ScalingPlansClient.Delete method. -type ScalingPlansClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ScalingPlansClientGetOptions contains the optional parameters for the ScalingPlansClient.Get method. -type ScalingPlansClientGetOptions struct { - // placeholder for future optional parameters -} - -// ScalingPlansClientListByHostPoolOptions contains the optional parameters for the ScalingPlansClient.NewListByHostPoolPager -// method. -type ScalingPlansClientListByHostPoolOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// ScalingPlansClientListByResourceGroupOptions contains the optional parameters for the ScalingPlansClient.NewListByResourceGroupPager -// method. -type ScalingPlansClientListByResourceGroupOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// ScalingPlansClientListBySubscriptionOptions contains the optional parameters for the ScalingPlansClient.NewListBySubscriptionPager -// method. -type ScalingPlansClientListBySubscriptionOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// ScalingPlansClientUpdateOptions contains the optional parameters for the ScalingPlansClient.Update method. -type ScalingPlansClientUpdateOptions struct { - // Object containing scaling plan definitions. - ScalingPlan *ScalingPlanPatch + ObjectID *string } // ScalingSchedule - A ScalingPlanPooledSchedule. type ScalingSchedule struct { // Set of days of the week on which this schedule is active. - DaysOfWeek []*ScalingScheduleDaysOfWeekItem `json:"daysOfWeek,omitempty"` + DaysOfWeek []*ScalingScheduleDaysOfWeekItem // Name of the ScalingPlanPooledSchedule. - Name *string `json:"name,omitempty"` + Name *string // Load balancing algorithm for off-peak period. - OffPeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"offPeakLoadBalancingAlgorithm,omitempty"` + OffPeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Starting time for off-peak period. - OffPeakStartTime *Time `json:"offPeakStartTime,omitempty"` + OffPeakStartTime *Time // Load balancing algorithm for peak period. - PeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"peakLoadBalancingAlgorithm,omitempty"` + PeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Starting time for peak period. - PeakStartTime *Time `json:"peakStartTime,omitempty"` + PeakStartTime *Time // Capacity threshold for ramp down period. - RampDownCapacityThresholdPct *int32 `json:"rampDownCapacityThresholdPct,omitempty"` + RampDownCapacityThresholdPct *int32 // Should users be logged off forcefully from hosts. - RampDownForceLogoffUsers *bool `json:"rampDownForceLogoffUsers,omitempty"` + RampDownForceLogoffUsers *bool // Load balancing algorithm for ramp down period. - RampDownLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampDownLoadBalancingAlgorithm,omitempty"` + RampDownLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Minimum host percentage for ramp down period. - RampDownMinimumHostsPct *int32 `json:"rampDownMinimumHostsPct,omitempty"` + RampDownMinimumHostsPct *int32 // Notification message for users during ramp down period. - RampDownNotificationMessage *string `json:"rampDownNotificationMessage,omitempty"` + RampDownNotificationMessage *string // Starting time for ramp down period. - RampDownStartTime *Time `json:"rampDownStartTime,omitempty"` + RampDownStartTime *Time // Specifies when to stop hosts during ramp down period. - RampDownStopHostsWhen *StopHostsWhen `json:"rampDownStopHostsWhen,omitempty"` + RampDownStopHostsWhen *StopHostsWhen // Number of minutes to wait to stop hosts during ramp down period. - RampDownWaitTimeMinutes *int32 `json:"rampDownWaitTimeMinutes,omitempty"` + RampDownWaitTimeMinutes *int32 // Capacity threshold for ramp up period. - RampUpCapacityThresholdPct *int32 `json:"rampUpCapacityThresholdPct,omitempty"` + RampUpCapacityThresholdPct *int32 // Load balancing algorithm for ramp up period. - RampUpLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampUpLoadBalancingAlgorithm,omitempty"` + RampUpLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm // Minimum host percentage for ramp up period. - RampUpMinimumHostsPct *int32 `json:"rampUpMinimumHostsPct,omitempty"` + RampUpMinimumHostsPct *int32 // Starting time for ramp up period. - RampUpStartTime *Time `json:"rampUpStartTime,omitempty"` + RampUpStartTime *Time } // SendMessage - Represents message sent to a UserSession. type SendMessage struct { // Body of message. - MessageBody *string `json:"messageBody,omitempty"` + MessageBody *string // Title of message. - MessageTitle *string `json:"messageTitle,omitempty"` + MessageTitle *string } // ServiceSpecification - Service specification payload type ServiceSpecification struct { // Specifications of the Log for Azure Monitoring - LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty"` + LogSpecifications []*LogSpecification } // SessionHost - Represents a SessionHost definition. type SessionHost struct { // Detailed properties for SessionHost - Properties *SessionHostProperties `json:"properties,omitempty"` + Properties *SessionHostProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SessionHostHealthCheckFailureDetails - Contains details on the failure. type SessionHostHealthCheckFailureDetails struct { // READ-ONLY; Error code corresponding for the failure. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *int32 // READ-ONLY; The timestamp of the last update. - LastHealthCheckDateTime *time.Time `json:"lastHealthCheckDateTime,omitempty" azure:"ro"` + LastHealthCheckDateTime *time.Time // READ-ONLY; Failure message: hints on what is wrong and how to recover. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string } // SessionHostHealthCheckReport - The report for session host information. type SessionHostHealthCheckReport struct { // READ-ONLY; Additional detailed information on the failure. - AdditionalFailureDetails *SessionHostHealthCheckFailureDetails `json:"additionalFailureDetails,omitempty" azure:"ro"` + AdditionalFailureDetails *SessionHostHealthCheckFailureDetails // READ-ONLY; Represents the name of the health check operation performed. - HealthCheckName *HealthCheckName `json:"healthCheckName,omitempty" azure:"ro"` + HealthCheckName *HealthCheckName // READ-ONLY; Represents the Health state of the health check we performed. - HealthCheckResult *HealthCheckResult `json:"healthCheckResult,omitempty" azure:"ro"` + HealthCheckResult *HealthCheckResult } // SessionHostList - List of SessionHost definitions. type SessionHostList struct { // List of SessionHost definitions. - Value []*SessionHost `json:"value,omitempty"` + Value []*SessionHost // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // SessionHostPatch - SessionHost properties that can be patched. type SessionHostPatch struct { // Detailed properties for SessionHost - Properties *SessionHostPatchProperties `json:"properties,omitempty"` + Properties *SessionHostPatchProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SessionHostPatchProperties - SessionHost properties that can be patched. type SessionHostPatchProperties struct { // Allow a new session. - AllowNewSession *bool `json:"allowNewSession,omitempty"` + AllowNewSession *bool // User assigned to SessionHost. - AssignedUser *string `json:"assignedUser,omitempty"` + AssignedUser *string // Friendly name of SessionHost - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string } // SessionHostProperties - Schema for SessionHost properties. type SessionHostProperties struct { // Version of agent on SessionHost. - AgentVersion *string `json:"agentVersion,omitempty"` + AgentVersion *string // Allow a new session. - AllowNewSession *bool `json:"allowNewSession,omitempty"` + AllowNewSession *bool // User assigned to SessionHost. - AssignedUser *string `json:"assignedUser,omitempty"` + AssignedUser *string // Friendly name of SessionHost - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string // Last heart beat from SessionHost. - LastHeartBeat *time.Time `json:"lastHeartBeat,omitempty"` + LastHeartBeat *time.Time // The version of the OS on the session host. - OSVersion *string `json:"osVersion,omitempty"` + OSVersion *string // Number of sessions on SessionHost. - Sessions *int32 `json:"sessions,omitempty"` + Sessions *int32 // Status for a SessionHost. - Status *Status `json:"status,omitempty"` + Status *Status // The version of the side by side stack on the session host. - SxSStackVersion *string `json:"sxSStackVersion,omitempty"` + SxSStackVersion *string // The error message. - UpdateErrorMessage *string `json:"updateErrorMessage,omitempty"` + UpdateErrorMessage *string // Update state of a SessionHost. - UpdateState *UpdateState `json:"updateState,omitempty"` + UpdateState *UpdateState // READ-ONLY; The timestamp of the last update. - LastUpdateTime *time.Time `json:"lastUpdateTime,omitempty" azure:"ro"` + LastUpdateTime *time.Time // READ-ONLY; ObjectId of SessionHost. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` + ObjectID *string // READ-ONLY; Resource Id of SessionHost's underlying virtual machine. - ResourceID *string `json:"resourceId,omitempty" azure:"ro"` + ResourceID *string // READ-ONLY; List of SessionHostHealthCheckReports - SessionHostHealthCheckResults []*SessionHostHealthCheckReport `json:"sessionHostHealthCheckResults,omitempty" azure:"ro"` + SessionHostHealthCheckResults []*SessionHostHealthCheckReport // READ-ONLY; The timestamp of the status. - StatusTimestamp *time.Time `json:"statusTimestamp,omitempty" azure:"ro"` + StatusTimestamp *time.Time // READ-ONLY; Virtual Machine Id of SessionHost's underlying virtual machine. - VirtualMachineID *string `json:"virtualMachineId,omitempty" azure:"ro"` -} - -// SessionHostsClientDeleteOptions contains the optional parameters for the SessionHostsClient.Delete method. -type SessionHostsClientDeleteOptions struct { - // Force flag to force sessionHost deletion even when userSession exists. - Force *bool -} - -// SessionHostsClientGetOptions contains the optional parameters for the SessionHostsClient.Get method. -type SessionHostsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SessionHostsClientListOptions contains the optional parameters for the SessionHostsClient.NewListPager method. -type SessionHostsClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// SessionHostsClientUpdateOptions contains the optional parameters for the SessionHostsClient.Update method. -type SessionHostsClientUpdateOptions struct { - // Force flag to update assign, unassign or reassign personal desktop. - Force *bool - // Object containing SessionHost definitions. - SessionHost *SessionHostPatch + VirtualMachineID *string } // StartMenuItem - Represents a StartMenuItem definition. type StartMenuItem struct { // Detailed properties for StartMenuItem - Properties *StartMenuItemProperties `json:"properties,omitempty"` + Properties *StartMenuItemProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // StartMenuItemList - List of StartMenuItem definitions. type StartMenuItemList struct { // List of StartMenuItem definitions. - Value []*StartMenuItem `json:"value,omitempty"` + Value []*StartMenuItem // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // StartMenuItemProperties - Schema for StartMenuItem properties. type StartMenuItemProperties struct { // Alias of StartMenuItem. - AppAlias *string `json:"appAlias,omitempty"` + AppAlias *string // Command line arguments for StartMenuItem. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineArguments *string // Path to the file of StartMenuItem. - FilePath *string `json:"filePath,omitempty"` + FilePath *string // Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` + IconIndex *int32 // Path to the icon. - IconPath *string `json:"iconPath,omitempty"` -} - -// StartMenuItemsClientListOptions contains the optional parameters for the StartMenuItemsClient.NewListPager method. -type StartMenuItemsClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 + IconPath *string } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAt *time.Time // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` + CreatedByType *CreatedByType // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *CreatedByType } // Time - The time for a scaling action to occur. type Time struct { // REQUIRED; The hour. - Hour *int32 `json:"hour,omitempty"` + Hour *int32 // REQUIRED; The minute. - Minute *int32 `json:"minute,omitempty"` + Minute *int32 } // UserSession - Represents a UserSession definition. type UserSession struct { // Detailed properties for UserSession - Properties *UserSessionProperties `json:"properties,omitempty"` + Properties *UserSessionProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // UserSessionList - List of UserSession definitions. type UserSessionList struct { // List of UserSession definitions. - Value []*UserSession `json:"value,omitempty"` + Value []*UserSession // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // UserSessionProperties - Schema for UserSession properties. type UserSessionProperties struct { // The active directory user name. - ActiveDirectoryUserName *string `json:"activeDirectoryUserName,omitempty"` + ActiveDirectoryUserName *string // Application type of application. - ApplicationType *ApplicationType `json:"applicationType,omitempty"` + ApplicationType *ApplicationType // The timestamp of the user session create. - CreateTime *time.Time `json:"createTime,omitempty"` + CreateTime *time.Time // State of user session. - SessionState *SessionState `json:"sessionState,omitempty"` + SessionState *SessionState // The user principal name. - UserPrincipalName *string `json:"userPrincipalName,omitempty"` + UserPrincipalName *string // READ-ONLY; ObjectId of user session. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` -} - -// UserSessionsClientDeleteOptions contains the optional parameters for the UserSessionsClient.Delete method. -type UserSessionsClientDeleteOptions struct { - // Force flag to login off userSession. - Force *bool -} - -// UserSessionsClientDisconnectOptions contains the optional parameters for the UserSessionsClient.Disconnect method. -type UserSessionsClientDisconnectOptions struct { - // placeholder for future optional parameters -} - -// UserSessionsClientGetOptions contains the optional parameters for the UserSessionsClient.Get method. -type UserSessionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// UserSessionsClientListByHostPoolOptions contains the optional parameters for the UserSessionsClient.NewListByHostPoolPager -// method. -type UserSessionsClientListByHostPoolOptions struct { - // OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. - Filter *string - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// UserSessionsClientListOptions contains the optional parameters for the UserSessionsClient.NewListPager method. -type UserSessionsClientListOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// UserSessionsClientSendMessageOptions contains the optional parameters for the UserSessionsClient.SendMessage method. -type UserSessionsClientSendMessageOptions struct { - // Object containing message includes title and message body - SendMessage *SendMessage + ObjectID *string } // Workspace - Represents a Workspace definition. type Workspace struct { - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Identity *ResourceModelWithAllowedPropertySetIdentity // Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are // a kind of Microsoft.Web/sites type. If supported, the resource provider must // validate and persist this value. - Kind *string `json:"kind,omitempty"` + Kind *string // The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another // Azure resource. If this is present, complete mode deployment will not // delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` + ManagedBy *string + Plan *ResourceModelWithAllowedPropertySetPlan // Detailed properties for Workspace - Properties *WorkspaceProperties `json:"properties,omitempty"` - SKU *ResourceModelWithAllowedPropertySetSKU `json:"sku,omitempty"` + Properties *WorkspaceProperties + SKU *ResourceModelWithAllowedPropertySetSKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header // per the normal etag convention. Entity tags are used for comparing two or more entities // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // WorkspaceList - List of Workspace definitions. type WorkspaceList struct { // List of Workspace definitions. - Value []*Workspace `json:"value,omitempty"` + Value []*Workspace // READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string } // WorkspacePatch - Workspace properties that can be patched. type WorkspacePatch struct { // Detailed properties for Workspace - Properties *WorkspacePatchProperties `json:"properties,omitempty"` + Properties *WorkspacePatchProperties // tags to be updated - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // WorkspacePatchProperties - Workspace properties that can be patched. type WorkspacePatchProperties struct { // List of applicationGroup links. - ApplicationGroupReferences []*string `json:"applicationGroupReferences,omitempty"` + ApplicationGroupReferences []*string // Description of Workspace. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of Workspace. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string + + // Enabled to allow this resource to be access from the public network + PublicNetworkAccess *PublicNetworkAccess } // WorkspaceProperties - Schema for Workspace properties. type WorkspaceProperties struct { // List of applicationGroup resource Ids. - ApplicationGroupReferences []*string `json:"applicationGroupReferences,omitempty"` + ApplicationGroupReferences []*string // Description of Workspace. - Description *string `json:"description,omitempty"` + Description *string // Friendly name of Workspace. - FriendlyName *string `json:"friendlyName,omitempty"` + FriendlyName *string + + // Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only + // be accessed via private endpoints + PublicNetworkAccess *PublicNetworkAccess // READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty" azure:"ro"` + CloudPcResource *bool // READ-ONLY; ObjectId of Workspace. (internal use) - ObjectID *string `json:"objectId,omitempty" azure:"ro"` -} - -// WorkspacesClientCreateOrUpdateOptions contains the optional parameters for the WorkspacesClient.CreateOrUpdate method. -type WorkspacesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// WorkspacesClientDeleteOptions contains the optional parameters for the WorkspacesClient.Delete method. -type WorkspacesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// WorkspacesClientGetOptions contains the optional parameters for the WorkspacesClient.Get method. -type WorkspacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkspacesClientListByResourceGroupOptions contains the optional parameters for the WorkspacesClient.NewListByResourceGroupPager -// method. -type WorkspacesClientListByResourceGroupOptions struct { - // Initial number of items to skip. - InitialSkip *int32 - // Indicates whether the collection is descending. - IsDescending *bool - // Number of items per page. - PageSize *int32 -} - -// WorkspacesClientListBySubscriptionOptions contains the optional parameters for the WorkspacesClient.NewListBySubscriptionPager -// method. -type WorkspacesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} + ObjectID *string -// WorkspacesClientUpdateOptions contains the optional parameters for the WorkspacesClient.Update method. -type WorkspacesClientUpdateOptions struct { - // Object containing Workspace definitions. - Workspace *WorkspacePatch + // READ-ONLY; List of private endpoint connection associated with the specified resource + PrivateEndpointConnections []*PrivateEndpointConnection } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models_serde.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models_serde.go index bb6abcdda20d..34a84f25bba9 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/models_serde.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/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 armdesktopvirtualization @@ -1092,6 +1091,7 @@ func (h HostPoolPatchProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "maxSessionLimit", h.MaxSessionLimit) populate(objectMap, "personalDesktopAssignmentType", h.PersonalDesktopAssignmentType) populate(objectMap, "preferredAppGroupType", h.PreferredAppGroupType) + populate(objectMap, "publicNetworkAccess", h.PublicNetworkAccess) populate(objectMap, "registrationInfo", h.RegistrationInfo) populate(objectMap, "ring", h.Ring) populate(objectMap, "ssoClientId", h.SsoClientID) @@ -1137,6 +1137,9 @@ func (h *HostPoolPatchProperties) UnmarshalJSON(data []byte) error { case "preferredAppGroupType": err = unpopulate(val, "PreferredAppGroupType", &h.PreferredAppGroupType) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &h.PublicNetworkAccess) + delete(rawMsg, key) case "registrationInfo": err = unpopulate(val, "RegistrationInfo", &h.RegistrationInfo) delete(rawMsg, key) @@ -1187,6 +1190,8 @@ func (h HostPoolProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "objectId", h.ObjectID) populate(objectMap, "personalDesktopAssignmentType", h.PersonalDesktopAssignmentType) populate(objectMap, "preferredAppGroupType", h.PreferredAppGroupType) + populate(objectMap, "privateEndpointConnections", h.PrivateEndpointConnections) + populate(objectMap, "publicNetworkAccess", h.PublicNetworkAccess) populate(objectMap, "registrationInfo", h.RegistrationInfo) populate(objectMap, "ring", h.Ring) populate(objectMap, "ssoClientId", h.SsoClientID) @@ -1244,6 +1249,12 @@ func (h *HostPoolProperties) UnmarshalJSON(data []byte) error { case "preferredAppGroupType": err = unpopulate(val, "PreferredAppGroupType", &h.PreferredAppGroupType) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &h.PrivateEndpointConnections) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &h.PublicNetworkAccess) + delete(rawMsg, key) case "registrationInfo": err = unpopulate(val, "RegistrationInfo", &h.RegistrationInfo) delete(rawMsg, key) @@ -1809,6 +1820,321 @@ func (p *Plan) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResultWithSystemData. +func (p PrivateEndpointConnectionListResultWithSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResultWithSystemData. +func (p *PrivateEndpointConnectionListResultWithSystemData) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionWithSystemData. +func (p PrivateEndpointConnectionWithSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionWithSystemData. +func (p *PrivateEndpointConnectionWithSystemData) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RegistrationInfo. func (r RegistrationInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3641,6 +3967,7 @@ func (w WorkspacePatchProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "applicationGroupReferences", w.ApplicationGroupReferences) populate(objectMap, "description", w.Description) populate(objectMap, "friendlyName", w.FriendlyName) + populate(objectMap, "publicNetworkAccess", w.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -3662,6 +3989,9 @@ func (w *WorkspacePatchProperties) UnmarshalJSON(data []byte) error { case "friendlyName": err = unpopulate(val, "FriendlyName", &w.FriendlyName) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &w.PublicNetworkAccess) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -3678,6 +4008,8 @@ func (w WorkspaceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "description", w.Description) populate(objectMap, "friendlyName", w.FriendlyName) populate(objectMap, "objectId", w.ObjectID) + populate(objectMap, "privateEndpointConnections", w.PrivateEndpointConnections) + populate(objectMap, "publicNetworkAccess", w.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -3705,6 +4037,12 @@ func (w *WorkspaceProperties) UnmarshalJSON(data []byte) error { case "objectId": err = unpopulate(val, "ObjectID", &w.ObjectID) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &w.PrivateEndpointConnections) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &w.PublicNetworkAccess) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client.go index 827fa111327f..9e45a5e37054 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_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 armdesktopvirtualization @@ -46,7 +45,7 @@ func NewMsixImagesClient(subscriptionID string, credential azcore.TokenCredentia // NewExpandPager - Expands and Lists MSIX packages in an Image, given the Image Path. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - msixImageURI - Object containing URI to MSIX Image @@ -99,10 +98,13 @@ func (client *MsixImagesClient) expandCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, msixImageURI) + if err := runtime.MarshalAsJSON(req, msixImageURI); err != nil { + return nil, err + } + return req, nil } // expandHandleResponse handles the Expand response. diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client_example_test.go deleted file mode 100644 index 2fc2fb687542..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msiximages_client_example_test.go +++ /dev/null @@ -1,127 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixImage_Expand_Post.json -func ExampleMsixImagesClient_NewExpandPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMsixImagesClient().NewExpandPager("resourceGroup1", "hostpool1", armdesktopvirtualization.MSIXImageURI{ - URI: to.Ptr("imagepath"), - }, 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.ExpandMsixImageList = armdesktopvirtualization.ExpandMsixImageList{ - // Value: []*armdesktopvirtualization.ExpandMsixImage{ - // { - // Name: to.Ptr("hostpool1/expandmsiximage"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/expandmsiximage"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/expandmsiximage"), - // Properties: &armdesktopvirtualization.ExpandMsixImageProperties{ - // DisplayName: to.Ptr("displayname"), - // ImagePath: to.Ptr("imagepath"), - // IsActive: to.Ptr(false), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageAlias: to.Ptr("msixpackagealias"), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("PackageApplicationDescription"), - // AppID: to.Ptr("AppId"), - // AppUserModelID: to.Ptr("AppUserModelId"), - // FriendlyName: to.Ptr("FriendlyName"), - // IconImageName: to.Ptr("Iconimagename"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // }, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName"), - // PackageFullName: to.Ptr("MsixPackage_FullName"), - // PackageName: to.Ptr("MsixPackageName"), - // PackageRelativePath: to.Ptr("packagerelativepath"), - // Version: to.Ptr("packageversion"), - // }, - // }, - // { - // Name: to.Ptr("hostpool1/expandmsiximage"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/expandmsiximage"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/expandmsiximage"), - // Properties: &armdesktopvirtualization.ExpandMsixImageProperties{ - // DisplayName: to.Ptr("displayname2"), - // ImagePath: to.Ptr("imagepath"), - // IsActive: to.Ptr(false), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageAlias: to.Ptr("msixpackagealias2"), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("PackageApplicationDescription1"), - // AppID: to.Ptr("AppId1"), - // AppUserModelID: to.Ptr("AppUserModelId1"), - // FriendlyName: to.Ptr("FriendlyName1"), - // IconImageName: to.Ptr("Iconimagename1"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }, - // { - // Description: to.Ptr("PackageApplicationDescription2"), - // AppID: to.Ptr("AppId2"), - // AppUserModelID: to.Ptr("AppUserModelId2"), - // FriendlyName: to.Ptr("FriendlyName2"), - // IconImageName: to.Ptr("Iconimagename2"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // { - // DependencyName: to.Ptr("MsixPackageDependency1"), - // MinVersion: to.Ptr("ver1"), - // Publisher: to.Ptr("PublisherName1"), - // }, - // { - // DependencyName: to.Ptr("MsixPackageDependency2"), - // MinVersion: to.Ptr("ver2"), - // Publisher: to.Ptr("PublisherName2"), - // }}, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName2"), - // PackageFullName: to.Ptr("MsixPackage_FullName2"), - // PackageName: to.Ptr("MsixPackageName2"), - // PackageRelativePath: to.Ptr("packagerelativepath2"), - // Version: to.Ptr("packageversion"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client.go index adfd8ab8a35e..be40a9a71e64 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_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 armdesktopvirtualization @@ -48,7 +47,7 @@ func NewMSIXPackagesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or update a MSIX package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - msixPackageFullName - The version specific package full name of the MSIX package within specified hostpool @@ -56,18 +55,21 @@ func NewMSIXPackagesClient(subscriptionID string, credential azcore.TokenCredent // - options - MSIXPackagesClientCreateOrUpdateOptions contains the optional parameters for the MSIXPackagesClient.CreateOrUpdate // method. func (client *MSIXPackagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage MSIXPackage, options *MSIXPackagesClientCreateOrUpdateOptions) (MSIXPackagesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostPoolName, msixPackageFullName, msixPackage, options) if err != nil { return MSIXPackagesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MSIXPackagesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return MSIXPackagesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return MSIXPackagesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -94,10 +96,13 @@ func (client *MSIXPackagesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, msixPackage) + if err := runtime.MarshalAsJSON(req, msixPackage); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -112,22 +117,24 @@ func (client *MSIXPackagesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Remove an MSIX Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - msixPackageFullName - The version specific package full name of the MSIX package within specified hostpool // - options - MSIXPackagesClientDeleteOptions contains the optional parameters for the MSIXPackagesClient.Delete method. func (client *MSIXPackagesClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, options *MSIXPackagesClientDeleteOptions) (MSIXPackagesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostPoolName, msixPackageFullName, options) if err != nil { return MSIXPackagesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MSIXPackagesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return MSIXPackagesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MSIXPackagesClientDeleteResponse{}, err } return MSIXPackagesClientDeleteResponse{}, nil } @@ -156,7 +163,7 @@ func (client *MSIXPackagesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -165,24 +172,27 @@ func (client *MSIXPackagesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a msixpackage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - msixPackageFullName - The version specific package full name of the MSIX package within specified hostpool // - options - MSIXPackagesClientGetOptions contains the optional parameters for the MSIXPackagesClient.Get method. func (client *MSIXPackagesClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, options *MSIXPackagesClientGetOptions) (MSIXPackagesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, hostPoolName, msixPackageFullName, options) if err != nil { return MSIXPackagesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MSIXPackagesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MSIXPackagesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MSIXPackagesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -209,7 +219,7 @@ func (client *MSIXPackagesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -226,7 +236,7 @@ func (client *MSIXPackagesClient) getHandleResponse(resp *http.Response) (MSIXPa // NewListPager - List MSIX packages in hostpool. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - MSIXPackagesClientListOptions contains the optional parameters for the MSIXPackagesClient.NewListPager method. @@ -278,7 +288,7 @@ func (client *MSIXPackagesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -305,24 +315,27 @@ func (client *MSIXPackagesClient) listHandleResponse(resp *http.Response) (MSIXP // Update - Update an MSIX Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - msixPackageFullName - The version specific package full name of the MSIX package within specified hostpool // - options - MSIXPackagesClientUpdateOptions contains the optional parameters for the MSIXPackagesClient.Update method. func (client *MSIXPackagesClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, options *MSIXPackagesClientUpdateOptions) (MSIXPackagesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, hostPoolName, msixPackageFullName, options) if err != nil { return MSIXPackagesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MSIXPackagesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MSIXPackagesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MSIXPackagesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -349,11 +362,14 @@ func (client *MSIXPackagesClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.MsixPackage != nil { - return req, runtime.MarshalAsJSON(req, *options.MsixPackage) + if err := runtime.MarshalAsJSON(req, *options.MsixPackage); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client_example_test.go deleted file mode 100644 index 1b992d4222ff..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/msixpackages_client_example_test.go +++ /dev/null @@ -1,364 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixPackage_Get.json -func ExampleMSIXPackagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMSIXPackagesClient().Get(ctx, "resourceGroup1", "hostpool1", "packagefullname", 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.MSIXPackage = armdesktopvirtualization.MSIXPackage{ - // Name: to.Ptr("hostpool1/MsixPackageFullName"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/msixpackages"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourcegroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/msixpackages/msixPackageFullName"), - // Properties: &armdesktopvirtualization.MSIXPackageProperties{ - // DisplayName: to.Ptr("dis"), - // ImagePath: to.Ptr("imagepath"), - // IsActive: to.Ptr(false), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("desc"), - // AppID: to.Ptr("Application_Id"), - // AppUserModelID: to.Ptr("Application_ModelID"), - // FriendlyName: to.Ptr("fri"), - // IconImageName: to.Ptr("Apptile"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // { - // DependencyName: to.Ptr("MsixPackage_Dependency_Name"), - // MinVersion: to.Ptr("packageDep_version"), - // Publisher: to.Ptr("MsixPackage_Dependency_Publisher"), - // }}, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName"), - // PackageName: to.Ptr("MsixPackage_Name"), - // PackageRelativePath: to.Ptr("MsixPackage_RelativePackageRoot"), - // Version: to.Ptr("version"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixPackage_Create.json -func ExampleMSIXPackagesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMSIXPackagesClient().CreateOrUpdate(ctx, "resourceGroup1", "hostpool1", "msixpackagefullname", armdesktopvirtualization.MSIXPackage{ - Properties: &armdesktopvirtualization.MSIXPackageProperties{ - DisplayName: to.Ptr("displayname"), - ImagePath: to.Ptr("imagepath"), - IsActive: to.Ptr(false), - IsRegularRegistration: to.Ptr(false), - LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t }()), - PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - { - Description: to.Ptr("application-desc"), - AppID: to.Ptr("ApplicationId"), - AppUserModelID: to.Ptr("AppUserModelId"), - FriendlyName: to.Ptr("friendlyname"), - IconImageName: to.Ptr("Apptile"), - RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - }}, - PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - { - DependencyName: to.Ptr("MsixTest_Dependency_Name"), - MinVersion: to.Ptr("version"), - Publisher: to.Ptr("PublishedName"), - }}, - PackageFamilyName: to.Ptr("MsixPackage_FamilyName"), - PackageName: to.Ptr("MsixPackage_name"), - PackageRelativePath: to.Ptr("packagerelativepath"), - Version: to.Ptr("version"), - }, - }, 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.MSIXPackage = armdesktopvirtualization.MSIXPackage{ - // Name: to.Ptr("hostpool1/MsixPackageFullName"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/msixpackages"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourcegroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/msixpackages/msixPackageFullName"), - // Properties: &armdesktopvirtualization.MSIXPackageProperties{ - // DisplayName: to.Ptr("dis"), - // ImagePath: to.Ptr("imagepath"), - // IsActive: to.Ptr(false), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("desc"), - // AppID: to.Ptr("Application_Id"), - // AppUserModelID: to.Ptr("Application_ModelID"), - // FriendlyName: to.Ptr("fri"), - // IconImageName: to.Ptr("Apptile"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // { - // DependencyName: to.Ptr("MsixPackage_Dependency_Name"), - // MinVersion: to.Ptr("packageDep_version"), - // Publisher: to.Ptr("MsixPackage_Dependency_Publisher"), - // }}, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName"), - // PackageName: to.Ptr("MsixPackage_Name"), - // PackageRelativePath: to.Ptr("MsixPackage_RelativePackageRoot"), - // Version: to.Ptr("version"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixPackage_Delete.json -func ExampleMSIXPackagesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMSIXPackagesClient().Delete(ctx, "resourceGroup1", "hostpool1", "packagefullname", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixPackage_Update.json -func ExampleMSIXPackagesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMSIXPackagesClient().Update(ctx, "resourceGroup1", "hostpool1", "msixpackagefullname", &armdesktopvirtualization.MSIXPackagesClientUpdateOptions{MsixPackage: &armdesktopvirtualization.MSIXPackagePatch{ - Properties: &armdesktopvirtualization.MSIXPackagePatchProperties{ - DisplayName: to.Ptr("displayname"), - IsActive: to.Ptr(true), - IsRegularRegistration: to.Ptr(false), - }, - }, - }) - 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.MSIXPackage = armdesktopvirtualization.MSIXPackage{ - // Name: to.Ptr("hostpool1/MsixPackageFullName"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/msixpackages"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourcegroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/msixpackages/msixPackageFullName"), - // Properties: &armdesktopvirtualization.MSIXPackageProperties{ - // DisplayName: to.Ptr("dis"), - // ImagePath: to.Ptr("imagepath"), - // IsActive: to.Ptr(true), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("desc"), - // AppID: to.Ptr("Application_Id"), - // AppUserModelID: to.Ptr("Application_ModelID"), - // FriendlyName: to.Ptr("fri"), - // IconImageName: to.Ptr("Apptile"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // { - // DependencyName: to.Ptr("MsixPackage_Dependency_Name"), - // MinVersion: to.Ptr("packageDep_version"), - // Publisher: to.Ptr("MsixPackage_Dependency_Publisher"), - // }}, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName"), - // PackageName: to.Ptr("MsixPackage_Name"), - // PackageRelativePath: to.Ptr("MsixPackage_RelativePackageRoot"), - // Version: to.Ptr("version"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixPackage_List.json -func ExampleMSIXPackagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMSIXPackagesClient().NewListPager("resourceGroup1", "hostpool1", &armdesktopvirtualization.MSIXPackagesClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.MSIXPackageList = armdesktopvirtualization.MSIXPackageList{ - // Value: []*armdesktopvirtualization.MSIXPackage{ - // { - // Name: to.Ptr("hostpool1/MsixPackageFullName"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/msixpackages"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourcegroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/msixpackages/msixPackageFullName"), - // Properties: &armdesktopvirtualization.MSIXPackageProperties{ - // DisplayName: to.Ptr("dis"), - // ImagePath: to.Ptr("imagepath"), - // IsActive: to.Ptr(false), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("desc"), - // AppID: to.Ptr("Application_Id"), - // AppUserModelID: to.Ptr("Application_ModelID"), - // FriendlyName: to.Ptr("fri"), - // IconImageName: to.Ptr("Apptile"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // { - // DependencyName: to.Ptr("MsixPackage_Dependency_Name"), - // MinVersion: to.Ptr("packageDep_version"), - // Publisher: to.Ptr("MsixPackage_Dependency_Publisher"), - // }}, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName"), - // PackageName: to.Ptr("MsixPackage_Name"), - // PackageRelativePath: to.Ptr("MsixPackage_RelativePackageRoot"), - // Version: to.Ptr("version"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("hostpool1/MsixPackageFullName2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostpools/msixpackages"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourcegroups/resourcegroup1/providers/Microsoft.DesktopVirtualization/hostpools/hostpool1/msixpackages/msixPackageFullName2"), - // Properties: &armdesktopvirtualization.MSIXPackageProperties{ - // DisplayName: to.Ptr("dis2"), - // ImagePath: to.Ptr("imagepath2"), - // IsActive: to.Ptr(false), - // IsRegularRegistration: to.Ptr(false), - // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // PackageApplications: []*armdesktopvirtualization.MsixPackageApplications{ - // { - // Description: to.Ptr("desc2"), - // AppID: to.Ptr("Application_Id2"), - // AppUserModelID: to.Ptr("Application_ModelID2"), - // FriendlyName: to.Ptr("fri2"), - // IconImageName: to.Ptr("Apptile2"), - // RawIcon: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // RawPNG: []byte("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), - // }}, - // PackageDependencies: []*armdesktopvirtualization.MsixPackageDependencies{ - // { - // DependencyName: to.Ptr("MsixPackage_Dependency_Name2"), - // MinVersion: to.Ptr("packageDep_version2"), - // Publisher: to.Ptr("MsixPackage_Dependency_Publisher2"), - // }}, - // PackageFamilyName: to.Ptr("MsixPackage_FamilyName2"), - // PackageName: to.Ptr("MsixPackage_Name2"), - // PackageRelativePath: to.Ptr("MsixPackage_RelativePackageRoot2"), - // Version: to.Ptr("version2"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client.go index ff0e705ee458..590f84489207 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_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 armdesktopvirtualization @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List all of the available operations the Desktop Virtualization resource provider supports. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client_example_test.go deleted file mode 100644 index 6c6b9ee2cf3c..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/operations_client_example_test.go +++ /dev/null @@ -1,83 +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 armdesktopvirtualization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/OperationDescription_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(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.ResourceProviderOperationList = armdesktopvirtualization.ResourceProviderOperationList{ - // Value: []*armdesktopvirtualization.ResourceProviderOperation{ - // { - // Name: to.Ptr("Microsoft.DesktopVirtualization/hostpools/read"), - // Display: &armdesktopvirtualization.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Read hostpool"), - // Operation: to.Ptr("Read hostpool"), - // Provider: to.Ptr("Microsoft.DesktopVirtualization"), - // Resource: to.Ptr("hostpools"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.DesktopVirtualization/hostpools/write"), - // Display: &armdesktopvirtualization.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Write hostpool"), - // Operation: to.Ptr("Write hostpool"), - // Provider: to.Ptr("Microsoft.DesktopVirtualization"), - // Resource: to.Ptr("hostpools"), - // }, - // IsDataAction: to.Ptr(false), - // Properties: &armdesktopvirtualization.OperationProperties{ - // ServiceSpecification: &armdesktopvirtualization.ServiceSpecification{ - // LogSpecifications: []*armdesktopvirtualization.LogSpecification{ - // { - // Name: to.Ptr(""), - // DisplayName: to.Ptr(""), - // }, - // { - // Name: to.Ptr(""), - // DisplayName: to.Ptr(""), - // }, - // { - // Name: to.Ptr(""), - // DisplayName: to.Ptr(""), - // }}, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/options.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/options.go new file mode 100644 index 000000000000..c84916c9a2ee --- /dev/null +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/options.go @@ -0,0 +1,519 @@ +//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 armdesktopvirtualization + +// ApplicationGroupsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationGroupsClient.CreateOrUpdate +// method. +type ApplicationGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGroupsClientDeleteOptions contains the optional parameters for the ApplicationGroupsClient.Delete method. +type ApplicationGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGroupsClientGetOptions contains the optional parameters for the ApplicationGroupsClient.Get method. +type ApplicationGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGroupsClientListByResourceGroupOptions contains the optional parameters for the ApplicationGroupsClient.NewListByResourceGroupPager +// method. +type ApplicationGroupsClientListByResourceGroupOptions struct { + // OData filter expression. Valid properties for filtering are applicationGroupType. + Filter *string + + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ApplicationGroupsClientListBySubscriptionOptions contains the optional parameters for the ApplicationGroupsClient.NewListBySubscriptionPager +// method. +type ApplicationGroupsClientListBySubscriptionOptions struct { + // OData filter expression. Valid properties for filtering are applicationGroupType. + Filter *string +} + +// ApplicationGroupsClientUpdateOptions contains the optional parameters for the ApplicationGroupsClient.Update method. +type ApplicationGroupsClientUpdateOptions struct { + // Object containing ApplicationGroup definitions. + ApplicationGroup *ApplicationGroupPatch +} + +// ApplicationsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.CreateOrUpdate method. +type ApplicationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientDeleteOptions contains the optional parameters for the ApplicationsClient.Delete method. +type ApplicationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. +type ApplicationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.NewListPager method. +type ApplicationsClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ApplicationsClientUpdateOptions contains the optional parameters for the ApplicationsClient.Update method. +type ApplicationsClientUpdateOptions struct { + // Object containing Application definitions. + Application *ApplicationPatch +} + +// DesktopsClientGetOptions contains the optional parameters for the DesktopsClient.Get method. +type DesktopsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DesktopsClientListOptions contains the optional parameters for the DesktopsClient.NewListPager method. +type DesktopsClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// DesktopsClientUpdateOptions contains the optional parameters for the DesktopsClient.Update method. +type DesktopsClientUpdateOptions struct { + // Object containing Desktop definitions. + Desktop *DesktopPatch +} + +// HostPoolsClientCreateOrUpdateOptions contains the optional parameters for the HostPoolsClient.CreateOrUpdate method. +type HostPoolsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// HostPoolsClientDeleteOptions contains the optional parameters for the HostPoolsClient.Delete method. +type HostPoolsClientDeleteOptions struct { + // Force flag to delete sessionHost. + Force *bool +} + +// HostPoolsClientGetOptions contains the optional parameters for the HostPoolsClient.Get method. +type HostPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HostPoolsClientListByResourceGroupOptions contains the optional parameters for the HostPoolsClient.NewListByResourceGroupPager +// method. +type HostPoolsClientListByResourceGroupOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// HostPoolsClientListOptions contains the optional parameters for the HostPoolsClient.NewListPager method. +type HostPoolsClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// HostPoolsClientRetrieveRegistrationTokenOptions contains the optional parameters for the HostPoolsClient.RetrieveRegistrationToken +// method. +type HostPoolsClientRetrieveRegistrationTokenOptions struct { + // placeholder for future optional parameters +} + +// HostPoolsClientUpdateOptions contains the optional parameters for the HostPoolsClient.Update method. +type HostPoolsClientUpdateOptions struct { + // Object containing HostPool definitions. + HostPool *HostPoolPatch +} + +// MSIXPackagesClientCreateOrUpdateOptions contains the optional parameters for the MSIXPackagesClient.CreateOrUpdate method. +type MSIXPackagesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MSIXPackagesClientDeleteOptions contains the optional parameters for the MSIXPackagesClient.Delete method. +type MSIXPackagesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MSIXPackagesClientGetOptions contains the optional parameters for the MSIXPackagesClient.Get method. +type MSIXPackagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// MSIXPackagesClientListOptions contains the optional parameters for the MSIXPackagesClient.NewListPager method. +type MSIXPackagesClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// MSIXPackagesClientUpdateOptions contains the optional parameters for the MSIXPackagesClient.Update method. +type MSIXPackagesClientUpdateOptions struct { + // Object containing MSIX Package definitions. + MsixPackage *MSIXPackagePatch +} + +// MsixImagesClientExpandOptions contains the optional parameters for the MsixImagesClient.NewExpandPager method. +type MsixImagesClientExpandOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientDeleteByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.DeleteByHostPool +// method. +type PrivateEndpointConnectionsClientDeleteByHostPoolOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientDeleteByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.DeleteByWorkspace +// method. +type PrivateEndpointConnectionsClientDeleteByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientGetByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.GetByHostPool +// method. +type PrivateEndpointConnectionsClientGetByHostPoolOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientGetByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.GetByWorkspace +// method. +type PrivateEndpointConnectionsClientGetByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByHostPoolPager +// method. +type PrivateEndpointConnectionsClientListByHostPoolOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// PrivateEndpointConnectionsClientListByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByWorkspacePager +// method. +type PrivateEndpointConnectionsClientListByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.UpdateByHostPool +// method. +type PrivateEndpointConnectionsClientUpdateByHostPoolOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.UpdateByWorkspace +// method. +type PrivateEndpointConnectionsClientUpdateByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByHostPoolOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByHostPoolPager +// method. +type PrivateLinkResourcesClientListByHostPoolOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// PrivateLinkResourcesClientListByWorkspaceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByWorkspacePager +// method. +type PrivateLinkResourcesClientListByWorkspaceOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ScalingPlanPooledSchedulesClientCreateOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Create +// method. +type ScalingPlanPooledSchedulesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ScalingPlanPooledSchedulesClientDeleteOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Delete +// method. +type ScalingPlanPooledSchedulesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ScalingPlanPooledSchedulesClientGetOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Get +// method. +type ScalingPlanPooledSchedulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScalingPlanPooledSchedulesClientListOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.NewListPager +// method. +type ScalingPlanPooledSchedulesClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ScalingPlanPooledSchedulesClientUpdateOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Update +// method. +type ScalingPlanPooledSchedulesClientUpdateOptions struct { + // Object containing ScalingPlanPooledSchedule definitions. + ScalingPlanSchedule *ScalingPlanPooledSchedulePatch +} + +// ScalingPlansClientCreateOptions contains the optional parameters for the ScalingPlansClient.Create method. +type ScalingPlansClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ScalingPlansClientDeleteOptions contains the optional parameters for the ScalingPlansClient.Delete method. +type ScalingPlansClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ScalingPlansClientGetOptions contains the optional parameters for the ScalingPlansClient.Get method. +type ScalingPlansClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScalingPlansClientListByHostPoolOptions contains the optional parameters for the ScalingPlansClient.NewListByHostPoolPager +// method. +type ScalingPlansClientListByHostPoolOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ScalingPlansClientListByResourceGroupOptions contains the optional parameters for the ScalingPlansClient.NewListByResourceGroupPager +// method. +type ScalingPlansClientListByResourceGroupOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ScalingPlansClientListBySubscriptionOptions contains the optional parameters for the ScalingPlansClient.NewListBySubscriptionPager +// method. +type ScalingPlansClientListBySubscriptionOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// ScalingPlansClientUpdateOptions contains the optional parameters for the ScalingPlansClient.Update method. +type ScalingPlansClientUpdateOptions struct { + // Object containing scaling plan definitions. + ScalingPlan *ScalingPlanPatch +} + +// SessionHostsClientDeleteOptions contains the optional parameters for the SessionHostsClient.Delete method. +type SessionHostsClientDeleteOptions struct { + // Force flag to force sessionHost deletion even when userSession exists. + Force *bool +} + +// SessionHostsClientGetOptions contains the optional parameters for the SessionHostsClient.Get method. +type SessionHostsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SessionHostsClientListOptions contains the optional parameters for the SessionHostsClient.NewListPager method. +type SessionHostsClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// SessionHostsClientUpdateOptions contains the optional parameters for the SessionHostsClient.Update method. +type SessionHostsClientUpdateOptions struct { + // Force flag to update assign, unassign or reassign personal desktop. + Force *bool + + // Object containing SessionHost definitions. + SessionHost *SessionHostPatch +} + +// StartMenuItemsClientListOptions contains the optional parameters for the StartMenuItemsClient.NewListPager method. +type StartMenuItemsClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// UserSessionsClientDeleteOptions contains the optional parameters for the UserSessionsClient.Delete method. +type UserSessionsClientDeleteOptions struct { + // Force flag to login off userSession. + Force *bool +} + +// UserSessionsClientDisconnectOptions contains the optional parameters for the UserSessionsClient.Disconnect method. +type UserSessionsClientDisconnectOptions struct { + // placeholder for future optional parameters +} + +// UserSessionsClientGetOptions contains the optional parameters for the UserSessionsClient.Get method. +type UserSessionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UserSessionsClientListByHostPoolOptions contains the optional parameters for the UserSessionsClient.NewListByHostPoolPager +// method. +type UserSessionsClientListByHostPoolOptions struct { + // OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + Filter *string + + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// UserSessionsClientListOptions contains the optional parameters for the UserSessionsClient.NewListPager method. +type UserSessionsClientListOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// UserSessionsClientSendMessageOptions contains the optional parameters for the UserSessionsClient.SendMessage method. +type UserSessionsClientSendMessageOptions struct { + // Object containing message includes title and message body + SendMessage *SendMessage +} + +// WorkspacesClientCreateOrUpdateOptions contains the optional parameters for the WorkspacesClient.CreateOrUpdate method. +type WorkspacesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesClientDeleteOptions contains the optional parameters for the WorkspacesClient.Delete method. +type WorkspacesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesClientGetOptions contains the optional parameters for the WorkspacesClient.Get method. +type WorkspacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesClientListByResourceGroupOptions contains the optional parameters for the WorkspacesClient.NewListByResourceGroupPager +// method. +type WorkspacesClientListByResourceGroupOptions struct { + // Initial number of items to skip. + InitialSkip *int32 + + // Indicates whether the collection is descending. + IsDescending *bool + + // Number of items per page. + PageSize *int32 +} + +// WorkspacesClientListBySubscriptionOptions contains the optional parameters for the WorkspacesClient.NewListBySubscriptionPager +// method. +type WorkspacesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesClientUpdateOptions contains the optional parameters for the WorkspacesClient.Update method. +type WorkspacesClientUpdateOptions struct { + // Object containing Workspace definitions. + Workspace *WorkspacePatch +} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privateendpointconnections_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privateendpointconnections_client.go new file mode 100644 index 000000000000..10242ecb0a64 --- /dev/null +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privateendpointconnections_client.go @@ -0,0 +1,578 @@ +//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 armdesktopvirtualization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// DeleteByHostPool - Remove a connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - hostPoolName - The name of the host pool within the specified resource group +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - options - PrivateEndpointConnectionsClientDeleteByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.DeleteByHostPool +// method. +func (client *PrivateEndpointConnectionsClient) DeleteByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteByHostPoolOptions) (PrivateEndpointConnectionsClientDeleteByHostPoolResponse, error) { + var err error + req, err := client.deleteByHostPoolCreateRequest(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientDeleteByHostPoolResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientDeleteByHostPoolResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientDeleteByHostPoolResponse{}, err + } + return PrivateEndpointConnectionsClientDeleteByHostPoolResponse{}, nil +} + +// deleteByHostPoolCreateRequest creates the DeleteByHostPool request. +func (client *PrivateEndpointConnectionsClient) deleteByHostPoolCreateRequest(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteByHostPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 hostPoolName == "" { + return nil, errors.New("parameter hostPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostPoolName}", url.PathEscape(hostPoolName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteByWorkspace - Remove a connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - options - PrivateEndpointConnectionsClientDeleteByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.DeleteByWorkspace +// method. +func (client *PrivateEndpointConnectionsClient) DeleteByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteByWorkspaceOptions) (PrivateEndpointConnectionsClientDeleteByWorkspaceResponse, error) { + var err error + req, err := client.deleteByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientDeleteByWorkspaceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientDeleteByWorkspaceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientDeleteByWorkspaceResponse{}, err + } + return PrivateEndpointConnectionsClientDeleteByWorkspaceResponse{}, nil +} + +// deleteByWorkspaceCreateRequest creates the DeleteByWorkspace request. +func (client *PrivateEndpointConnectionsClient) deleteByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetByHostPool - Get a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - hostPoolName - The name of the host pool within the specified resource group +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - options - PrivateEndpointConnectionsClientGetByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.GetByHostPool +// method. +func (client *PrivateEndpointConnectionsClient) GetByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetByHostPoolOptions) (PrivateEndpointConnectionsClientGetByHostPoolResponse, error) { + var err error + req, err := client.getByHostPoolCreateRequest(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetByHostPoolResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetByHostPoolResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetByHostPoolResponse{}, err + } + resp, err := client.getByHostPoolHandleResponse(httpResp) + return resp, err +} + +// getByHostPoolCreateRequest creates the GetByHostPool request. +func (client *PrivateEndpointConnectionsClient) getByHostPoolCreateRequest(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetByHostPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 hostPoolName == "" { + return nil, errors.New("parameter hostPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostPoolName}", url.PathEscape(hostPoolName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByHostPoolHandleResponse handles the GetByHostPool response. +func (client *PrivateEndpointConnectionsClient) getByHostPoolHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetByHostPoolResponse, error) { + result := PrivateEndpointConnectionsClientGetByHostPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionWithSystemData); err != nil { + return PrivateEndpointConnectionsClientGetByHostPoolResponse{}, err + } + return result, nil +} + +// GetByWorkspace - Get a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - options - PrivateEndpointConnectionsClientGetByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.GetByWorkspace +// method. +func (client *PrivateEndpointConnectionsClient) GetByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetByWorkspaceOptions) (PrivateEndpointConnectionsClientGetByWorkspaceResponse, error) { + var err error + req, err := client.getByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetByWorkspaceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetByWorkspaceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetByWorkspaceResponse{}, err + } + resp, err := client.getByWorkspaceHandleResponse(httpResp) + return resp, err +} + +// getByWorkspaceCreateRequest creates the GetByWorkspace request. +func (client *PrivateEndpointConnectionsClient) getByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByWorkspaceHandleResponse handles the GetByWorkspace response. +func (client *PrivateEndpointConnectionsClient) getByWorkspaceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetByWorkspaceResponse, error) { + result := PrivateEndpointConnectionsClientGetByWorkspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionWithSystemData); err != nil { + return PrivateEndpointConnectionsClientGetByWorkspaceResponse{}, err + } + return result, nil +} + +// NewListByHostPoolPager - List private endpoint connections associated with hostpool. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - hostPoolName - The name of the host pool within the specified resource group +// - options - PrivateEndpointConnectionsClientListByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByHostPoolPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListByHostPoolPager(resourceGroupName string, hostPoolName string, options *PrivateEndpointConnectionsClientListByHostPoolOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByHostPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByHostPoolResponse]{ + More: func(page PrivateEndpointConnectionsClientListByHostPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByHostPoolResponse) (PrivateEndpointConnectionsClientListByHostPoolResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByHostPoolCreateRequest(ctx, resourceGroupName, hostPoolName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateEndpointConnectionsClientListByHostPoolResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListByHostPoolResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListByHostPoolResponse{}, runtime.NewResponseError(resp) + } + return client.listByHostPoolHandleResponse(resp) + }, + }) +} + +// listByHostPoolCreateRequest creates the ListByHostPool request. +func (client *PrivateEndpointConnectionsClient) listByHostPoolCreateRequest(ctx context.Context, resourceGroupName string, hostPoolName string, options *PrivateEndpointConnectionsClientListByHostPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections" + 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 hostPoolName == "" { + return nil, errors.New("parameter hostPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostPoolName}", url.PathEscape(hostPoolName)) + 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", "2022-10-14-preview") + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } + if options != nil && options.IsDescending != nil { + reqQP.Set("isDescending", strconv.FormatBool(*options.IsDescending)) + } + if options != nil && options.InitialSkip != nil { + reqQP.Set("initialSkip", strconv.FormatInt(int64(*options.InitialSkip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHostPoolHandleResponse handles the ListByHostPool response. +func (client *PrivateEndpointConnectionsClient) listByHostPoolHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByHostPoolResponse, error) { + result := PrivateEndpointConnectionsClientListByHostPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResultWithSystemData); err != nil { + return PrivateEndpointConnectionsClientListByHostPoolResponse{}, err + } + return result, nil +} + +// NewListByWorkspacePager - List private endpoint connections. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace +// - options - PrivateEndpointConnectionsClientListByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByWorkspacePager +// method. +func (client *PrivateEndpointConnectionsClient) NewListByWorkspacePager(resourceGroupName string, workspaceName string, options *PrivateEndpointConnectionsClientListByWorkspaceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByWorkspaceResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByWorkspaceResponse]{ + More: func(page PrivateEndpointConnectionsClientListByWorkspaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByWorkspaceResponse) (PrivateEndpointConnectionsClientListByWorkspaceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateEndpointConnectionsClientListByWorkspaceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListByWorkspaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListByWorkspaceResponse{}, runtime.NewResponseError(resp) + } + return client.listByWorkspaceHandleResponse(resp) + }, + }) +} + +// listByWorkspaceCreateRequest creates the ListByWorkspace request. +func (client *PrivateEndpointConnectionsClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *PrivateEndpointConnectionsClientListByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWorkspaceHandleResponse handles the ListByWorkspace response. +func (client *PrivateEndpointConnectionsClient) listByWorkspaceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByWorkspaceResponse, error) { + result := PrivateEndpointConnectionsClientListByWorkspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResultWithSystemData); err != nil { + return PrivateEndpointConnectionsClientListByWorkspaceResponse{}, err + } + return result, nil +} + +// UpdateByHostPool - Approve or reject a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - hostPoolName - The name of the host pool within the specified resource group +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - connection - Object containing the updated connection. +// - options - PrivateEndpointConnectionsClientUpdateByHostPoolOptions contains the optional parameters for the PrivateEndpointConnectionsClient.UpdateByHostPool +// method. +func (client *PrivateEndpointConnectionsClient) UpdateByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, connection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateByHostPoolOptions) (PrivateEndpointConnectionsClientUpdateByHostPoolResponse, error) { + var err error + req, err := client.updateByHostPoolCreateRequest(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName, connection, options) + if err != nil { + return PrivateEndpointConnectionsClientUpdateByHostPoolResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientUpdateByHostPoolResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateByHostPoolResponse{}, err + } + resp, err := client.updateByHostPoolHandleResponse(httpResp) + return resp, err +} + +// updateByHostPoolCreateRequest creates the UpdateByHostPool request. +func (client *PrivateEndpointConnectionsClient) updateByHostPoolCreateRequest(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, connection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateByHostPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 hostPoolName == "" { + return nil, errors.New("parameter hostPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostPoolName}", url.PathEscape(hostPoolName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, connection); err != nil { + return nil, err + } + return req, nil +} + +// updateByHostPoolHandleResponse handles the UpdateByHostPool response. +func (client *PrivateEndpointConnectionsClient) updateByHostPoolHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateByHostPoolResponse, error) { + result := PrivateEndpointConnectionsClientUpdateByHostPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionWithSystemData); err != nil { + return PrivateEndpointConnectionsClientUpdateByHostPoolResponse{}, err + } + return result, nil +} + +// UpdateByWorkspace - Approve or reject a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - connection - Object containing the updated connection. +// - options - PrivateEndpointConnectionsClientUpdateByWorkspaceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.UpdateByWorkspace +// method. +func (client *PrivateEndpointConnectionsClient) UpdateByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, connection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateByWorkspaceOptions) (PrivateEndpointConnectionsClientUpdateByWorkspaceResponse, error) { + var err error + req, err := client.updateByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, connection, options) + if err != nil { + return PrivateEndpointConnectionsClientUpdateByWorkspaceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientUpdateByWorkspaceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateByWorkspaceResponse{}, err + } + resp, err := client.updateByWorkspaceHandleResponse(httpResp) + return resp, err +} + +// updateByWorkspaceCreateRequest creates the UpdateByWorkspace request. +func (client *PrivateEndpointConnectionsClient) updateByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, connection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-10-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, connection); err != nil { + return nil, err + } + return req, nil +} + +// updateByWorkspaceHandleResponse handles the UpdateByWorkspace response. +func (client *PrivateEndpointConnectionsClient) updateByWorkspaceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateByWorkspaceResponse, error) { + result := PrivateEndpointConnectionsClientUpdateByWorkspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionWithSystemData); err != nil { + return PrivateEndpointConnectionsClientUpdateByWorkspaceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privatelinkresources_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privatelinkresources_client.go new file mode 100644 index 000000000000..f933b57a440d --- /dev/null +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/privatelinkresources_client.go @@ -0,0 +1,203 @@ +//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 armdesktopvirtualization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByHostPoolPager - List the private link resources available for this hostpool. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - hostPoolName - The name of the host pool within the specified resource group +// - options - PrivateLinkResourcesClientListByHostPoolOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByHostPoolPager +// method. +func (client *PrivateLinkResourcesClient) NewListByHostPoolPager(resourceGroupName string, hostPoolName string, options *PrivateLinkResourcesClientListByHostPoolOptions) *runtime.Pager[PrivateLinkResourcesClientListByHostPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByHostPoolResponse]{ + More: func(page PrivateLinkResourcesClientListByHostPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByHostPoolResponse) (PrivateLinkResourcesClientListByHostPoolResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByHostPoolCreateRequest(ctx, resourceGroupName, hostPoolName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkResourcesClientListByHostPoolResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientListByHostPoolResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListByHostPoolResponse{}, runtime.NewResponseError(resp) + } + return client.listByHostPoolHandleResponse(resp) + }, + }) +} + +// listByHostPoolCreateRequest creates the ListByHostPool request. +func (client *PrivateLinkResourcesClient) listByHostPoolCreateRequest(ctx context.Context, resourceGroupName string, hostPoolName string, options *PrivateLinkResourcesClientListByHostPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources" + 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 hostPoolName == "" { + return nil, errors.New("parameter hostPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostPoolName}", url.PathEscape(hostPoolName)) + 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", "2022-10-14-preview") + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } + if options != nil && options.IsDescending != nil { + reqQP.Set("isDescending", strconv.FormatBool(*options.IsDescending)) + } + if options != nil && options.InitialSkip != nil { + reqQP.Set("initialSkip", strconv.FormatInt(int64(*options.InitialSkip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHostPoolHandleResponse handles the ListByHostPool response. +func (client *PrivateLinkResourcesClient) listByHostPoolHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByHostPoolResponse, error) { + result := PrivateLinkResourcesClientListByHostPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesClientListByHostPoolResponse{}, err + } + return result, nil +} + +// NewListByWorkspacePager - List the private link resources available for this workspace. +// +// Generated from API version 2022-10-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace +// - options - PrivateLinkResourcesClientListByWorkspaceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByWorkspacePager +// method. +func (client *PrivateLinkResourcesClient) NewListByWorkspacePager(resourceGroupName string, workspaceName string, options *PrivateLinkResourcesClientListByWorkspaceOptions) *runtime.Pager[PrivateLinkResourcesClientListByWorkspaceResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByWorkspaceResponse]{ + More: func(page PrivateLinkResourcesClientListByWorkspaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByWorkspaceResponse) (PrivateLinkResourcesClientListByWorkspaceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkResourcesClientListByWorkspaceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientListByWorkspaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListByWorkspaceResponse{}, runtime.NewResponseError(resp) + } + return client.listByWorkspaceHandleResponse(resp) + }, + }) +} + +// listByWorkspaceCreateRequest creates the ListByWorkspace request. +func (client *PrivateLinkResourcesClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *PrivateLinkResourcesClientListByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + 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", "2022-10-14-preview") + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } + if options != nil && options.IsDescending != nil { + reqQP.Set("isDescending", strconv.FormatBool(*options.IsDescending)) + } + if options != nil && options.InitialSkip != nil { + reqQP.Set("initialSkip", strconv.FormatInt(int64(*options.InitialSkip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWorkspaceHandleResponse handles the ListByWorkspace response. +func (client *PrivateLinkResourcesClient) listByWorkspaceHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByWorkspaceResponse, error) { + result := PrivateLinkResourcesClientListByWorkspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesClientListByWorkspaceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/response_types.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/response_types.go index 51fdaa4ad85f..b17c2928a0dd 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/response_types.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/response_types.go @@ -3,14 +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 armdesktopvirtualization // ApplicationGroupsClientCreateOrUpdateResponse contains the response from method ApplicationGroupsClient.CreateOrUpdate. type ApplicationGroupsClientCreateOrUpdateResponse struct { + // Represents a ApplicationGroup definition. ApplicationGroup } @@ -21,26 +21,31 @@ type ApplicationGroupsClientDeleteResponse struct { // ApplicationGroupsClientGetResponse contains the response from method ApplicationGroupsClient.Get. type ApplicationGroupsClientGetResponse struct { + // Represents a ApplicationGroup definition. ApplicationGroup } // ApplicationGroupsClientListByResourceGroupResponse contains the response from method ApplicationGroupsClient.NewListByResourceGroupPager. type ApplicationGroupsClientListByResourceGroupResponse struct { + // List of ApplicationGroup definitions. ApplicationGroupList } // ApplicationGroupsClientListBySubscriptionResponse contains the response from method ApplicationGroupsClient.NewListBySubscriptionPager. type ApplicationGroupsClientListBySubscriptionResponse struct { + // List of ApplicationGroup definitions. ApplicationGroupList } // ApplicationGroupsClientUpdateResponse contains the response from method ApplicationGroupsClient.Update. type ApplicationGroupsClientUpdateResponse struct { + // Represents a ApplicationGroup definition. ApplicationGroup } // ApplicationsClientCreateOrUpdateResponse contains the response from method ApplicationsClient.CreateOrUpdate. type ApplicationsClientCreateOrUpdateResponse struct { + // Schema for Application properties. Application } @@ -51,36 +56,43 @@ type ApplicationsClientDeleteResponse struct { // ApplicationsClientGetResponse contains the response from method ApplicationsClient.Get. type ApplicationsClientGetResponse struct { + // Schema for Application properties. Application } // ApplicationsClientListResponse contains the response from method ApplicationsClient.NewListPager. type ApplicationsClientListResponse struct { + // List of Application definitions. ApplicationList } // ApplicationsClientUpdateResponse contains the response from method ApplicationsClient.Update. type ApplicationsClientUpdateResponse struct { + // Schema for Application properties. Application } // DesktopsClientGetResponse contains the response from method DesktopsClient.Get. type DesktopsClientGetResponse struct { + // Schema for Desktop properties. Desktop } // DesktopsClientListResponse contains the response from method DesktopsClient.NewListPager. type DesktopsClientListResponse struct { + // List of Desktop definitions. DesktopList } // DesktopsClientUpdateResponse contains the response from method DesktopsClient.Update. type DesktopsClientUpdateResponse struct { + // Schema for Desktop properties. Desktop } // HostPoolsClientCreateOrUpdateResponse contains the response from method HostPoolsClient.CreateOrUpdate. type HostPoolsClientCreateOrUpdateResponse struct { + // Represents a HostPool definition. HostPool } @@ -91,31 +103,37 @@ type HostPoolsClientDeleteResponse struct { // HostPoolsClientGetResponse contains the response from method HostPoolsClient.Get. type HostPoolsClientGetResponse struct { + // Represents a HostPool definition. HostPool } // HostPoolsClientListByResourceGroupResponse contains the response from method HostPoolsClient.NewListByResourceGroupPager. type HostPoolsClientListByResourceGroupResponse struct { + // List of HostPool definitions. HostPoolList } // HostPoolsClientListResponse contains the response from method HostPoolsClient.NewListPager. type HostPoolsClientListResponse struct { + // List of HostPool definitions. HostPoolList } // HostPoolsClientRetrieveRegistrationTokenResponse contains the response from method HostPoolsClient.RetrieveRegistrationToken. type HostPoolsClientRetrieveRegistrationTokenResponse struct { + // Represents a RegistrationInfo definition. RegistrationInfo } // HostPoolsClientUpdateResponse contains the response from method HostPoolsClient.Update. type HostPoolsClientUpdateResponse struct { + // Represents a HostPool definition. HostPool } // MSIXPackagesClientCreateOrUpdateResponse contains the response from method MSIXPackagesClient.CreateOrUpdate. type MSIXPackagesClientCreateOrUpdateResponse struct { + // Schema for MSIX Package properties. MSIXPackage } @@ -126,31 +144,95 @@ type MSIXPackagesClientDeleteResponse struct { // MSIXPackagesClientGetResponse contains the response from method MSIXPackagesClient.Get. type MSIXPackagesClientGetResponse struct { + // Schema for MSIX Package properties. MSIXPackage } // MSIXPackagesClientListResponse contains the response from method MSIXPackagesClient.NewListPager. type MSIXPackagesClientListResponse struct { + // List of MSIX Package definitions. MSIXPackageList } // MSIXPackagesClientUpdateResponse contains the response from method MSIXPackagesClient.Update. type MSIXPackagesClientUpdateResponse struct { + // Schema for MSIX Package properties. MSIXPackage } // MsixImagesClientExpandResponse contains the response from method MsixImagesClient.NewExpandPager. type MsixImagesClientExpandResponse struct { + // List of MSIX package properties retrieved from MSIX Image expansion. ExpandMsixImageList } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list operations. ResourceProviderOperationList } +// PrivateEndpointConnectionsClientDeleteByHostPoolResponse contains the response from method PrivateEndpointConnectionsClient.DeleteByHostPool. +type PrivateEndpointConnectionsClientDeleteByHostPoolResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientDeleteByWorkspaceResponse contains the response from method PrivateEndpointConnectionsClient.DeleteByWorkspace. +type PrivateEndpointConnectionsClientDeleteByWorkspaceResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetByHostPoolResponse contains the response from method PrivateEndpointConnectionsClient.GetByHostPool. +type PrivateEndpointConnectionsClientGetByHostPoolResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnectionWithSystemData +} + +// PrivateEndpointConnectionsClientGetByWorkspaceResponse contains the response from method PrivateEndpointConnectionsClient.GetByWorkspace. +type PrivateEndpointConnectionsClientGetByWorkspaceResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnectionWithSystemData +} + +// PrivateEndpointConnectionsClientListByHostPoolResponse contains the response from method PrivateEndpointConnectionsClient.NewListByHostPoolPager. +type PrivateEndpointConnectionsClientListByHostPoolResponse struct { + // List of private endpoint connection associated with the specified storage account + PrivateEndpointConnectionListResultWithSystemData +} + +// PrivateEndpointConnectionsClientListByWorkspaceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByWorkspacePager. +type PrivateEndpointConnectionsClientListByWorkspaceResponse struct { + // List of private endpoint connection associated with the specified storage account + PrivateEndpointConnectionListResultWithSystemData +} + +// PrivateEndpointConnectionsClientUpdateByHostPoolResponse contains the response from method PrivateEndpointConnectionsClient.UpdateByHostPool. +type PrivateEndpointConnectionsClientUpdateByHostPoolResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnectionWithSystemData +} + +// PrivateEndpointConnectionsClientUpdateByWorkspaceResponse contains the response from method PrivateEndpointConnectionsClient.UpdateByWorkspace. +type PrivateEndpointConnectionsClientUpdateByWorkspaceResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnectionWithSystemData +} + +// PrivateLinkResourcesClientListByHostPoolResponse contains the response from method PrivateLinkResourcesClient.NewListByHostPoolPager. +type PrivateLinkResourcesClientListByHostPoolResponse struct { + // A list of private link resources + PrivateLinkResourceListResult +} + +// PrivateLinkResourcesClientListByWorkspaceResponse contains the response from method PrivateLinkResourcesClient.NewListByWorkspacePager. +type PrivateLinkResourcesClientListByWorkspaceResponse struct { + // A list of private link resources + PrivateLinkResourceListResult +} + // ScalingPlanPooledSchedulesClientCreateResponse contains the response from method ScalingPlanPooledSchedulesClient.Create. type ScalingPlanPooledSchedulesClientCreateResponse struct { + // Represents a ScalingPlanPooledSchedule definition. ScalingPlanPooledSchedule } @@ -161,21 +243,25 @@ type ScalingPlanPooledSchedulesClientDeleteResponse struct { // ScalingPlanPooledSchedulesClientGetResponse contains the response from method ScalingPlanPooledSchedulesClient.Get. type ScalingPlanPooledSchedulesClientGetResponse struct { + // Represents a ScalingPlanPooledSchedule definition. ScalingPlanPooledSchedule } // ScalingPlanPooledSchedulesClientListResponse contains the response from method ScalingPlanPooledSchedulesClient.NewListPager. type ScalingPlanPooledSchedulesClientListResponse struct { + // List of ScalingPlanPooledSchedule definitions. ScalingPlanPooledScheduleList } // ScalingPlanPooledSchedulesClientUpdateResponse contains the response from method ScalingPlanPooledSchedulesClient.Update. type ScalingPlanPooledSchedulesClientUpdateResponse struct { + // Represents a ScalingPlanPooledSchedule definition. ScalingPlanPooledSchedule } // ScalingPlansClientCreateResponse contains the response from method ScalingPlansClient.Create. type ScalingPlansClientCreateResponse struct { + // Represents a scaling plan definition. ScalingPlan } @@ -186,26 +272,31 @@ type ScalingPlansClientDeleteResponse struct { // ScalingPlansClientGetResponse contains the response from method ScalingPlansClient.Get. type ScalingPlansClientGetResponse struct { + // Represents a scaling plan definition. ScalingPlan } // ScalingPlansClientListByHostPoolResponse contains the response from method ScalingPlansClient.NewListByHostPoolPager. type ScalingPlansClientListByHostPoolResponse struct { + // List of scaling plan definitions. ScalingPlanList } // ScalingPlansClientListByResourceGroupResponse contains the response from method ScalingPlansClient.NewListByResourceGroupPager. type ScalingPlansClientListByResourceGroupResponse struct { + // List of scaling plan definitions. ScalingPlanList } // ScalingPlansClientListBySubscriptionResponse contains the response from method ScalingPlansClient.NewListBySubscriptionPager. type ScalingPlansClientListBySubscriptionResponse struct { + // List of scaling plan definitions. ScalingPlanList } // ScalingPlansClientUpdateResponse contains the response from method ScalingPlansClient.Update. type ScalingPlansClientUpdateResponse struct { + // Represents a scaling plan definition. ScalingPlan } @@ -216,21 +307,25 @@ type SessionHostsClientDeleteResponse struct { // SessionHostsClientGetResponse contains the response from method SessionHostsClient.Get. type SessionHostsClientGetResponse struct { + // Represents a SessionHost definition. SessionHost } // SessionHostsClientListResponse contains the response from method SessionHostsClient.NewListPager. type SessionHostsClientListResponse struct { + // List of SessionHost definitions. SessionHostList } // SessionHostsClientUpdateResponse contains the response from method SessionHostsClient.Update. type SessionHostsClientUpdateResponse struct { + // Represents a SessionHost definition. SessionHost } // StartMenuItemsClientListResponse contains the response from method StartMenuItemsClient.NewListPager. type StartMenuItemsClientListResponse struct { + // List of StartMenuItem definitions. StartMenuItemList } @@ -246,16 +341,19 @@ type UserSessionsClientDisconnectResponse struct { // UserSessionsClientGetResponse contains the response from method UserSessionsClient.Get. type UserSessionsClientGetResponse struct { + // Represents a UserSession definition. UserSession } // UserSessionsClientListByHostPoolResponse contains the response from method UserSessionsClient.NewListByHostPoolPager. type UserSessionsClientListByHostPoolResponse struct { + // List of UserSession definitions. UserSessionList } // UserSessionsClientListResponse contains the response from method UserSessionsClient.NewListPager. type UserSessionsClientListResponse struct { + // List of UserSession definitions. UserSessionList } @@ -266,6 +364,7 @@ type UserSessionsClientSendMessageResponse struct { // WorkspacesClientCreateOrUpdateResponse contains the response from method WorkspacesClient.CreateOrUpdate. type WorkspacesClientCreateOrUpdateResponse struct { + // Represents a Workspace definition. Workspace } @@ -276,20 +375,24 @@ type WorkspacesClientDeleteResponse struct { // WorkspacesClientGetResponse contains the response from method WorkspacesClient.Get. type WorkspacesClientGetResponse struct { + // Represents a Workspace definition. Workspace } // WorkspacesClientListByResourceGroupResponse contains the response from method WorkspacesClient.NewListByResourceGroupPager. type WorkspacesClientListByResourceGroupResponse struct { + // List of Workspace definitions. WorkspaceList } // WorkspacesClientListBySubscriptionResponse contains the response from method WorkspacesClient.NewListBySubscriptionPager. type WorkspacesClientListBySubscriptionResponse struct { + // List of Workspace definitions. WorkspaceList } // WorkspacesClientUpdateResponse contains the response from method WorkspacesClient.Update. type WorkspacesClientUpdateResponse struct { + // Represents a Workspace definition. Workspace } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client.go index 423e198e3508..b983dc1cf19f 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_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 armdesktopvirtualization @@ -48,7 +47,7 @@ func NewScalingPlanPooledSchedulesClient(subscriptionID string, credential azcor // Create - Create or update a ScalingPlanPooledSchedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - scalingPlanScheduleName - The name of the ScalingPlanSchedule @@ -56,18 +55,21 @@ func NewScalingPlanPooledSchedulesClient(subscriptionID string, credential azcor // - options - ScalingPlanPooledSchedulesClientCreateOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Create // method. func (client *ScalingPlanPooledSchedulesClient) Create(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlanScheduleName string, scalingPlanSchedule ScalingPlanPooledSchedule, options *ScalingPlanPooledSchedulesClientCreateOptions) (ScalingPlanPooledSchedulesClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, scalingPlanName, scalingPlanScheduleName, scalingPlanSchedule, options) if err != nil { return ScalingPlanPooledSchedulesClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlanPooledSchedulesClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ScalingPlanPooledSchedulesClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ScalingPlanPooledSchedulesClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -94,10 +96,13 @@ func (client *ScalingPlanPooledSchedulesClient) createCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, scalingPlanSchedule) + if err := runtime.MarshalAsJSON(req, scalingPlanSchedule); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -112,23 +117,25 @@ func (client *ScalingPlanPooledSchedulesClient) createHandleResponse(resp *http. // Delete - Remove a ScalingPlanPooledSchedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - scalingPlanScheduleName - The name of the ScalingPlanSchedule // - options - ScalingPlanPooledSchedulesClientDeleteOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Delete // method. func (client *ScalingPlanPooledSchedulesClient) Delete(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlanScheduleName string, options *ScalingPlanPooledSchedulesClientDeleteOptions) (ScalingPlanPooledSchedulesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, scalingPlanName, scalingPlanScheduleName, options) if err != nil { return ScalingPlanPooledSchedulesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlanPooledSchedulesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ScalingPlanPooledSchedulesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ScalingPlanPooledSchedulesClientDeleteResponse{}, err } return ScalingPlanPooledSchedulesClientDeleteResponse{}, nil } @@ -157,7 +164,7 @@ func (client *ScalingPlanPooledSchedulesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -166,25 +173,28 @@ func (client *ScalingPlanPooledSchedulesClient) deleteCreateRequest(ctx context. // Get - Get a ScalingPlanPooledSchedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - scalingPlanScheduleName - The name of the ScalingPlanSchedule // - options - ScalingPlanPooledSchedulesClientGetOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Get // method. func (client *ScalingPlanPooledSchedulesClient) Get(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlanScheduleName string, options *ScalingPlanPooledSchedulesClientGetOptions) (ScalingPlanPooledSchedulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, scalingPlanName, scalingPlanScheduleName, options) if err != nil { return ScalingPlanPooledSchedulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlanPooledSchedulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScalingPlanPooledSchedulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScalingPlanPooledSchedulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -211,7 +221,7 @@ func (client *ScalingPlanPooledSchedulesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +238,7 @@ func (client *ScalingPlanPooledSchedulesClient) getHandleResponse(resp *http.Res // NewListPager - List ScalingPlanPooledSchedules. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - options - ScalingPlanPooledSchedulesClientListOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.NewListPager @@ -281,7 +291,7 @@ func (client *ScalingPlanPooledSchedulesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -308,25 +318,28 @@ func (client *ScalingPlanPooledSchedulesClient) listHandleResponse(resp *http.Re // Update - Update a ScalingPlanPooledSchedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - scalingPlanScheduleName - The name of the ScalingPlanSchedule // - options - ScalingPlanPooledSchedulesClientUpdateOptions contains the optional parameters for the ScalingPlanPooledSchedulesClient.Update // method. func (client *ScalingPlanPooledSchedulesClient) Update(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlanScheduleName string, options *ScalingPlanPooledSchedulesClientUpdateOptions) (ScalingPlanPooledSchedulesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, scalingPlanName, scalingPlanScheduleName, options) if err != nil { return ScalingPlanPooledSchedulesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlanPooledSchedulesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScalingPlanPooledSchedulesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScalingPlanPooledSchedulesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -353,11 +366,14 @@ func (client *ScalingPlanPooledSchedulesClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ScalingPlanSchedule != nil { - return req, runtime.MarshalAsJSON(req, *options.ScalingPlanSchedule) + if err := runtime.MarshalAsJSON(req, *options.ScalingPlanSchedule); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client_example_test.go deleted file mode 100644 index da81eb429c5b..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplanpooledschedules_client_example_test.go +++ /dev/null @@ -1,419 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlanPooledSchedule_Get.json -func ExampleScalingPlanPooledSchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScalingPlanPooledSchedulesClient().Get(ctx, "resourceGroup1", "scalingPlan1", "scalingPlanScheduleWeekdays1", 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.ScalingPlanPooledSchedule = armdesktopvirtualization.ScalingPlanPooledSchedule{ - // Name: to.Ptr("scalingPlanScheduleWeekdays1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans/pooledSchedules"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1/pooledSchedules/scalingPlanScheduleWeekdays1"), - // Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - // DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - // to.Ptr(armdesktopvirtualization.DayOfWeekMonday), - // to.Ptr(armdesktopvirtualization.DayOfWeekTuesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekWednesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekThursday), - // to.Ptr(armdesktopvirtualization.DayOfWeekFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlanPooledSchedule_Create.json -func ExampleScalingPlanPooledSchedulesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScalingPlanPooledSchedulesClient().Create(ctx, "resourceGroup1", "scalingPlan1", "scalingPlanScheduleWeekdays1", armdesktopvirtualization.ScalingPlanPooledSchedule{ - Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - to.Ptr(armdesktopvirtualization.DayOfWeekMonday), - to.Ptr(armdesktopvirtualization.DayOfWeekTuesday), - to.Ptr(armdesktopvirtualization.DayOfWeekWednesday), - to.Ptr(armdesktopvirtualization.DayOfWeekThursday), - to.Ptr(armdesktopvirtualization.DayOfWeekFriday)}, - OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - OffPeakStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](20), - Minute: to.Ptr[int32](0), - }, - PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - PeakStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](8), - Minute: to.Ptr[int32](0), - }, - RampDownCapacityThresholdPct: to.Ptr[int32](50), - RampDownForceLogoffUsers: to.Ptr(true), - RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - RampDownMinimumHostsPct: to.Ptr[int32](20), - RampDownNotificationMessage: to.Ptr("message"), - RampDownStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](18), - Minute: to.Ptr[int32](0), - }, - RampDownWaitTimeMinutes: to.Ptr[int32](30), - RampUpCapacityThresholdPct: to.Ptr[int32](80), - RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - RampUpMinimumHostsPct: to.Ptr[int32](20), - RampUpStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](6), - Minute: to.Ptr[int32](0), - }, - }, - }, 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.ScalingPlanPooledSchedule = armdesktopvirtualization.ScalingPlanPooledSchedule{ - // Name: to.Ptr("scalingPlanScheduleWeekdays1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans/pooledSchedules"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1/pooledSchedules/scalingPlanScheduleWeekdays1"), - // Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - // DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - // to.Ptr(armdesktopvirtualization.DayOfWeekMonday), - // to.Ptr(armdesktopvirtualization.DayOfWeekTuesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekWednesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekThursday), - // to.Ptr(armdesktopvirtualization.DayOfWeekFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlanPooledSchedule_Delete.json -func ExampleScalingPlanPooledSchedulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScalingPlanPooledSchedulesClient().Delete(ctx, "resourceGroup1", "scalingPlan1", "scalingPlanScheduleWeekdays1", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlanPooledSchedule_Update.json -func ExampleScalingPlanPooledSchedulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScalingPlanPooledSchedulesClient().Update(ctx, "resourceGroup1", "scalingPlan1", "scalingPlanScheduleWeekdays1", &armdesktopvirtualization.ScalingPlanPooledSchedulesClientUpdateOptions{ScalingPlanSchedule: &armdesktopvirtualization.ScalingPlanPooledSchedulePatch{ - Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - to.Ptr(armdesktopvirtualization.DayOfWeekMonday), - to.Ptr(armdesktopvirtualization.DayOfWeekTuesday), - to.Ptr(armdesktopvirtualization.DayOfWeekWednesday), - to.Ptr(armdesktopvirtualization.DayOfWeekThursday), - to.Ptr(armdesktopvirtualization.DayOfWeekFriday)}, - PeakStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](8), - Minute: to.Ptr[int32](0), - }, - RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - RampDownMinimumHostsPct: to.Ptr[int32](20), - RampDownWaitTimeMinutes: to.Ptr[int32](30), - RampUpCapacityThresholdPct: to.Ptr[int32](80), - RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - }, - }, - }) - 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.ScalingPlanPooledSchedule = armdesktopvirtualization.ScalingPlanPooledSchedule{ - // Name: to.Ptr("scalingPlanScheduleWeekdays1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans/pooledSchedules"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1/pooledSchedules/scalingPlanScheduleWeekdays1"), - // Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - // DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - // to.Ptr(armdesktopvirtualization.DayOfWeekMonday), - // to.Ptr(armdesktopvirtualization.DayOfWeekTuesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekWednesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekThursday), - // to.Ptr(armdesktopvirtualization.DayOfWeekFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlanPooledSchedule_List.json -func ExampleScalingPlanPooledSchedulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScalingPlanPooledSchedulesClient().NewListPager("resourceGroup1", "scalingPlan1", &armdesktopvirtualization.ScalingPlanPooledSchedulesClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.ScalingPlanPooledScheduleList = armdesktopvirtualization.ScalingPlanPooledScheduleList{ - // Value: []*armdesktopvirtualization.ScalingPlanPooledSchedule{ - // { - // Name: to.Ptr("scalingPlanScheduleWeekdays1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans/pooledSchedules"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1/pooledSchedules/scalingPlanScheduleWeekdays1"), - // Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - // DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - // to.Ptr(armdesktopvirtualization.DayOfWeekMonday), - // to.Ptr(armdesktopvirtualization.DayOfWeekTuesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekWednesday), - // to.Ptr(armdesktopvirtualization.DayOfWeekThursday), - // to.Ptr(armdesktopvirtualization.DayOfWeekFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("scalingPlanScheduleWeekends1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans/pooledSchedules"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1/pooledSchedules/scalingPlanScheduleWeekends1"), - // Properties: &armdesktopvirtualization.ScalingPlanPooledScheduleProperties{ - // DaysOfWeek: []*armdesktopvirtualization.DayOfWeek{ - // to.Ptr(armdesktopvirtualization.DayOfWeekSaturday), - // to.Ptr(armdesktopvirtualization.DayOfWeekSunday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](100), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](0), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](90), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](10), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client.go index b01117ff2cbb..b1047740a22a 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_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 armdesktopvirtualization @@ -48,24 +47,27 @@ func NewScalingPlansClient(subscriptionID string, credential azcore.TokenCredent // Create - Create or update a scaling plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - scalingPlan - Object containing scaling plan definitions. // - options - ScalingPlansClientCreateOptions contains the optional parameters for the ScalingPlansClient.Create method. func (client *ScalingPlansClient) Create(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan ScalingPlan, options *ScalingPlansClientCreateOptions) (ScalingPlansClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, scalingPlanName, scalingPlan, options) if err != nil { return ScalingPlansClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlansClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ScalingPlansClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ScalingPlansClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -88,10 +90,13 @@ func (client *ScalingPlansClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, scalingPlan) + if err := runtime.MarshalAsJSON(req, scalingPlan); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -106,21 +111,23 @@ func (client *ScalingPlansClient) createHandleResponse(resp *http.Response) (Sca // Delete - Remove a scaling plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - options - ScalingPlansClientDeleteOptions contains the optional parameters for the ScalingPlansClient.Delete method. func (client *ScalingPlansClient) Delete(ctx context.Context, resourceGroupName string, scalingPlanName string, options *ScalingPlansClientDeleteOptions) (ScalingPlansClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, scalingPlanName, options) if err != nil { return ScalingPlansClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlansClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ScalingPlansClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ScalingPlansClientDeleteResponse{}, err } return ScalingPlansClientDeleteResponse{}, nil } @@ -145,7 +152,7 @@ func (client *ScalingPlansClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -154,23 +161,26 @@ func (client *ScalingPlansClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a scaling plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - options - ScalingPlansClientGetOptions contains the optional parameters for the ScalingPlansClient.Get method. func (client *ScalingPlansClient) Get(ctx context.Context, resourceGroupName string, scalingPlanName string, options *ScalingPlansClientGetOptions) (ScalingPlansClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, scalingPlanName, options) if err != nil { return ScalingPlansClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlansClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScalingPlansClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScalingPlansClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -193,7 +203,7 @@ func (client *ScalingPlansClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,7 +220,7 @@ func (client *ScalingPlansClient) getHandleResponse(resp *http.Response) (Scalin // NewListByHostPoolPager - List scaling plan associated with hostpool. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - ScalingPlansClientListByHostPoolOptions contains the optional parameters for the ScalingPlansClient.NewListByHostPoolPager @@ -263,7 +273,7 @@ func (client *ScalingPlansClient) listByHostPoolCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -289,7 +299,7 @@ func (client *ScalingPlansClient) listByHostPoolHandleResponse(resp *http.Respon // NewListByResourceGroupPager - List scaling plans. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ScalingPlansClientListByResourceGroupOptions contains the optional parameters for the ScalingPlansClient.NewListByResourceGroupPager // method. @@ -337,7 +347,7 @@ func (client *ScalingPlansClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -363,7 +373,7 @@ func (client *ScalingPlansClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionPager - List scaling plans in subscription. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - options - ScalingPlansClientListBySubscriptionOptions contains the optional parameters for the ScalingPlansClient.NewListBySubscriptionPager // method. func (client *ScalingPlansClient) NewListBySubscriptionPager(options *ScalingPlansClientListBySubscriptionOptions) *runtime.Pager[ScalingPlansClientListBySubscriptionResponse] { @@ -406,7 +416,7 @@ func (client *ScalingPlansClient) listBySubscriptionCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -433,23 +443,26 @@ func (client *ScalingPlansClient) listBySubscriptionHandleResponse(resp *http.Re // Update - Update a scaling plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scalingPlanName - The name of the scaling plan. // - options - ScalingPlansClientUpdateOptions contains the optional parameters for the ScalingPlansClient.Update method. func (client *ScalingPlansClient) Update(ctx context.Context, resourceGroupName string, scalingPlanName string, options *ScalingPlansClientUpdateOptions) (ScalingPlansClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, scalingPlanName, options) if err != nil { return ScalingPlansClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScalingPlansClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScalingPlansClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScalingPlansClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -472,11 +485,14 @@ func (client *ScalingPlansClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ScalingPlan != nil { - return req, runtime.MarshalAsJSON(req, *options.ScalingPlan) + if err := runtime.MarshalAsJSON(req, *options.ScalingPlan); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client_example_test.go deleted file mode 100644 index c03b38c0325f..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/scalingplans_client_example_test.go +++ /dev/null @@ -1,786 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_Get.json -func ExampleScalingPlansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScalingPlansClient().Get(ctx, "resourceGroup1", "scalingPlan1", 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.ScalingPlan = armdesktopvirtualization.ScalingPlan{ - // Name: to.Ptr("workspace1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of scaling plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_Create.json -func ExampleScalingPlansClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScalingPlansClient().Create(ctx, "resourceGroup1", "scalingPlan1", armdesktopvirtualization.ScalingPlan{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armdesktopvirtualization.ScalingPlanProperties{ - Description: to.Ptr("Description of Scaling Plan"), - ExclusionTag: to.Ptr("value"), - FriendlyName: to.Ptr("Scaling Plan 1"), - HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - { - HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - ScalingPlanEnabled: to.Ptr(true), - }}, - HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - Schedules: []*armdesktopvirtualization.ScalingSchedule{ - { - Name: to.Ptr("schedule1"), - DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - OffPeakStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](20), - Minute: to.Ptr[int32](0), - }, - PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - PeakStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](8), - Minute: to.Ptr[int32](0), - }, - RampDownCapacityThresholdPct: to.Ptr[int32](50), - RampDownForceLogoffUsers: to.Ptr(true), - RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - RampDownMinimumHostsPct: to.Ptr[int32](20), - RampDownNotificationMessage: to.Ptr("message"), - RampDownStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](18), - Minute: to.Ptr[int32](0), - }, - RampDownWaitTimeMinutes: to.Ptr[int32](30), - RampUpCapacityThresholdPct: to.Ptr[int32](80), - RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - RampUpMinimumHostsPct: to.Ptr[int32](20), - RampUpStartTime: &armdesktopvirtualization.Time{ - Hour: to.Ptr[int32](6), - Minute: to.Ptr[int32](0), - }, - }}, - TimeZone: to.Ptr("Central Standard Time"), - }, - }, 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.ScalingPlan = armdesktopvirtualization.ScalingPlan{ - // Name: to.Ptr("scalingPlan1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_Delete.json -func ExampleScalingPlansClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScalingPlansClient().Delete(ctx, "resourceGroup1", "scalingPlan1", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_Update.json -func ExampleScalingPlansClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScalingPlansClient().Update(ctx, "resourceGroup1", "scalingPlan1", &armdesktopvirtualization.ScalingPlansClientUpdateOptions{ScalingPlan: 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.ScalingPlan = armdesktopvirtualization.ScalingPlan{ - // Name: to.Ptr("scalingPlan1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_ListByResourceGroup.json -func ExampleScalingPlansClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScalingPlansClient().NewListByResourceGroupPager("resourceGroup1", &armdesktopvirtualization.ScalingPlansClientListByResourceGroupOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.ScalingPlanList = armdesktopvirtualization.ScalingPlanList{ - // Value: []*armdesktopvirtualization.ScalingPlan{ - // { - // Name: to.Ptr("scalingPlan1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("scalingPlan2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(false), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownStopHostsWhen: to.Ptr(armdesktopvirtualization.StopHostsWhenZeroSessions), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_ListBySubscription.json -func ExampleScalingPlansClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScalingPlansClient().NewListBySubscriptionPager(&armdesktopvirtualization.ScalingPlansClientListBySubscriptionOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.ScalingPlanList = armdesktopvirtualization.ScalingPlanList{ - // Value: []*armdesktopvirtualization.ScalingPlan{ - // { - // Name: to.Ptr("scalingPlan1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("scalingPlan2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(false), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownStopHostsWhen: to.Ptr(armdesktopvirtualization.StopHostsWhenZeroActiveSessions), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_ListByHostPool.json -func ExampleScalingPlansClient_NewListByHostPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScalingPlansClient().NewListByHostPoolPager("resourceGroup1", "hostPool1", &armdesktopvirtualization.ScalingPlansClientListByHostPoolOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.ScalingPlanList = armdesktopvirtualization.ScalingPlanList{ - // Value: []*armdesktopvirtualization.ScalingPlan{ - // { - // Name: to.Ptr("scalingPlan1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/scalingPlans"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/scalingPlan1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.ScalingPlanProperties{ - // Description: to.Ptr("Description of Scaling Plan"), - // ExclusionTag: to.Ptr("value"), - // FriendlyName: to.Ptr("Scaling Plan 1"), - // HostPoolReferences: []*armdesktopvirtualization.ScalingHostPoolReference{ - // { - // HostPoolArmPath: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), - // ScalingPlanEnabled: to.Ptr(true), - // }}, - // HostPoolType: to.Ptr(armdesktopvirtualization.ScalingHostPoolTypePooled), - // ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Schedules: []*armdesktopvirtualization.ScalingSchedule{ - // { - // Name: to.Ptr("schedule1"), - // DaysOfWeek: []*armdesktopvirtualization.ScalingScheduleDaysOfWeekItem{ - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemMonday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemTuesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemWednesday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemThursday), - // to.Ptr(armdesktopvirtualization.ScalingScheduleDaysOfWeekItemFriday)}, - // OffPeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // OffPeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](20), - // Minute: to.Ptr[int32](0), - // }, - // PeakLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - // PeakStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](8), - // Minute: to.Ptr[int32](0), - // }, - // RampDownCapacityThresholdPct: to.Ptr[int32](50), - // RampDownForceLogoffUsers: to.Ptr(true), - // RampDownLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampDownMinimumHostsPct: to.Ptr[int32](20), - // RampDownNotificationMessage: to.Ptr("message"), - // RampDownStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](18), - // Minute: to.Ptr[int32](0), - // }, - // RampDownWaitTimeMinutes: to.Ptr[int32](30), - // RampUpCapacityThresholdPct: to.Ptr[int32](80), - // RampUpLoadBalancingAlgorithm: to.Ptr(armdesktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), - // RampUpMinimumHostsPct: to.Ptr[int32](20), - // RampUpStartTime: &armdesktopvirtualization.Time{ - // Hour: to.Ptr[int32](6), - // Minute: to.Ptr[int32](0), - // }, - // }}, - // TimeZone: to.Ptr("Central Standard Time"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client.go index 59bd95b9e35e..f5ab441a9d45 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_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 armdesktopvirtualization @@ -48,22 +47,24 @@ func NewSessionHostsClient(subscriptionID string, credential azcore.TokenCredent // Delete - Remove a SessionHost. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool // - options - SessionHostsClientDeleteOptions contains the optional parameters for the SessionHostsClient.Delete method. func (client *SessionHostsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, options *SessionHostsClientDeleteOptions) (SessionHostsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, options) if err != nil { return SessionHostsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SessionHostsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return SessionHostsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SessionHostsClientDeleteResponse{}, err } return SessionHostsClientDeleteResponse{}, nil } @@ -92,7 +93,7 @@ func (client *SessionHostsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -104,24 +105,27 @@ func (client *SessionHostsClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a session host. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool // - options - SessionHostsClientGetOptions contains the optional parameters for the SessionHostsClient.Get method. func (client *SessionHostsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, options *SessionHostsClientGetOptions) (SessionHostsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, options) if err != nil { return SessionHostsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SessionHostsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SessionHostsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SessionHostsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -148,7 +152,7 @@ func (client *SessionHostsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -165,7 +169,7 @@ func (client *SessionHostsClient) getHandleResponse(resp *http.Response) (Sessio // NewListPager - List sessionHosts. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - SessionHostsClientListOptions contains the optional parameters for the SessionHostsClient.NewListPager method. @@ -217,7 +221,7 @@ func (client *SessionHostsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -244,24 +248,27 @@ func (client *SessionHostsClient) listHandleResponse(resp *http.Response) (Sessi // Update - Update a session host. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool // - options - SessionHostsClientUpdateOptions contains the optional parameters for the SessionHostsClient.Update method. func (client *SessionHostsClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, options *SessionHostsClientUpdateOptions) (SessionHostsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, options) if err != nil { return SessionHostsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SessionHostsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SessionHostsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SessionHostsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -288,14 +295,17 @@ func (client *SessionHostsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.SessionHost != nil { - return req, runtime.MarshalAsJSON(req, *options.SessionHost) + if err := runtime.MarshalAsJSON(req, *options.SessionHost); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client_example_test.go deleted file mode 100644 index 6a1e9e437106..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/sessionhosts_client_example_test.go +++ /dev/null @@ -1,279 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/SessionHost_Get.json -func ExampleSessionHostsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSessionHostsClient().Get(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", 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.SessionHost = armdesktopvirtualization.SessionHost{ - // Name: to.Ptr("sessionHost1.microsoft.com"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionHosts"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com"), - // Properties: &armdesktopvirtualization.SessionHostProperties{ - // AgentVersion: to.Ptr("1.0.0.1391"), - // AllowNewSession: to.Ptr(true), - // AssignedUser: to.Ptr("user1@microsoft.com"), - // FriendlyName: to.Ptr("friendly"), - // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // OSVersion: to.Ptr("10.0.17763"), - // ResourceID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/virtualMachines/sessionHost1"), - // SessionHostHealthCheckResults: []*armdesktopvirtualization.SessionHostHealthCheckReport{ - // { - // AdditionalFailureDetails: &armdesktopvirtualization.SessionHostHealthCheckFailureDetails{ - // ErrorCode: to.Ptr[int32](0), - // LastHealthCheckDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-14T02:09:37.6236843Z"); return t}()), - // Message: to.Ptr("SessionHost healthy: is joined to domain ≤wvdarmtest1.net≥"), - // }, - // HealthCheckName: to.Ptr(armdesktopvirtualization.HealthCheckNameDomainJoinedCheck), - // HealthCheckResult: to.Ptr(armdesktopvirtualization.HealthCheckResultHealthCheckSucceeded), - // }}, - // Sessions: to.Ptr[int32](1), - // Status: to.Ptr(armdesktopvirtualization.StatusAvailable), - // StatusTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // SxSStackVersion: to.Ptr("rdp-sxs190816002"), - // UpdateErrorMessage: to.Ptr(""), - // UpdateState: to.Ptr(armdesktopvirtualization.UpdateStateSucceeded), - // VirtualMachineID: to.Ptr("29491b54-c033-4dec-b09a-18bf0ebafaef"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/SessionHost_Delete.json -func ExampleSessionHostsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSessionHostsClient().Delete(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", &armdesktopvirtualization.SessionHostsClientDeleteOptions{Force: to.Ptr(true)}) - 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/SessionHost_Update.json -func ExampleSessionHostsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSessionHostsClient().Update(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", &armdesktopvirtualization.SessionHostsClientUpdateOptions{Force: to.Ptr(true), - SessionHost: &armdesktopvirtualization.SessionHostPatch{ - Properties: &armdesktopvirtualization.SessionHostPatchProperties{ - AllowNewSession: to.Ptr(true), - AssignedUser: to.Ptr("user1@microsoft.com"), - FriendlyName: to.Ptr("friendly"), - }, - }, - }) - 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.SessionHost = armdesktopvirtualization.SessionHost{ - // Name: to.Ptr("sessionHost1.microsoft.com"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionhosts"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com"), - // Properties: &armdesktopvirtualization.SessionHostProperties{ - // AgentVersion: to.Ptr("1.0.0.1391"), - // AllowNewSession: to.Ptr(true), - // AssignedUser: to.Ptr("user1@microsoft.com"), - // FriendlyName: to.Ptr("friendly"), - // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-11T19:27:13.6108027Z"); return t}()), - // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // OSVersion: to.Ptr("10.0.17763"), - // ResourceID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/virtualMachines/sessionHost1"), - // SessionHostHealthCheckResults: []*armdesktopvirtualization.SessionHostHealthCheckReport{ - // { - // AdditionalFailureDetails: &armdesktopvirtualization.SessionHostHealthCheckFailureDetails{ - // ErrorCode: to.Ptr[int32](0), - // LastHealthCheckDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-14T02:09:37.6236843Z"); return t}()), - // Message: to.Ptr("SessionHost healthy: is joined to domain ≤wvdarmtest1.net≥"), - // }, - // HealthCheckName: to.Ptr(armdesktopvirtualization.HealthCheckNameDomainJoinedCheck), - // HealthCheckResult: to.Ptr(armdesktopvirtualization.HealthCheckResultHealthCheckSucceeded), - // }}, - // Sessions: to.Ptr[int32](1), - // Status: to.Ptr(armdesktopvirtualization.StatusAvailable), - // StatusTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-24T20:00:08.2893033Z"); return t}()), - // SxSStackVersion: to.Ptr("rdp-sxs190816002"), - // UpdateErrorMessage: to.Ptr(""), - // UpdateState: to.Ptr(armdesktopvirtualization.UpdateStateSucceeded), - // VirtualMachineID: to.Ptr("29491b54-c033-4dec-b09a-18bf0ebafaef"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/SessionHost_List.json -func ExampleSessionHostsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSessionHostsClient().NewListPager("resourceGroup1", "hostPool1", &armdesktopvirtualization.SessionHostsClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.SessionHostList = armdesktopvirtualization.SessionHostList{ - // Value: []*armdesktopvirtualization.SessionHost{ - // { - // Name: to.Ptr("sessionHost1.microsoft.com"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionhosts"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com"), - // Properties: &armdesktopvirtualization.SessionHostProperties{ - // AgentVersion: to.Ptr("1.0.0.1391"), - // AllowNewSession: to.Ptr(true), - // AssignedUser: to.Ptr("user1@microsoft.com"), - // FriendlyName: to.Ptr("friendly"), - // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // OSVersion: to.Ptr("10.0.17763"), - // ResourceID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/virtualMachines/sessionHost1"), - // SessionHostHealthCheckResults: []*armdesktopvirtualization.SessionHostHealthCheckReport{ - // { - // AdditionalFailureDetails: &armdesktopvirtualization.SessionHostHealthCheckFailureDetails{ - // ErrorCode: to.Ptr[int32](0), - // LastHealthCheckDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-14T02:09:37.6236843Z"); return t}()), - // Message: to.Ptr("SessionHost healthy: is joined to domain ≤wvdarmtest1.net≥"), - // }, - // HealthCheckName: to.Ptr(armdesktopvirtualization.HealthCheckNameDomainJoinedCheck), - // HealthCheckResult: to.Ptr(armdesktopvirtualization.HealthCheckResultHealthCheckSucceeded), - // }}, - // Sessions: to.Ptr[int32](1), - // Status: to.Ptr(armdesktopvirtualization.StatusAvailable), - // StatusTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // SxSStackVersion: to.Ptr("rdp-sxs190816002"), - // UpdateErrorMessage: to.Ptr(""), - // UpdateState: to.Ptr(armdesktopvirtualization.UpdateStateSucceeded), - // VirtualMachineID: to.Ptr("29491b54-c033-4dec-b09a-18bf0ebafaef"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("sessionHost2.microsoft.com"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionhosts"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost2microsoft.com"), - // Properties: &armdesktopvirtualization.SessionHostProperties{ - // AgentVersion: to.Ptr("1.0.0.1391"), - // AllowNewSession: to.Ptr(true), - // AssignedUser: to.Ptr("user2@microsoft.com"), - // FriendlyName: to.Ptr("friendly"), - // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // OSVersion: to.Ptr("10.0.17763"), - // ResourceID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/virtualMachines/sessionHost2"), - // SessionHostHealthCheckResults: []*armdesktopvirtualization.SessionHostHealthCheckReport{ - // { - // AdditionalFailureDetails: &armdesktopvirtualization.SessionHostHealthCheckFailureDetails{ - // ErrorCode: to.Ptr[int32](0), - // LastHealthCheckDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-14T02:09:37.6236843Z"); return t}()), - // Message: to.Ptr("SessionHost healthy: is joined to domain ≤wvdarmtest1.net≥"), - // }, - // HealthCheckName: to.Ptr(armdesktopvirtualization.HealthCheckNameDomainJoinedCheck), - // HealthCheckResult: to.Ptr(armdesktopvirtualization.HealthCheckResultHealthCheckSucceeded), - // }}, - // Sessions: to.Ptr[int32](1), - // Status: to.Ptr(armdesktopvirtualization.StatusAvailable), - // StatusTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // SxSStackVersion: to.Ptr("rdp-sxs190816002"), - // UpdateErrorMessage: to.Ptr(""), - // UpdateState: to.Ptr(armdesktopvirtualization.UpdateStateSucceeded), - // VirtualMachineID: to.Ptr("39491b54-c033-4dec-b09a-18bf0ebafaef"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client.go index ff81909739d9..f527347bcd75 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_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 armdesktopvirtualization @@ -47,7 +46,7 @@ func NewStartMenuItemsClient(subscriptionID string, credential azcore.TokenCrede // NewListPager - List start menu items in the given application group. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - applicationGroupName - The name of the application group // - options - StartMenuItemsClientListOptions contains the optional parameters for the StartMenuItemsClient.NewListPager method. @@ -99,7 +98,7 @@ func (client *StartMenuItemsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client_example_test.go deleted file mode 100644 index d9a8c9247c46..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/startmenuitems_client_example_test.go +++ /dev/null @@ -1,73 +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 armdesktopvirtualization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/StartMenuItem_List.json -func ExampleStartMenuItemsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStartMenuItemsClient().NewListPager("resourceGroup1", "applicationGroup1", &armdesktopvirtualization.StartMenuItemsClientListOptions{PageSize: nil, - IsDescending: nil, - InitialSkip: 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.StartMenuItemList = armdesktopvirtualization.StartMenuItemList{ - // Value: []*armdesktopvirtualization.StartMenuItem{ - // { - // Name: to.Ptr("application1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/startMenuItems"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/startMenuItem/application1"), - // Properties: &armdesktopvirtualization.StartMenuItemProperties{ - // AppAlias: to.Ptr("word"), - // CommandLineArguments: to.Ptr("arguments"), - // FilePath: to.Ptr("/path/to/file"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("/path/to/icon"), - // }, - // }, - // { - // Name: to.Ptr("application2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/applicationGroups/startMenuItems"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/startMenuItem/application2"), - // Properties: &armdesktopvirtualization.StartMenuItemProperties{ - // AppAlias: to.Ptr("excel"), - // CommandLineArguments: to.Ptr("arguments"), - // FilePath: to.Ptr("/path/to/file"), - // IconIndex: to.Ptr[int32](1), - // IconPath: to.Ptr("/path/to/icon"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/time_rfc3339.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/time_rfc3339.go index 6a22c03686bf..642a6229a443 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/time_rfc3339.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/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 armdesktopvirtualization diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client.go index c48ebd968077..74fc9dc71d60 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_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 armdesktopvirtualization @@ -48,23 +47,25 @@ func NewUserSessionsClient(subscriptionID string, credential azcore.TokenCredent // Delete - Remove a userSession. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool // - userSessionID - The name of the user session within the specified session host // - options - UserSessionsClientDeleteOptions contains the optional parameters for the UserSessionsClient.Delete method. func (client *UserSessionsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, options *UserSessionsClientDeleteOptions) (UserSessionsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, options) if err != nil { return UserSessionsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UserSessionsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return UserSessionsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return UserSessionsClientDeleteResponse{}, err } return UserSessionsClientDeleteResponse{}, nil } @@ -97,7 +98,7 @@ func (client *UserSessionsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } @@ -109,23 +110,25 @@ func (client *UserSessionsClient) deleteCreateRequest(ctx context.Context, resou // Disconnect - Disconnect a userSession. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool // - userSessionID - The name of the user session within the specified session host // - options - UserSessionsClientDisconnectOptions contains the optional parameters for the UserSessionsClient.Disconnect method. func (client *UserSessionsClient) Disconnect(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, options *UserSessionsClientDisconnectOptions) (UserSessionsClientDisconnectResponse, error) { + var err error req, err := client.disconnectCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, options) if err != nil { return UserSessionsClientDisconnectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UserSessionsClientDisconnectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UserSessionsClientDisconnectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UserSessionsClientDisconnectResponse{}, err } return UserSessionsClientDisconnectResponse{}, nil } @@ -158,7 +161,7 @@ func (client *UserSessionsClient) disconnectCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -167,25 +170,28 @@ func (client *UserSessionsClient) disconnectCreateRequest(ctx context.Context, r // Get - Get a userSession. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool // - userSessionID - The name of the user session within the specified session host // - options - UserSessionsClientGetOptions contains the optional parameters for the UserSessionsClient.Get method. func (client *UserSessionsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, options *UserSessionsClientGetOptions) (UserSessionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, options) if err != nil { return UserSessionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UserSessionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UserSessionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UserSessionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -216,7 +222,7 @@ func (client *UserSessionsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +239,7 @@ func (client *UserSessionsClient) getHandleResponse(resp *http.Response) (UserSe // NewListPager - List userSessions. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool @@ -290,7 +296,7 @@ func (client *UserSessionsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -316,7 +322,7 @@ func (client *UserSessionsClient) listHandleResponse(resp *http.Response) (UserS // NewListByHostPoolPager - List userSessions. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - options - UserSessionsClientListByHostPoolOptions contains the optional parameters for the UserSessionsClient.NewListByHostPoolPager @@ -369,7 +375,7 @@ func (client *UserSessionsClient) listByHostPoolCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -399,7 +405,7 @@ func (client *UserSessionsClient) listByHostPoolHandleResponse(resp *http.Respon // SendMessage - Send a message to a user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - hostPoolName - The name of the host pool within the specified resource group // - sessionHostName - The name of the session host within the specified host pool @@ -407,16 +413,18 @@ func (client *UserSessionsClient) listByHostPoolHandleResponse(resp *http.Respon // - options - UserSessionsClientSendMessageOptions contains the optional parameters for the UserSessionsClient.SendMessage // method. func (client *UserSessionsClient) SendMessage(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, options *UserSessionsClientSendMessageOptions) (UserSessionsClientSendMessageResponse, error) { + var err error req, err := client.sendMessageCreateRequest(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, options) if err != nil { return UserSessionsClientSendMessageResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UserSessionsClientSendMessageResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UserSessionsClientSendMessageResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UserSessionsClientSendMessageResponse{}, err } return UserSessionsClientSendMessageResponse{}, nil } @@ -449,11 +457,14 @@ func (client *UserSessionsClient) sendMessageCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.SendMessage != nil { - return req, runtime.MarshalAsJSON(req, *options.SendMessage) + if err := runtime.MarshalAsJSON(req, *options.SendMessage); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client_example_test.go deleted file mode 100644 index dc6841c1c0a1..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/usersessions_client_example_test.go +++ /dev/null @@ -1,262 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_ListByHostPool.json -func ExampleUserSessionsClient_NewListByHostPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUserSessionsClient().NewListByHostPoolPager("resourceGroup1", "hostPool1", &armdesktopvirtualization.UserSessionsClientListByHostPoolOptions{Filter: to.Ptr("userPrincipalName eq 'user1@microsoft.com' and state eq 'active'"), - PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.UserSessionList = armdesktopvirtualization.UserSessionList{ - // Value: []*armdesktopvirtualization.UserSession{ - // { - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/1"), - // Properties: &armdesktopvirtualization.UserSessionProperties{ - // ActiveDirectoryUserName: to.Ptr("WVDARM\\user1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.ApplicationTypeDesktop), - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // SessionState: to.Ptr(armdesktopvirtualization.SessionStateActive), - // UserPrincipalName: to.Ptr("user1@microsoft.com"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/2"), - // Properties: &armdesktopvirtualization.UserSessionProperties{ - // ActiveDirectoryUserName: to.Ptr("WVDARM\\user1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.ApplicationTypeDesktop), - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // SessionState: to.Ptr(armdesktopvirtualization.SessionStateActive), - // UserPrincipalName: to.Ptr("user1@microsoft.com"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_Get.json -func ExampleUserSessionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUserSessionsClient().Get(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", "1", 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.UserSession = armdesktopvirtualization.UserSession{ - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/1"), - // Properties: &armdesktopvirtualization.UserSessionProperties{ - // ActiveDirectoryUserName: to.Ptr("WVDARM\\user1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.ApplicationTypeDesktop), - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // SessionState: to.Ptr(armdesktopvirtualization.SessionStateActive), - // UserPrincipalName: to.Ptr("user1@microsoft.com"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_Delete.json -func ExampleUserSessionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewUserSessionsClient().Delete(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", "1", &armdesktopvirtualization.UserSessionsClientDeleteOptions{Force: to.Ptr(true)}) - 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_List.json -func ExampleUserSessionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUserSessionsClient().NewListPager("resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", &armdesktopvirtualization.UserSessionsClientListOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.UserSessionList = armdesktopvirtualization.UserSessionList{ - // Value: []*armdesktopvirtualization.UserSession{ - // { - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/1"), - // Properties: &armdesktopvirtualization.UserSessionProperties{ - // ActiveDirectoryUserName: to.Ptr("WVDARM\\user1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.ApplicationTypeDesktop), - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // SessionState: to.Ptr(armdesktopvirtualization.SessionStateActive), - // UserPrincipalName: to.Ptr("user1@microsoft.com"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/hostPools/sessionHosts/userSessions"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1/sessionHosts/sessionHost1.microsoft.com/userSessions/2"), - // Properties: &armdesktopvirtualization.UserSessionProperties{ - // ActiveDirectoryUserName: to.Ptr("WVDARM\\user1"), - // ApplicationType: to.Ptr(armdesktopvirtualization.ApplicationTypeDesktop), - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2008-09-22T14:01:54.9571247Z"); return t}()), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // SessionState: to.Ptr(armdesktopvirtualization.SessionStateActive), - // UserPrincipalName: to.Ptr("user1@microsoft.com"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_Disconnect_Post.json -func ExampleUserSessionsClient_Disconnect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewUserSessionsClient().Disconnect(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", "1", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_SendMessage_Post.json -func ExampleUserSessionsClient_SendMessage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewUserSessionsClient().SendMessage(ctx, "resourceGroup1", "hostPool1", "sessionHost1.microsoft.com", "1", &armdesktopvirtualization.UserSessionsClientSendMessageOptions{SendMessage: &armdesktopvirtualization.SendMessage{ - MessageBody: to.Ptr("body"), - MessageTitle: to.Ptr("title"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client.go index 1975c21cce09..ea3d9b7e74dc 100644 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client.go +++ b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_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 armdesktopvirtualization @@ -48,25 +47,28 @@ func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Create or update a workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace // - workspace - Object containing Workspace definitions. // - options - WorkspacesClientCreateOrUpdateOptions contains the optional parameters for the WorkspacesClient.CreateOrUpdate // method. func (client *WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace, options *WorkspacesClientCreateOrUpdateOptions) (WorkspacesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, workspace, options) if err != nil { return WorkspacesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkspacesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return WorkspacesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WorkspacesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -89,10 +91,13 @@ func (client *WorkspacesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, workspace) + if err := runtime.MarshalAsJSON(req, workspace); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -107,21 +112,23 @@ func (client *WorkspacesClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Remove a workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace // - options - WorkspacesClientDeleteOptions contains the optional parameters for the WorkspacesClient.Delete method. func (client *WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientDeleteOptions) (WorkspacesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, options) if err != nil { return WorkspacesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkspacesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return WorkspacesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return WorkspacesClientDeleteResponse{}, err } return WorkspacesClientDeleteResponse{}, nil } @@ -146,7 +153,7 @@ func (client *WorkspacesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -155,23 +162,26 @@ func (client *WorkspacesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get a workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace // - options - WorkspacesClientGetOptions contains the optional parameters for the WorkspacesClient.Get method. func (client *WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientGetOptions) (WorkspacesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, options) if err != nil { return WorkspacesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkspacesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkspacesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkspacesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -194,7 +204,7 @@ func (client *WorkspacesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +221,7 @@ func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (Workspac // NewListByResourceGroupPager - List workspaces. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - WorkspacesClientListByResourceGroupOptions contains the optional parameters for the WorkspacesClient.NewListByResourceGroupPager // method. @@ -259,7 +269,7 @@ func (client *WorkspacesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") if options != nil && options.PageSize != nil { reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) } @@ -285,7 +295,7 @@ func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Res // NewListBySubscriptionPager - List workspaces in subscription. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - options - WorkspacesClientListBySubscriptionOptions contains the optional parameters for the WorkspacesClient.NewListBySubscriptionPager // method. func (client *WorkspacesClient) NewListBySubscriptionPager(options *WorkspacesClientListBySubscriptionOptions) *runtime.Pager[WorkspacesClientListBySubscriptionResponse] { @@ -328,7 +338,7 @@ func (client *WorkspacesClient) listBySubscriptionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -346,23 +356,26 @@ func (client *WorkspacesClient) listBySubscriptionHandleResponse(resp *http.Resp // Update - Update a workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-09 +// Generated from API version 2022-10-14-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace // - options - WorkspacesClientUpdateOptions contains the optional parameters for the WorkspacesClient.Update method. func (client *WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesClientUpdateOptions) (WorkspacesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, workspaceName, options) if err != nil { return WorkspacesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkspacesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkspacesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkspacesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -385,11 +398,14 @@ func (client *WorkspacesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-09") + reqQP.Set("api-version", "2022-10-14-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Workspace != nil { - return req, runtime.MarshalAsJSON(req, *options.Workspace) + if err := runtime.MarshalAsJSON(req, *options.Workspace); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client_example_test.go b/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client_example_test.go deleted file mode 100644 index a9f1a826ad11..000000000000 --- a/sdk/resourcemanager/desktopvirtualization/armdesktopvirtualization/workspaces_client_example_test.go +++ /dev/null @@ -1,343 +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 armdesktopvirtualization_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/desktopvirtualization/armdesktopvirtualization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_Get.json -func ExampleWorkspacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspacesClient().Get(ctx, "resourceGroup1", "workspace1", 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.Workspace = armdesktopvirtualization.Workspace{ - // Name: to.Ptr("workspace1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_Create.json -func ExampleWorkspacesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspacesClient().CreateOrUpdate(ctx, "resourceGroup1", "workspace1", armdesktopvirtualization.Workspace{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armdesktopvirtualization.WorkspaceProperties{ - Description: to.Ptr("des1"), - FriendlyName: to.Ptr("friendly"), - }, - }, 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.Workspace = armdesktopvirtualization.Workspace{ - // Name: to.Ptr("workspace1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_Delete.json -func ExampleWorkspacesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWorkspacesClient().Delete(ctx, "resourceGroup1", "workspace1", 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/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_Update.json -func ExampleWorkspacesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspacesClient().Update(ctx, "resourceGroup1", "workspace1", &armdesktopvirtualization.WorkspacesClientUpdateOptions{Workspace: &armdesktopvirtualization.WorkspacePatch{ - Properties: &armdesktopvirtualization.WorkspacePatchProperties{ - Description: to.Ptr("des1"), - FriendlyName: to.Ptr("friendly"), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - }) - 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.Workspace = armdesktopvirtualization.Workspace{ - // Name: to.Ptr("workspace1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_ListByResourceGroup.json -func ExampleWorkspacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkspacesClient().NewListByResourceGroupPager("resourceGroup1", &armdesktopvirtualization.WorkspacesClientListByResourceGroupOptions{PageSize: to.Ptr[int32](10), - IsDescending: to.Ptr(true), - InitialSkip: to.Ptr[int32](0), - }) - 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.WorkspaceList = armdesktopvirtualization.WorkspaceList{ - // Value: []*armdesktopvirtualization.Workspace{ - // { - // Name: to.Ptr("workspace1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("workspace2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f339d469c0fe83466edfe295a7960c82ebecf4f/specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_ListBySubscription.json -func ExampleWorkspacesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdesktopvirtualization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkspacesClient().NewListBySubscriptionPager(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.WorkspaceList = armdesktopvirtualization.WorkspaceList{ - // Value: []*armdesktopvirtualization.Workspace{ - // { - // Name: to.Ptr("workspace1"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("workspace2"), - // Type: to.Ptr("Microsoft.DesktopVirtualization/workspaces"), - // ID: to.Ptr("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace2"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armdesktopvirtualization.WorkspaceProperties{ - // Description: to.Ptr("des1"), - // CloudPcResource: to.Ptr(false), - // FriendlyName: to.Ptr("friendly"), - // ObjectID: to.Ptr("7877fb31-4bde-49fd-9df3-c046e0ec5325"), - // }, - // SystemData: &armdesktopvirtualization.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdesktopvirtualization.CreatedByTypeUser), - // }, - // }}, - // } - } -}