diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4c..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/_meta.json deleted file mode 100644 index d077a1a195d2a..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "2b56c8a3da0e04aea6f6d80a9ac04741d1ae5904", - "readme": "/_/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md", - "tag": "package-preview-2021-09", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applicationgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applicationgroups.go deleted file mode 100644 index 730dac683d835..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applicationgroups.go +++ /dev/null @@ -1,649 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationGroupsClient is the client for the ApplicationGroups methods of the Desktopvirtualization service. -type ApplicationGroupsClient struct { - BaseClient -} - -// NewApplicationGroupsClient creates an instance of the ApplicationGroupsClient client. -func NewApplicationGroupsClient(subscriptionID string) ApplicationGroupsClient { - return NewApplicationGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationGroupsClientWithBaseURI creates an instance of the ApplicationGroupsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewApplicationGroupsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGroupsClient { - return ApplicationGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an applicationGroup. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationGroup - object containing ApplicationGroup definitions. -func (client ApplicationGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup ApplicationGroup) (result ApplicationGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationGroup, - Constraints: []validation.Constraint{{Target: "applicationGroup.ApplicationGroupProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "applicationGroup.ApplicationGroupProperties.HostPoolArmPath", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup ApplicationGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithJSON(applicationGroup), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove an applicationGroup. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client ApplicationGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an application group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client ApplicationGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string) (result ApplicationGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) GetResponder(resp *http.Response) (result ApplicationGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list applicationGroups. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// filter - oData filter expression. Valid properties for filtering are applicationGroupType. -func (client ApplicationGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result ApplicationGroupListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.agl.Response.Response != nil { - sc = result.agl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.agl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.agl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.agl.hasNextLink() && result.agl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ApplicationGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ApplicationGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationGroupList) (result ApplicationGroupList, err error) { - req, err := lastResults.applicationGroupListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result ApplicationGroupListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter) - return -} - -// ListBySubscription list applicationGroups in subscription. -// Parameters: -// filter - oData filter expression. Valid properties for filtering are applicationGroupType. -func (client ApplicationGroupsClient) ListBySubscription(ctx context.Context, filter string) (result ApplicationGroupListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListBySubscription") - defer func() { - sc := -1 - if result.agl.Response.Response != nil { - sc = result.agl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.agl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.agl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.agl.hasNextLink() && result.agl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ApplicationGroupsClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ApplicationGroupsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ApplicationGroupList) (result ApplicationGroupList, err error) { - req, err := lastResults.applicationGroupListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationGroupsClient) ListBySubscriptionComplete(ctx context.Context, filter string) (result ApplicationGroupListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, filter) - return -} - -// Update update an applicationGroup. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationGroup - object containing ApplicationGroup definitions. -func (client ApplicationGroupsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup *ApplicationGroupPatch) (result ApplicationGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup *ApplicationGroupPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if applicationGroup != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(applicationGroup)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) UpdateResponder(resp *http.Response) (result ApplicationGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applications.go deleted file mode 100644 index 7ea340d6a4471..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applications.go +++ /dev/null @@ -1,544 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationsClient is the client for the Applications methods of the Desktopvirtualization service. -type ApplicationsClient struct { - BaseClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(subscriptionID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an application. -// Parameters: -// 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 -// application - object containing Application definitions. -func (client ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: application, - Constraints: []validation.Constraint{{Target: "application.ApplicationProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationName, application) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(application), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove an application. -// Parameters: -// 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 -func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an application. -// Parameters: -// 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 -func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list applications. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client ApplicationsClient) List(ctx context.Context, resourceGroupName string, applicationGroupName string) (result ApplicationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result.al, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ApplicationsClient) listNextResults(ctx context.Context, lastResults ApplicationList) (result ApplicationList, err error) { - req, err := lastResults.applicationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result ApplicationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, applicationGroupName) - return -} - -// Update update an application. -// Parameters: -// 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 -// application - object containing Application definitions. -func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application *ApplicationPatch) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationName, application) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application *ApplicationPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if application != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(application)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/client.go deleted file mode 100644 index 5965600296ad0..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package desktopvirtualization implements the Azure ARM Desktopvirtualization service API version 2021-09-03-preview. -// -// -package desktopvirtualization - -// 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. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Desktopvirtualization - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Desktopvirtualization. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/desktops.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/desktops.go deleted file mode 100644 index c07bd2fefc764..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/desktops.go +++ /dev/null @@ -1,354 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DesktopsClient is the client for the Desktops methods of the Desktopvirtualization service. -type DesktopsClient struct { - BaseClient -} - -// NewDesktopsClient creates an instance of the DesktopsClient client. -func NewDesktopsClient(subscriptionID string) DesktopsClient { - return NewDesktopsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDesktopsClientWithBaseURI creates an instance of the DesktopsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDesktopsClientWithBaseURI(baseURI string, subscriptionID string) DesktopsClient { - return DesktopsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a desktop. -// Parameters: -// 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 -func (client DesktopsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string) (result Desktop, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: desktopName, - Constraints: []validation.Constraint{{Target: "desktopName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "desktopName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.DesktopsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationGroupName, desktopName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DesktopsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "desktopName": autorest.Encode("path", desktopName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DesktopsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DesktopsClient) GetResponder(resp *http.Response) (result Desktop, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list desktops. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client DesktopsClient) List(ctx context.Context, resourceGroupName string, applicationGroupName string) (result DesktopListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.List") - defer func() { - sc := -1 - if result.dl.Response.Response != nil { - sc = result.dl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.DesktopsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "List", resp, "Failure sending request") - return - } - - result.dl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "List", resp, "Failure responding to request") - return - } - if result.dl.hasNextLink() && result.dl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DesktopsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DesktopsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DesktopsClient) ListResponder(resp *http.Response) (result DesktopList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DesktopsClient) listNextResults(ctx context.Context, lastResults DesktopList) (result DesktopList, err error) { - req, err := lastResults.desktopListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DesktopsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result DesktopListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, applicationGroupName) - return -} - -// Update update a desktop. -// Parameters: -// 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 -// desktop - object containing Desktop definitions. -func (client DesktopsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string, desktop *DesktopPatch) (result Desktop, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: desktopName, - Constraints: []validation.Constraint{{Target: "desktopName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "desktopName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.DesktopsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGroupName, desktopName, desktop) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DesktopsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string, desktop *DesktopPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "desktopName": autorest.Encode("path", desktopName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if desktop != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(desktop)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DesktopsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DesktopsClient) UpdateResponder(resp *http.Response) (result Desktop, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/enums.go deleted file mode 100644 index ffb1d73587572..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/enums.go +++ /dev/null @@ -1,509 +0,0 @@ -package desktopvirtualization - -// 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. - -// ApplicationGroupType enumerates the values for application group type. -type ApplicationGroupType string - -const ( - // ApplicationGroupTypeDesktop ... - ApplicationGroupTypeDesktop ApplicationGroupType = "Desktop" - // ApplicationGroupTypeRemoteApp ... - ApplicationGroupTypeRemoteApp ApplicationGroupType = "RemoteApp" -) - -// PossibleApplicationGroupTypeValues returns an array of possible values for the ApplicationGroupType const type. -func PossibleApplicationGroupTypeValues() []ApplicationGroupType { - return []ApplicationGroupType{ApplicationGroupTypeDesktop, ApplicationGroupTypeRemoteApp} -} - -// ApplicationType enumerates the values for application type. -type ApplicationType string - -const ( - // ApplicationTypeDesktop ... - ApplicationTypeDesktop ApplicationType = "Desktop" - // ApplicationTypeRemoteApp ... - ApplicationTypeRemoteApp ApplicationType = "RemoteApp" -) - -// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. -func PossibleApplicationTypeValues() []ApplicationType { - return []ApplicationType{ApplicationTypeDesktop, ApplicationTypeRemoteApp} -} - -// CommandLineSetting enumerates the values for command line setting. -type CommandLineSetting string - -const ( - // CommandLineSettingAllow ... - CommandLineSettingAllow CommandLineSetting = "Allow" - // CommandLineSettingDoNotAllow ... - CommandLineSettingDoNotAllow CommandLineSetting = "DoNotAllow" - // CommandLineSettingRequire ... - CommandLineSettingRequire CommandLineSetting = "Require" -) - -// PossibleCommandLineSettingValues returns an array of possible values for the CommandLineSetting const type. -func PossibleCommandLineSettingValues() []CommandLineSetting { - return []CommandLineSetting{CommandLineSettingAllow, CommandLineSettingDoNotAllow, CommandLineSettingRequire} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// HealthCheckName enumerates the values for health check name. -type HealthCheckName string - -const ( - // HealthCheckNameAppAttachHealthCheck Verifies that the AppAttachService is healthy (there were no issues - // during package 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. - 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. - 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. - 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. - 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. - HealthCheckNameFSLogixHealthCheck HealthCheckName = "FSLogixHealthCheck" - // HealthCheckNameMetaDataServiceCheck Verifies the metadata service is accessible and return compute - // properties. - 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. - 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. - 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. - 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 - // ...). - 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. - HealthCheckNameWebRTCRedirectorCheck HealthCheckName = "WebRTCRedirectorCheck" -) - -// PossibleHealthCheckNameValues returns an array of possible values for the HealthCheckName const type. -func PossibleHealthCheckNameValues() []HealthCheckName { - return []HealthCheckName{HealthCheckNameAppAttachHealthCheck, HealthCheckNameDomainJoinedCheck, HealthCheckNameDomainReachable, HealthCheckNameDomainTrustCheck, HealthCheckNameFSLogixHealthCheck, HealthCheckNameMetaDataServiceCheck, HealthCheckNameMonitoringAgentCheck, HealthCheckNameSupportedEncryptionCheck, HealthCheckNameSxSStackListenerCheck, HealthCheckNameUrlsAccessibleCheck, HealthCheckNameWebRTCRedirectorCheck} -} - -// HealthCheckResult enumerates the values for health check result. -type HealthCheckResult string - -const ( - // HealthCheckResultHealthCheckFailed Health check failed. - HealthCheckResultHealthCheckFailed HealthCheckResult = "HealthCheckFailed" - // HealthCheckResultHealthCheckSucceeded Health check passed. - HealthCheckResultHealthCheckSucceeded HealthCheckResult = "HealthCheckSucceeded" - // HealthCheckResultSessionHostShutdown We received a Shutdown notification. - HealthCheckResultSessionHostShutdown HealthCheckResult = "SessionHostShutdown" - // HealthCheckResultUnknown Health check result is not currently known. - HealthCheckResultUnknown HealthCheckResult = "Unknown" -) - -// PossibleHealthCheckResultValues returns an array of possible values for the HealthCheckResult const type. -func PossibleHealthCheckResultValues() []HealthCheckResult { - return []HealthCheckResult{HealthCheckResultHealthCheckFailed, HealthCheckResultHealthCheckSucceeded, HealthCheckResultSessionHostShutdown, HealthCheckResultUnknown} -} - -// HostPoolType enumerates the values for host pool type. -type HostPoolType string - -const ( - // HostPoolTypeBYODesktop Users assign their own machines, load balancing logic remains the same as - // Personal. PersonalDesktopAssignmentType must be Direct. - HostPoolTypeBYODesktop HostPoolType = "BYODesktop" - // HostPoolTypePersonal Users will be assigned a SessionHost either by administrators - // (PersonalDesktopAssignmentType = Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = - // Automatic). They will always be redirected to their assigned SessionHost. - HostPoolTypePersonal HostPoolType = "Personal" - // HostPoolTypePooled Users get a new (random) SessionHost every time it connects to the HostPool. - HostPoolTypePooled HostPoolType = "Pooled" -) - -// PossibleHostPoolTypeValues returns an array of possible values for the HostPoolType const type. -func PossibleHostPoolTypeValues() []HostPoolType { - return []HostPoolType{HostPoolTypeBYODesktop, HostPoolTypePersonal, HostPoolTypePooled} -} - -// LoadBalancerType enumerates the values for load balancer type. -type LoadBalancerType string - -const ( - // LoadBalancerTypeBreadthFirst ... - LoadBalancerTypeBreadthFirst LoadBalancerType = "BreadthFirst" - // LoadBalancerTypeDepthFirst ... - LoadBalancerTypeDepthFirst LoadBalancerType = "DepthFirst" - // LoadBalancerTypePersistent ... - LoadBalancerTypePersistent LoadBalancerType = "Persistent" -) - -// PossibleLoadBalancerTypeValues returns an array of possible values for the LoadBalancerType const type. -func PossibleLoadBalancerTypeValues() []LoadBalancerType { - return []LoadBalancerType{LoadBalancerTypeBreadthFirst, LoadBalancerTypeDepthFirst, LoadBalancerTypePersistent} -} - -// Operation enumerates the values for operation. -type Operation string - -const ( - // OperationComplete Complete the migration. - OperationComplete Operation = "Complete" - // OperationHide Hide the hostpool. - OperationHide Operation = "Hide" - // OperationRevoke Revoke the migration. - OperationRevoke Operation = "Revoke" - // OperationStart Start the migration. - OperationStart Operation = "Start" - // OperationUnhide Unhide the hostpool. - OperationUnhide Operation = "Unhide" -) - -// PossibleOperationValues returns an array of possible values for the Operation const type. -func PossibleOperationValues() []Operation { - return []Operation{OperationComplete, OperationHide, OperationRevoke, OperationStart, OperationUnhide} -} - -// PersonalDesktopAssignmentType enumerates the values for personal desktop assignment type. -type PersonalDesktopAssignmentType string - -const ( - // PersonalDesktopAssignmentTypeAutomatic ... - PersonalDesktopAssignmentTypeAutomatic PersonalDesktopAssignmentType = "Automatic" - // PersonalDesktopAssignmentTypeDirect ... - PersonalDesktopAssignmentTypeDirect PersonalDesktopAssignmentType = "Direct" -) - -// PossiblePersonalDesktopAssignmentTypeValues returns an array of possible values for the PersonalDesktopAssignmentType const type. -func PossiblePersonalDesktopAssignmentTypeValues() []PersonalDesktopAssignmentType { - return []PersonalDesktopAssignmentType{PersonalDesktopAssignmentTypeAutomatic, PersonalDesktopAssignmentTypeDirect} -} - -// PreferredAppGroupType enumerates the values for preferred app group type. -type PreferredAppGroupType string - -const ( - // PreferredAppGroupTypeDesktop ... - PreferredAppGroupTypeDesktop PreferredAppGroupType = "Desktop" - // PreferredAppGroupTypeNone ... - PreferredAppGroupTypeNone PreferredAppGroupType = "None" - // PreferredAppGroupTypeRailApplications ... - PreferredAppGroupTypeRailApplications PreferredAppGroupType = "RailApplications" -) - -// PossiblePreferredAppGroupTypeValues returns an array of possible values for the PreferredAppGroupType const type. -func PossiblePreferredAppGroupTypeValues() []PreferredAppGroupType { - return []PreferredAppGroupType{PreferredAppGroupTypeDesktop, PreferredAppGroupTypeNone, PreferredAppGroupTypeRailApplications} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegistrationTokenOperation enumerates the values for registration token operation. -type RegistrationTokenOperation string - -const ( - // RegistrationTokenOperationDelete ... - RegistrationTokenOperationDelete RegistrationTokenOperation = "Delete" - // RegistrationTokenOperationNone ... - RegistrationTokenOperationNone RegistrationTokenOperation = "None" - // RegistrationTokenOperationUpdate ... - RegistrationTokenOperationUpdate RegistrationTokenOperation = "Update" -) - -// PossibleRegistrationTokenOperationValues returns an array of possible values for the RegistrationTokenOperation const type. -func PossibleRegistrationTokenOperationValues() []RegistrationTokenOperation { - return []RegistrationTokenOperation{RegistrationTokenOperationDelete, RegistrationTokenOperationNone, RegistrationTokenOperationUpdate} -} - -// RemoteApplicationType enumerates the values for remote application type. -type RemoteApplicationType string - -const ( - // RemoteApplicationTypeInBuilt ... - RemoteApplicationTypeInBuilt RemoteApplicationType = "InBuilt" - // RemoteApplicationTypeMsixApplication ... - RemoteApplicationTypeMsixApplication RemoteApplicationType = "MsixApplication" -) - -// PossibleRemoteApplicationTypeValues returns an array of possible values for the RemoteApplicationType const type. -func PossibleRemoteApplicationTypeValues() []RemoteApplicationType { - return []RemoteApplicationType{RemoteApplicationTypeInBuilt, RemoteApplicationTypeMsixApplication} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeSystemAssigned} -} - -// ScalingHostPoolType enumerates the values for scaling host pool type. -type ScalingHostPoolType string - -const ( - // ScalingHostPoolTypePooled Users get a new (random) SessionHost every time it connects to the HostPool. - ScalingHostPoolTypePooled ScalingHostPoolType = "Pooled" -) - -// PossibleScalingHostPoolTypeValues returns an array of possible values for the ScalingHostPoolType const type. -func PossibleScalingHostPoolTypeValues() []ScalingHostPoolType { - return []ScalingHostPoolType{ScalingHostPoolTypePooled} -} - -// SessionHostLoadBalancingAlgorithm enumerates the values for session host load balancing algorithm. -type SessionHostLoadBalancingAlgorithm string - -const ( - // SessionHostLoadBalancingAlgorithmBreadthFirst ... - SessionHostLoadBalancingAlgorithmBreadthFirst SessionHostLoadBalancingAlgorithm = "BreadthFirst" - // SessionHostLoadBalancingAlgorithmDepthFirst ... - SessionHostLoadBalancingAlgorithmDepthFirst SessionHostLoadBalancingAlgorithm = "DepthFirst" -) - -// PossibleSessionHostLoadBalancingAlgorithmValues returns an array of possible values for the SessionHostLoadBalancingAlgorithm const type. -func PossibleSessionHostLoadBalancingAlgorithmValues() []SessionHostLoadBalancingAlgorithm { - return []SessionHostLoadBalancingAlgorithm{SessionHostLoadBalancingAlgorithmBreadthFirst, SessionHostLoadBalancingAlgorithmDepthFirst} -} - -// SessionState enumerates the values for session state. -type SessionState string - -const ( - // SessionStateActive ... - SessionStateActive SessionState = "Active" - // SessionStateDisconnected ... - SessionStateDisconnected SessionState = "Disconnected" - // SessionStateLogOff ... - SessionStateLogOff SessionState = "LogOff" - // SessionStatePending ... - SessionStatePending SessionState = "Pending" - // SessionStateUnknown ... - SessionStateUnknown SessionState = "Unknown" - // SessionStateUserProfileDiskMounted ... - SessionStateUserProfileDiskMounted SessionState = "UserProfileDiskMounted" -) - -// PossibleSessionStateValues returns an array of possible values for the SessionState const type. -func PossibleSessionStateValues() []SessionState { - return []SessionState{SessionStateActive, SessionStateDisconnected, SessionStateLogOff, SessionStatePending, SessionStateUnknown, SessionStateUserProfileDiskMounted} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierFree ... - SkuTierFree SkuTier = "Free" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierFree, SkuTierPremium, SkuTierStandard} -} - -// SSOSecretType enumerates the values for sso secret type. -type SSOSecretType string - -const ( - // SSOSecretTypeCertificate ... - SSOSecretTypeCertificate SSOSecretType = "Certificate" - // SSOSecretTypeCertificateInKeyVault ... - SSOSecretTypeCertificateInKeyVault SSOSecretType = "CertificateInKeyVault" - // SSOSecretTypeSharedKey ... - SSOSecretTypeSharedKey SSOSecretType = "SharedKey" - // SSOSecretTypeSharedKeyInKeyVault ... - SSOSecretTypeSharedKeyInKeyVault SSOSecretType = "SharedKeyInKeyVault" -) - -// PossibleSSOSecretTypeValues returns an array of possible values for the SSOSecretType const type. -func PossibleSSOSecretTypeValues() []SSOSecretType { - return []SSOSecretType{SSOSecretTypeCertificate, SSOSecretTypeCertificateInKeyVault, SSOSecretTypeSharedKey, SSOSecretTypeSharedKeyInKeyVault} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusAvailable Session Host has passed all the health checks and is available to handle connections. - StatusAvailable Status = "Available" - // StatusDisconnected The Session Host is unavailable because it is currently disconnected. - StatusDisconnected Status = "Disconnected" - // StatusDomainTrustRelationshipLost SessionHost's domain trust relationship lost - StatusDomainTrustRelationshipLost Status = "DomainTrustRelationshipLost" - // StatusFSLogixNotHealthy FSLogix is in an unhealthy state on the session host. - StatusFSLogixNotHealthy Status = "FSLogixNotHealthy" - // StatusNeedsAssistance New status to inform admins that the health on their endpoint needs to be fixed. - // The connections might not fail, as these issues are not fatal. - StatusNeedsAssistance Status = "NeedsAssistance" - // StatusNoHeartbeat The Session Host is not heart beating. - StatusNoHeartbeat Status = "NoHeartbeat" - // StatusNotJoinedToDomain SessionHost is not joined to domain. - StatusNotJoinedToDomain Status = "NotJoinedToDomain" - // StatusShutdown Session Host is shutdown - RD Agent reported session host to be stopped or deallocated. - StatusShutdown Status = "Shutdown" - // StatusSxSStackListenerNotReady SxS stack installed on the SessionHost is not ready to receive - // connections. - StatusSxSStackListenerNotReady Status = "SxSStackListenerNotReady" - // StatusUnavailable Session Host is either turned off or has failed critical health checks which is - // causing service not to be able to route connections to this session host. Note this replaces previous - // 'NoHeartBeat' status. - StatusUnavailable Status = "Unavailable" - // StatusUpgradeFailed Session Host is unavailable because the critical component upgrade (agent, - // side-by-side stack, etc.) failed. - StatusUpgradeFailed Status = "UpgradeFailed" - // StatusUpgrading Session Host is unavailable because currently an upgrade of RDAgent/side-by-side stack - // is in progress. Note: this state will be removed once the upgrade completes and the host is able to - // accept connections. - StatusUpgrading Status = "Upgrading" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusAvailable, StatusDisconnected, StatusDomainTrustRelationshipLost, StatusFSLogixNotHealthy, StatusNeedsAssistance, StatusNoHeartbeat, StatusNotJoinedToDomain, StatusShutdown, StatusSxSStackListenerNotReady, StatusUnavailable, StatusUpgradeFailed, StatusUpgrading} -} - -// StopHostsWhen enumerates the values for stop hosts when. -type StopHostsWhen string - -const ( - // StopHostsWhenZeroActiveSessions ... - StopHostsWhenZeroActiveSessions StopHostsWhen = "ZeroActiveSessions" - // StopHostsWhenZeroSessions ... - StopHostsWhenZeroSessions StopHostsWhen = "ZeroSessions" -) - -// PossibleStopHostsWhenValues returns an array of possible values for the StopHostsWhen const type. -func PossibleStopHostsWhenValues() []StopHostsWhen { - return []StopHostsWhen{StopHostsWhenZeroActiveSessions, StopHostsWhenZeroSessions} -} - -// UpdateState enumerates the values for update state. -type UpdateState string - -const ( - // UpdateStateFailed ... - UpdateStateFailed UpdateState = "Failed" - // UpdateStateInitial ... - UpdateStateInitial UpdateState = "Initial" - // UpdateStatePending ... - UpdateStatePending UpdateState = "Pending" - // UpdateStateStarted ... - UpdateStateStarted UpdateState = "Started" - // UpdateStateSucceeded ... - UpdateStateSucceeded UpdateState = "Succeeded" -) - -// PossibleUpdateStateValues returns an array of possible values for the UpdateState const type. -func PossibleUpdateStateValues() []UpdateState { - return []UpdateState{UpdateStateFailed, UpdateStateInitial, UpdateStatePending, UpdateStateStarted, UpdateStateSucceeded} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/hostpools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/hostpools.go deleted file mode 100644 index 5631121963d5c..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/hostpools.go +++ /dev/null @@ -1,730 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// HostPoolsClient is the client for the HostPools methods of the Desktopvirtualization service. -type HostPoolsClient struct { - BaseClient -} - -// NewHostPoolsClient creates an instance of the HostPoolsClient client. -func NewHostPoolsClient(subscriptionID string) HostPoolsClient { - return NewHostPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHostPoolsClientWithBaseURI creates an instance of the HostPoolsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewHostPoolsClientWithBaseURI(baseURI string, subscriptionID string) HostPoolsClient { - return HostPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a host pool. -// Parameters: -// 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. -func (client HostPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool HostPool) (result HostPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: hostPool, - Constraints: []validation.Constraint{{Target: "hostPool.HostPoolProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, hostPoolName, hostPool) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client HostPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool HostPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithJSON(hostPool), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result HostPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// force - force flag to delete sessionHost. -func (client HostPoolsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HostPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client HostPoolsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string) (result HostPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HostPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) GetResponder(resp *http.Response) (result HostPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list hostPools in subscription. -func (client HostPoolsClient) List(ctx context.Context) (result HostPoolListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.List") - defer func() { - sc := -1 - if result.hpl.Response.Response != nil { - sc = result.hpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.hpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "List", resp, "Failure sending request") - return - } - - result.hpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.hpl.hasNextLink() && result.hpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client HostPoolsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) ListResponder(resp *http.Response) (result HostPoolList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client HostPoolsClient) listNextResults(ctx context.Context, lastResults HostPoolList) (result HostPoolList, err error) { - req, err := lastResults.hostPoolListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client HostPoolsClient) ListComplete(ctx context.Context) (result HostPoolListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup list hostPools. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client HostPoolsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result HostPoolListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.hpl.Response.Response != nil { - sc = result.hpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.hpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.hpl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.hpl.hasNextLink() && result.hpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client HostPoolsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) ListByResourceGroupResponder(resp *http.Response) (result HostPoolList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client HostPoolsClient) listByResourceGroupNextResults(ctx context.Context, lastResults HostPoolList) (result HostPoolList, err error) { - req, err := lastResults.hostPoolListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client HostPoolsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result HostPoolListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// RetrieveRegistrationToken registration token of the host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client HostPoolsClient) RetrieveRegistrationToken(ctx context.Context, resourceGroupName string, hostPoolName string) (result RegistrationInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.RetrieveRegistrationToken") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", err.Error()) - } - - req, err := client.RetrieveRegistrationTokenPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", nil, "Failure preparing request") - return - } - - resp, err := client.RetrieveRegistrationTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", resp, "Failure sending request") - return - } - - result, err = client.RetrieveRegistrationTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", resp, "Failure responding to request") - return - } - - return -} - -// RetrieveRegistrationTokenPreparer prepares the RetrieveRegistrationToken request. -func (client HostPoolsClient) RetrieveRegistrationTokenPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RetrieveRegistrationTokenSender sends the RetrieveRegistrationToken request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) RetrieveRegistrationTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RetrieveRegistrationTokenResponder handles the response to the RetrieveRegistrationToken request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) RetrieveRegistrationTokenResponder(resp *http.Response) (result RegistrationInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a host pool. -// Parameters: -// 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. -func (client HostPoolsClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool *HostPoolPatch) (result HostPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, hostPoolName, hostPool) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HostPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool *HostPoolPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if hostPool != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(hostPool)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) UpdateResponder(resp *http.Response) (result HostPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/models.go deleted file mode 100644 index 1fcaa5188eaff..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/models.go +++ /dev/null @@ -1,5627 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" - -// Application schema for Application properties. -type Application struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ApplicationProperties - Detailed properties for Application - *ApplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.SystemData != nil { - objectMap["systemData"] = a.SystemData - } - if a.ApplicationProperties != nil { - objectMap["properties"] = a.ApplicationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Application struct. -func (a *Application) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - a.SystemData = &systemData - } - case "properties": - if v != nil { - var applicationProperties ApplicationProperties - err = json.Unmarshal(*v, &applicationProperties) - if err != nil { - return err - } - a.ApplicationProperties = &applicationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - } - } - - return nil -} - -// ApplicationGroup represents a ApplicationGroup definition. -type ApplicationGroup struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ApplicationGroupProperties - Detailed properties for ApplicationGroup - *ApplicationGroupProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - 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"` - // Kind - 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"` - // Etag - 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"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroup. -func (ag ApplicationGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag.SystemData != nil { - objectMap["systemData"] = ag.SystemData - } - if ag.ApplicationGroupProperties != nil { - objectMap["properties"] = ag.ApplicationGroupProperties - } - if ag.Location != nil { - objectMap["location"] = ag.Location - } - if ag.ManagedBy != nil { - objectMap["managedBy"] = ag.ManagedBy - } - if ag.Kind != nil { - objectMap["kind"] = ag.Kind - } - if ag.Tags != nil { - objectMap["tags"] = ag.Tags - } - if ag.Identity != nil { - objectMap["identity"] = ag.Identity - } - if ag.Sku != nil { - objectMap["sku"] = ag.Sku - } - if ag.Plan != nil { - objectMap["plan"] = ag.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGroup struct. -func (ag *ApplicationGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ag.SystemData = &systemData - } - case "properties": - if v != nil { - var applicationGroupProperties ApplicationGroupProperties - err = json.Unmarshal(*v, &applicationGroupProperties) - if err != nil { - return err - } - ag.ApplicationGroupProperties = &applicationGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ag.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - ag.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ag.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ag.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ag.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ag.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - ag.Plan = &plan - } - } - } - - return nil -} - -// ApplicationGroupList list of ApplicationGroup definitions. -type ApplicationGroupList struct { - autorest.Response `json:"-"` - // Value - List of ApplicationGroup definitions. - Value *[]ApplicationGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroupList. -func (agl ApplicationGroupList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agl.Value != nil { - objectMap["value"] = agl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationGroupListIterator provides access to a complete listing of ApplicationGroup values. -type ApplicationGroupListIterator struct { - i int - page ApplicationGroupListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGroupListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGroupListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGroupListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGroupListIterator) Response() ApplicationGroupList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGroupListIterator) Value() ApplicationGroup { - if !iter.page.NotDone() { - return ApplicationGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGroupListIterator type. -func NewApplicationGroupListIterator(page ApplicationGroupListPage) ApplicationGroupListIterator { - return ApplicationGroupListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agl ApplicationGroupList) IsEmpty() bool { - return agl.Value == nil || len(*agl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agl ApplicationGroupList) hasNextLink() bool { - return agl.NextLink != nil && len(*agl.NextLink) != 0 -} - -// applicationGroupListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agl ApplicationGroupList) applicationGroupListPreparer(ctx context.Context) (*http.Request, error) { - if !agl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agl.NextLink))) -} - -// ApplicationGroupListPage contains a page of ApplicationGroup values. -type ApplicationGroupListPage struct { - fn func(context.Context, ApplicationGroupList) (ApplicationGroupList, error) - agl ApplicationGroupList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGroupListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agl) - if err != nil { - return err - } - page.agl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGroupListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGroupListPage) NotDone() bool { - return !page.agl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGroupListPage) Response() ApplicationGroupList { - return page.agl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGroupListPage) Values() []ApplicationGroup { - if page.agl.IsEmpty() { - return nil - } - return *page.agl.Value -} - -// Creates a new instance of the ApplicationGroupListPage type. -func NewApplicationGroupListPage(cur ApplicationGroupList, getNextPage func(context.Context, ApplicationGroupList) (ApplicationGroupList, error)) ApplicationGroupListPage { - return ApplicationGroupListPage{ - fn: getNextPage, - agl: cur, - } -} - -// ApplicationGroupPatch applicationGroup properties that can be patched. -type ApplicationGroupPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // ApplicationGroupPatchProperties - ApplicationGroup properties that can be patched. - *ApplicationGroupPatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroupPatch. -func (agp ApplicationGroupPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agp.Tags != nil { - objectMap["tags"] = agp.Tags - } - if agp.ApplicationGroupPatchProperties != nil { - objectMap["properties"] = agp.ApplicationGroupPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGroupPatch struct. -func (agp *ApplicationGroupPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agp.Tags = tags - } - case "properties": - if v != nil { - var applicationGroupPatchProperties ApplicationGroupPatchProperties - err = json.Unmarshal(*v, &applicationGroupPatchProperties) - if err != nil { - return err - } - agp.ApplicationGroupPatchProperties = &applicationGroupPatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agp.Type = &typeVar - } - } - } - - return nil -} - -// ApplicationGroupPatchProperties applicationGroup properties that can be patched. -type ApplicationGroupPatchProperties struct { - // Description - Description of ApplicationGroup. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of ApplicationGroup. - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// ApplicationGroupProperties schema for ApplicationGroup properties. -type ApplicationGroupProperties struct { - // ObjectID - READ-ONLY; ObjectId of ApplicationGroup. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of ApplicationGroup. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of ApplicationGroup. - FriendlyName *string `json:"friendlyName,omitempty"` - // HostPoolArmPath - HostPool arm path of ApplicationGroup. - HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` - // WorkspaceArmPath - READ-ONLY; Workspace arm path of ApplicationGroup. - WorkspaceArmPath *string `json:"workspaceArmPath,omitempty"` - // ApplicationGroupType - Resource Type of ApplicationGroup. Possible values include: 'ApplicationGroupTypeRemoteApp', 'ApplicationGroupTypeDesktop' - ApplicationGroupType ApplicationGroupType `json:"applicationGroupType,omitempty"` - // MigrationRequest - The registration info of HostPool. - MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` - // CloudPcResource - READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroupProperties. -func (agp ApplicationGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agp.Description != nil { - objectMap["description"] = agp.Description - } - if agp.FriendlyName != nil { - objectMap["friendlyName"] = agp.FriendlyName - } - if agp.HostPoolArmPath != nil { - objectMap["hostPoolArmPath"] = agp.HostPoolArmPath - } - if agp.ApplicationGroupType != "" { - objectMap["applicationGroupType"] = agp.ApplicationGroupType - } - if agp.MigrationRequest != nil { - objectMap["migrationRequest"] = agp.MigrationRequest - } - return json.Marshal(objectMap) -} - -// ApplicationList list of Application definitions. -type ApplicationList struct { - autorest.Response `json:"-"` - // Value - List of Application definitions. - Value *[]Application `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationList. -func (al ApplicationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if al.Value != nil { - objectMap["value"] = al.Value - } - return json.Marshal(objectMap) -} - -// ApplicationListIterator provides access to a complete listing of Application values. -type ApplicationListIterator struct { - i int - page ApplicationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationListIterator) Response() ApplicationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationListIterator) Value() Application { - if !iter.page.NotDone() { - return Application{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationListIterator type. -func NewApplicationListIterator(page ApplicationListPage) ApplicationListIterator { - return ApplicationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al ApplicationList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al ApplicationList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// applicationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al ApplicationList) applicationListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// ApplicationListPage contains a page of Application values. -type ApplicationListPage struct { - fn func(context.Context, ApplicationList) (ApplicationList, error) - al ApplicationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationListPage) Response() ApplicationList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationListPage) Values() []Application { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the ApplicationListPage type. -func NewApplicationListPage(cur ApplicationList, getNextPage func(context.Context, ApplicationList) (ApplicationList, error)) ApplicationListPage { - return ApplicationListPage{ - fn: getNextPage, - al: cur, - } -} - -// ApplicationPatch application properties that can be patched. -type ApplicationPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // ApplicationPatchProperties - Detailed properties for Application - *ApplicationPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPatch. -func (ap ApplicationPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - if ap.ApplicationPatchProperties != nil { - objectMap["properties"] = ap.ApplicationPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationPatch struct. -func (ap *ApplicationPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "properties": - if v != nil { - var applicationPatchProperties ApplicationPatchProperties - err = json.Unmarshal(*v, &applicationPatchProperties) - if err != nil { - return err - } - ap.ApplicationPatchProperties = &applicationPatchProperties - } - } - } - - return nil -} - -// ApplicationPatchProperties application properties that can be patched. -type ApplicationPatchProperties struct { - // Description - Description of Application. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Application. - FriendlyName *string `json:"friendlyName,omitempty"` - // FilePath - Specifies a path for the executable file for the application. - FilePath *string `json:"filePath,omitempty"` - // CommandLineSetting - 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. Possible values include: 'CommandLineSettingDoNotAllow', 'CommandLineSettingAllow', 'CommandLineSettingRequire' - CommandLineSetting CommandLineSetting `json:"commandLineSetting,omitempty"` - // CommandLineArguments - Command Line Arguments for Application. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` - // ShowInPortal - Specifies whether to show the RemoteApp program in the RD Web Access server. - ShowInPortal *bool `json:"showInPortal,omitempty"` - // IconPath - Path to icon. - IconPath *string `json:"iconPath,omitempty"` - // IconIndex - Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` - // MsixPackageFamilyName - Specifies the package family name for MSIX applications - MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` - // MsixPackageApplicationID - Specifies the package application Id for MSIX applications - MsixPackageApplicationID *string `json:"msixPackageApplicationId,omitempty"` - // ApplicationType - Resource Type of Application. Possible values include: 'RemoteApplicationTypeInBuilt', 'RemoteApplicationTypeMsixApplication' - ApplicationType RemoteApplicationType `json:"applicationType,omitempty"` -} - -// ApplicationProperties schema for Application properties. -type ApplicationProperties struct { - // ObjectID - READ-ONLY; ObjectId of Application. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of Application. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Application. - FriendlyName *string `json:"friendlyName,omitempty"` - // FilePath - Specifies a path for the executable file for the application. - FilePath *string `json:"filePath,omitempty"` - // MsixPackageFamilyName - Specifies the package family name for MSIX applications - MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` - // MsixPackageApplicationID - Specifies the package application Id for MSIX applications - MsixPackageApplicationID *string `json:"msixPackageApplicationId,omitempty"` - // ApplicationType - Resource Type of Application. Possible values include: 'RemoteApplicationTypeInBuilt', 'RemoteApplicationTypeMsixApplication' - ApplicationType RemoteApplicationType `json:"applicationType,omitempty"` - // CommandLineSetting - 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. Possible values include: 'CommandLineSettingDoNotAllow', 'CommandLineSettingAllow', 'CommandLineSettingRequire' - CommandLineSetting CommandLineSetting `json:"commandLineSetting,omitempty"` - // CommandLineArguments - Command Line Arguments for Application. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` - // ShowInPortal - Specifies whether to show the RemoteApp program in the RD Web Access server. - ShowInPortal *bool `json:"showInPortal,omitempty"` - // IconPath - Path to icon. - IconPath *string `json:"iconPath,omitempty"` - // IconIndex - Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` - // IconHash - READ-ONLY; Hash of the icon. - IconHash *string `json:"iconHash,omitempty"` - // IconContent - READ-ONLY; the icon a 64 bit string as a byte array. - IconContent *[]byte `json:"iconContent,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationProperties. -func (ap ApplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Description != nil { - objectMap["description"] = ap.Description - } - if ap.FriendlyName != nil { - objectMap["friendlyName"] = ap.FriendlyName - } - if ap.FilePath != nil { - objectMap["filePath"] = ap.FilePath - } - if ap.MsixPackageFamilyName != nil { - objectMap["msixPackageFamilyName"] = ap.MsixPackageFamilyName - } - if ap.MsixPackageApplicationID != nil { - objectMap["msixPackageApplicationId"] = ap.MsixPackageApplicationID - } - if ap.ApplicationType != "" { - objectMap["applicationType"] = ap.ApplicationType - } - if ap.CommandLineSetting != "" { - objectMap["commandLineSetting"] = ap.CommandLineSetting - } - if ap.CommandLineArguments != nil { - objectMap["commandLineArguments"] = ap.CommandLineArguments - } - if ap.ShowInPortal != nil { - objectMap["showInPortal"] = ap.ShowInPortal - } - if ap.IconPath != nil { - objectMap["iconPath"] = ap.IconPath - } - if ap.IconIndex != nil { - objectMap["iconIndex"] = ap.IconIndex - } - return json.Marshal(objectMap) -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError cloud error object. -type CloudError struct { - Error *CloudErrorProperties `json:"error,omitempty"` -} - -// CloudErrorProperties cloud error object properties. -type CloudErrorProperties struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// Desktop schema for Desktop properties. -type Desktop struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // DesktopProperties - Detailed properties for Desktop - *DesktopProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Desktop. -func (d Desktop) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.SystemData != nil { - objectMap["systemData"] = d.SystemData - } - if d.DesktopProperties != nil { - objectMap["properties"] = d.DesktopProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Desktop struct. -func (d *Desktop) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - d.SystemData = &systemData - } - case "properties": - if v != nil { - var desktopProperties DesktopProperties - err = json.Unmarshal(*v, &desktopProperties) - if err != nil { - return err - } - d.DesktopProperties = &desktopProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DesktopList list of Desktop definitions. -type DesktopList struct { - autorest.Response `json:"-"` - // Value - List of Desktop definitions. - Value *[]Desktop `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DesktopList. -func (dl DesktopList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dl.Value != nil { - objectMap["value"] = dl.Value - } - return json.Marshal(objectMap) -} - -// DesktopListIterator provides access to a complete listing of Desktop values. -type DesktopListIterator struct { - i int - page DesktopListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DesktopListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DesktopListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DesktopListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DesktopListIterator) Response() DesktopList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DesktopListIterator) Value() Desktop { - if !iter.page.NotDone() { - return Desktop{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DesktopListIterator type. -func NewDesktopListIterator(page DesktopListPage) DesktopListIterator { - return DesktopListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dl DesktopList) IsEmpty() bool { - return dl.Value == nil || len(*dl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dl DesktopList) hasNextLink() bool { - return dl.NextLink != nil && len(*dl.NextLink) != 0 -} - -// desktopListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dl DesktopList) desktopListPreparer(ctx context.Context) (*http.Request, error) { - if !dl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dl.NextLink))) -} - -// DesktopListPage contains a page of Desktop values. -type DesktopListPage struct { - fn func(context.Context, DesktopList) (DesktopList, error) - dl DesktopList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DesktopListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dl) - if err != nil { - return err - } - page.dl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DesktopListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DesktopListPage) NotDone() bool { - return !page.dl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DesktopListPage) Response() DesktopList { - return page.dl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DesktopListPage) Values() []Desktop { - if page.dl.IsEmpty() { - return nil - } - return *page.dl.Value -} - -// Creates a new instance of the DesktopListPage type. -func NewDesktopListPage(cur DesktopList, getNextPage func(context.Context, DesktopList) (DesktopList, error)) DesktopListPage { - return DesktopListPage{ - fn: getNextPage, - dl: cur, - } -} - -// DesktopPatch desktop properties that can be patched. -type DesktopPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // DesktopPatchProperties - Detailed properties for Desktop - *DesktopPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DesktopPatch. -func (dp DesktopPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Tags != nil { - objectMap["tags"] = dp.Tags - } - if dp.DesktopPatchProperties != nil { - objectMap["properties"] = dp.DesktopPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DesktopPatch struct. -func (dp *DesktopPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dp.Tags = tags - } - case "properties": - if v != nil { - var desktopPatchProperties DesktopPatchProperties - err = json.Unmarshal(*v, &desktopPatchProperties) - if err != nil { - return err - } - dp.DesktopPatchProperties = &desktopPatchProperties - } - } - } - - return nil -} - -// DesktopPatchProperties desktop properties that can be patched. -type DesktopPatchProperties struct { - // Description - Description of Desktop. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Desktop. - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// DesktopProperties schema for Desktop properties. -type DesktopProperties struct { - // ObjectID - READ-ONLY; ObjectId of Desktop. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of Desktop. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Desktop. - FriendlyName *string `json:"friendlyName,omitempty"` - // IconHash - READ-ONLY; Hash of the icon. - IconHash *string `json:"iconHash,omitempty"` - // IconContent - READ-ONLY; The icon a 64 bit string as a byte array. - IconContent *[]byte `json:"iconContent,omitempty"` -} - -// MarshalJSON is the custom marshaler for DesktopProperties. -func (dp DesktopProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Description != nil { - objectMap["description"] = dp.Description - } - if dp.FriendlyName != nil { - objectMap["friendlyName"] = dp.FriendlyName - } - return json.Marshal(objectMap) -} - -// ExpandMsixImage represents the definition of contents retrieved after expanding the MSIX Image. -type ExpandMsixImage struct { - // ExpandMsixImageProperties - Detailed properties for ExpandMsixImage - *ExpandMsixImageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpandMsixImage. -func (emi ExpandMsixImage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if emi.ExpandMsixImageProperties != nil { - objectMap["properties"] = emi.ExpandMsixImageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpandMsixImage struct. -func (emi *ExpandMsixImage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expandMsixImageProperties ExpandMsixImageProperties - err = json.Unmarshal(*v, &expandMsixImageProperties) - if err != nil { - return err - } - emi.ExpandMsixImageProperties = &expandMsixImageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - emi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - emi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - emi.Type = &typeVar - } - } - } - - return nil -} - -// ExpandMsixImageList list of MSIX package properties retrieved from MSIX Image expansion. -type ExpandMsixImageList struct { - autorest.Response `json:"-"` - // Value - List of MSIX package properties from give MSIX Image. - Value *[]ExpandMsixImage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpandMsixImageList. -func (emil ExpandMsixImageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if emil.Value != nil { - objectMap["value"] = emil.Value - } - return json.Marshal(objectMap) -} - -// ExpandMsixImageListIterator provides access to a complete listing of ExpandMsixImage values. -type ExpandMsixImageListIterator struct { - i int - page ExpandMsixImageListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpandMsixImageListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpandMsixImageListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpandMsixImageListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpandMsixImageListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpandMsixImageListIterator) Response() ExpandMsixImageList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpandMsixImageListIterator) Value() ExpandMsixImage { - if !iter.page.NotDone() { - return ExpandMsixImage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpandMsixImageListIterator type. -func NewExpandMsixImageListIterator(page ExpandMsixImageListPage) ExpandMsixImageListIterator { - return ExpandMsixImageListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (emil ExpandMsixImageList) IsEmpty() bool { - return emil.Value == nil || len(*emil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (emil ExpandMsixImageList) hasNextLink() bool { - return emil.NextLink != nil && len(*emil.NextLink) != 0 -} - -// expandMsixImageListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (emil ExpandMsixImageList) expandMsixImageListPreparer(ctx context.Context) (*http.Request, error) { - if !emil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(emil.NextLink))) -} - -// ExpandMsixImageListPage contains a page of ExpandMsixImage values. -type ExpandMsixImageListPage struct { - fn func(context.Context, ExpandMsixImageList) (ExpandMsixImageList, error) - emil ExpandMsixImageList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpandMsixImageListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpandMsixImageListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.emil) - if err != nil { - return err - } - page.emil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpandMsixImageListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpandMsixImageListPage) NotDone() bool { - return !page.emil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpandMsixImageListPage) Response() ExpandMsixImageList { - return page.emil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpandMsixImageListPage) Values() []ExpandMsixImage { - if page.emil.IsEmpty() { - return nil - } - return *page.emil.Value -} - -// Creates a new instance of the ExpandMsixImageListPage type. -func NewExpandMsixImageListPage(cur ExpandMsixImageList, getNextPage func(context.Context, ExpandMsixImageList) (ExpandMsixImageList, error)) ExpandMsixImageListPage { - return ExpandMsixImageListPage{ - fn: getNextPage, - emil: cur, - } -} - -// ExpandMsixImageProperties schema for Expand MSIX Image properties. -type ExpandMsixImageProperties struct { - // PackageAlias - Alias of MSIX Package. - PackageAlias *string `json:"packageAlias,omitempty"` - // ImagePath - VHD/CIM image path on Network Share. - ImagePath *string `json:"imagePath,omitempty"` - // PackageName - Package Name from appxmanifest.xml. - PackageName *string `json:"packageName,omitempty"` - // PackageFamilyName - Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - PackageFamilyName *string `json:"packageFamilyName,omitempty"` - // PackageFullName - Package Full Name from appxmanifest.xml. - PackageFullName *string `json:"packageFullName,omitempty"` - // DisplayName - User friendly Name to be displayed in the portal. - DisplayName *string `json:"displayName,omitempty"` - // PackageRelativePath - Relative Path to the package inside the image. - PackageRelativePath *string `json:"packageRelativePath,omitempty"` - // IsRegularRegistration - Specifies how to register Package in feed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` - // IsActive - Make this version of the package the active one across the hostpool. - IsActive *bool `json:"isActive,omitempty"` - // PackageDependencies - List of package dependencies. - PackageDependencies *[]MsixPackageDependencies `json:"packageDependencies,omitempty"` - // Version - Package Version found in the appxmanifest.xml. - Version *string `json:"version,omitempty"` - // LastUpdated - Date Package was last updated, found in the appxmanifest.xml. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // PackageApplications - List of package applications. - PackageApplications *[]MsixPackageApplications `json:"packageApplications,omitempty"` -} - -// HostPool represents a HostPool definition. -type HostPool struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // HostPoolProperties - Detailed properties for HostPool - *HostPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - 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"` - // Kind - 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"` - // Etag - 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"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPool. -func (hp HostPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hp.SystemData != nil { - objectMap["systemData"] = hp.SystemData - } - if hp.HostPoolProperties != nil { - objectMap["properties"] = hp.HostPoolProperties - } - if hp.Location != nil { - objectMap["location"] = hp.Location - } - if hp.ManagedBy != nil { - objectMap["managedBy"] = hp.ManagedBy - } - if hp.Kind != nil { - objectMap["kind"] = hp.Kind - } - if hp.Tags != nil { - objectMap["tags"] = hp.Tags - } - if hp.Identity != nil { - objectMap["identity"] = hp.Identity - } - if hp.Sku != nil { - objectMap["sku"] = hp.Sku - } - if hp.Plan != nil { - objectMap["plan"] = hp.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HostPool struct. -func (hp *HostPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - hp.SystemData = &systemData - } - case "properties": - if v != nil { - var hostPoolProperties HostPoolProperties - err = json.Unmarshal(*v, &hostPoolProperties) - if err != nil { - return err - } - hp.HostPoolProperties = &hostPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - hp.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - hp.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - hp.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - hp.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - hp.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - hp.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - hp.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - hp.Plan = &plan - } - } - } - - return nil -} - -// HostPoolList list of HostPool definitions. -type HostPoolList struct { - autorest.Response `json:"-"` - // Value - List of HostPool definitions. - Value *[]HostPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPoolList. -func (hpl HostPoolList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpl.Value != nil { - objectMap["value"] = hpl.Value - } - return json.Marshal(objectMap) -} - -// HostPoolListIterator provides access to a complete listing of HostPool values. -type HostPoolListIterator struct { - i int - page HostPoolListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *HostPoolListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *HostPoolListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter HostPoolListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter HostPoolListIterator) Response() HostPoolList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter HostPoolListIterator) Value() HostPool { - if !iter.page.NotDone() { - return HostPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the HostPoolListIterator type. -func NewHostPoolListIterator(page HostPoolListPage) HostPoolListIterator { - return HostPoolListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (hpl HostPoolList) IsEmpty() bool { - return hpl.Value == nil || len(*hpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (hpl HostPoolList) hasNextLink() bool { - return hpl.NextLink != nil && len(*hpl.NextLink) != 0 -} - -// hostPoolListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (hpl HostPoolList) hostPoolListPreparer(ctx context.Context) (*http.Request, error) { - if !hpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(hpl.NextLink))) -} - -// HostPoolListPage contains a page of HostPool values. -type HostPoolListPage struct { - fn func(context.Context, HostPoolList) (HostPoolList, error) - hpl HostPoolList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *HostPoolListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.hpl) - if err != nil { - return err - } - page.hpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *HostPoolListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page HostPoolListPage) NotDone() bool { - return !page.hpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page HostPoolListPage) Response() HostPoolList { - return page.hpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page HostPoolListPage) Values() []HostPool { - if page.hpl.IsEmpty() { - return nil - } - return *page.hpl.Value -} - -// Creates a new instance of the HostPoolListPage type. -func NewHostPoolListPage(cur HostPoolList, getNextPage func(context.Context, HostPoolList) (HostPoolList, error)) HostPoolListPage { - return HostPoolListPage{ - fn: getNextPage, - hpl: cur, - } -} - -// HostPoolPatch hostPool properties that can be patched. -type HostPoolPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // HostPoolPatchProperties - HostPool properties that can be patched. - *HostPoolPatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPoolPatch. -func (hpp HostPoolPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpp.Tags != nil { - objectMap["tags"] = hpp.Tags - } - if hpp.HostPoolPatchProperties != nil { - objectMap["properties"] = hpp.HostPoolPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HostPoolPatch struct. -func (hpp *HostPoolPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - hpp.Tags = tags - } - case "properties": - if v != nil { - var hostPoolPatchProperties HostPoolPatchProperties - err = json.Unmarshal(*v, &hostPoolPatchProperties) - if err != nil { - return err - } - hpp.HostPoolPatchProperties = &hostPoolPatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hpp.Type = &typeVar - } - } - } - - return nil -} - -// HostPoolPatchProperties properties of HostPool. -type HostPoolPatchProperties struct { - // FriendlyName - Friendly name of HostPool. - FriendlyName *string `json:"friendlyName,omitempty"` - // Description - Description of HostPool. - Description *string `json:"description,omitempty"` - // CustomRdpProperty - Custom rdp property of HostPool. - CustomRdpProperty *string `json:"customRdpProperty,omitempty"` - // MaxSessionLimit - The max session limit of HostPool. - MaxSessionLimit *int32 `json:"maxSessionLimit,omitempty"` - // PersonalDesktopAssignmentType - PersonalDesktopAssignment type for HostPool. Possible values include: 'PersonalDesktopAssignmentTypeAutomatic', 'PersonalDesktopAssignmentTypeDirect' - PersonalDesktopAssignmentType PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` - // LoadBalancerType - The type of the load balancer. Possible values include: 'LoadBalancerTypeBreadthFirst', 'LoadBalancerTypeDepthFirst', 'LoadBalancerTypePersistent' - LoadBalancerType LoadBalancerType `json:"loadBalancerType,omitempty"` - // Ring - The ring number of HostPool. - Ring *int32 `json:"ring,omitempty"` - // ValidationEnvironment - Is validation environment. - ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` - // RegistrationInfo - The registration info of HostPool. - RegistrationInfo *RegistrationInfoPatch `json:"registrationInfo,omitempty"` - // VMTemplate - VM template for sessionhosts configuration within hostpool. - VMTemplate *string `json:"vmTemplate,omitempty"` - // SsoadfsAuthority - URL to customer ADFS server for signing WVD SSO certificates. - SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` - // SsoClientID - ClientId for the registered Relying Party used to issue WVD SSO certificates. - SsoClientID *string `json:"ssoClientId,omitempty"` - // SsoClientSecretKeyVaultPath - Path to Azure KeyVault storing the secret used for communication to ADFS. - SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` - // SsoSecretType - The type of single sign on Secret Type. Possible values include: 'SSOSecretTypeSharedKey', 'SSOSecretTypeCertificate', 'SSOSecretTypeSharedKeyInKeyVault', 'SSOSecretTypeCertificateInKeyVault' - SsoSecretType SSOSecretType `json:"ssoSecretType,omitempty"` - // PreferredAppGroupType - The type of preferred application group type, default to Desktop Application Group. Possible values include: 'PreferredAppGroupTypeNone', 'PreferredAppGroupTypeDesktop', 'PreferredAppGroupTypeRailApplications' - PreferredAppGroupType PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` - // StartVMOnConnect - The flag to turn on/off StartVMOnConnect feature. - StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` - // PublicNetworkAccess - Enabled to allow this resource to be access from the public network. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// HostPoolProperties properties of HostPool. -type HostPoolProperties struct { - // ObjectID - READ-ONLY; ObjectId of HostPool. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // FriendlyName - Friendly name of HostPool. - FriendlyName *string `json:"friendlyName,omitempty"` - // Description - Description of HostPool. - Description *string `json:"description,omitempty"` - // HostPoolType - HostPool type for desktop. Possible values include: 'HostPoolTypePersonal', 'HostPoolTypePooled', 'HostPoolTypeBYODesktop' - HostPoolType HostPoolType `json:"hostPoolType,omitempty"` - // PersonalDesktopAssignmentType - PersonalDesktopAssignment type for HostPool. Possible values include: 'PersonalDesktopAssignmentTypeAutomatic', 'PersonalDesktopAssignmentTypeDirect' - PersonalDesktopAssignmentType PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` - // CustomRdpProperty - Custom rdp property of HostPool. - CustomRdpProperty *string `json:"customRdpProperty,omitempty"` - // MaxSessionLimit - The max session limit of HostPool. - MaxSessionLimit *int32 `json:"maxSessionLimit,omitempty"` - // LoadBalancerType - The type of the load balancer. Possible values include: 'LoadBalancerTypeBreadthFirst', 'LoadBalancerTypeDepthFirst', 'LoadBalancerTypePersistent' - LoadBalancerType LoadBalancerType `json:"loadBalancerType,omitempty"` - // Ring - The ring number of HostPool. - Ring *int32 `json:"ring,omitempty"` - // ValidationEnvironment - Is validation environment. - ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` - // RegistrationInfo - The registration info of HostPool. - RegistrationInfo *RegistrationInfo `json:"registrationInfo,omitempty"` - // VMTemplate - VM template for sessionhosts configuration within hostpool. - VMTemplate *string `json:"vmTemplate,omitempty"` - // ApplicationGroupReferences - READ-ONLY; List of applicationGroup links. - ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` - // SsoadfsAuthority - URL to customer ADFS server for signing WVD SSO certificates. - SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` - // SsoClientID - ClientId for the registered Relying Party used to issue WVD SSO certificates. - SsoClientID *string `json:"ssoClientId,omitempty"` - // SsoClientSecretKeyVaultPath - Path to Azure KeyVault storing the secret used for communication to ADFS. - SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` - // SsoSecretType - The type of single sign on Secret Type. Possible values include: 'SSOSecretTypeSharedKey', 'SSOSecretTypeCertificate', 'SSOSecretTypeSharedKeyInKeyVault', 'SSOSecretTypeCertificateInKeyVault' - SsoSecretType SSOSecretType `json:"ssoSecretType,omitempty"` - // PreferredAppGroupType - The type of preferred application group type, default to Desktop Application Group. Possible values include: 'PreferredAppGroupTypeNone', 'PreferredAppGroupTypeDesktop', 'PreferredAppGroupTypeRailApplications' - PreferredAppGroupType PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` - // StartVMOnConnect - The flag to turn on/off StartVMOnConnect feature. - StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` - // MigrationRequest - The registration info of HostPool. - MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` - // CloudPcResource - READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty"` - // 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. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPoolProperties. -func (hpp HostPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpp.FriendlyName != nil { - objectMap["friendlyName"] = hpp.FriendlyName - } - if hpp.Description != nil { - objectMap["description"] = hpp.Description - } - if hpp.HostPoolType != "" { - objectMap["hostPoolType"] = hpp.HostPoolType - } - if hpp.PersonalDesktopAssignmentType != "" { - objectMap["personalDesktopAssignmentType"] = hpp.PersonalDesktopAssignmentType - } - if hpp.CustomRdpProperty != nil { - objectMap["customRdpProperty"] = hpp.CustomRdpProperty - } - if hpp.MaxSessionLimit != nil { - objectMap["maxSessionLimit"] = hpp.MaxSessionLimit - } - if hpp.LoadBalancerType != "" { - objectMap["loadBalancerType"] = hpp.LoadBalancerType - } - if hpp.Ring != nil { - objectMap["ring"] = hpp.Ring - } - if hpp.ValidationEnvironment != nil { - objectMap["validationEnvironment"] = hpp.ValidationEnvironment - } - if hpp.RegistrationInfo != nil { - objectMap["registrationInfo"] = hpp.RegistrationInfo - } - if hpp.VMTemplate != nil { - objectMap["vmTemplate"] = hpp.VMTemplate - } - if hpp.SsoadfsAuthority != nil { - objectMap["ssoadfsAuthority"] = hpp.SsoadfsAuthority - } - if hpp.SsoClientID != nil { - objectMap["ssoClientId"] = hpp.SsoClientID - } - if hpp.SsoClientSecretKeyVaultPath != nil { - objectMap["ssoClientSecretKeyVaultPath"] = hpp.SsoClientSecretKeyVaultPath - } - if hpp.SsoSecretType != "" { - objectMap["ssoSecretType"] = hpp.SsoSecretType - } - if hpp.PreferredAppGroupType != "" { - objectMap["preferredAppGroupType"] = hpp.PreferredAppGroupType - } - if hpp.StartVMOnConnect != nil { - objectMap["startVMOnConnect"] = hpp.StartVMOnConnect - } - if hpp.MigrationRequest != nil { - objectMap["migrationRequest"] = hpp.MigrationRequest - } - if hpp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = hpp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) -} - -// LogSpecification specifications of the Log for Azure Monitoring -type LogSpecification struct { - // Name - Name of the log - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the log - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// MigrationRequestProperties properties for arm migration. -type MigrationRequestProperties struct { - // Operation - The type of operation for migration. Possible values include: 'OperationStart', 'OperationRevoke', 'OperationComplete', 'OperationHide', 'OperationUnhide' - Operation Operation `json:"operation,omitempty"` - // MigrationPath - The path to the legacy object to migrate. - MigrationPath *string `json:"migrationPath,omitempty"` -} - -// MSIXImageURI represents URI referring to MSIX Image -type MSIXImageURI struct { - // URI - URI to Image - URI *string `json:"uri,omitempty"` -} - -// MSIXPackage schema for MSIX Package properties. -type MSIXPackage struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // MSIXPackageProperties - Detailed properties for MSIX Package - *MSIXPackageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MSIXPackage. -func (mp MSIXPackage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.SystemData != nil { - objectMap["systemData"] = mp.SystemData - } - if mp.MSIXPackageProperties != nil { - objectMap["properties"] = mp.MSIXPackageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MSIXPackage struct. -func (mp *MSIXPackage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mp.SystemData = &systemData - } - case "properties": - if v != nil { - var mSIXPackageProperties MSIXPackageProperties - err = json.Unmarshal(*v, &mSIXPackageProperties) - if err != nil { - return err - } - mp.MSIXPackageProperties = &mSIXPackageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mp.Type = &typeVar - } - } - } - - return nil -} - -// MsixPackageApplications schema for MSIX Package Application properties. -type MsixPackageApplications struct { - // AppID - Package Application Id, found in appxmanifest.xml. - AppID *string `json:"appId,omitempty"` - // Description - Description of Package Application. - Description *string `json:"description,omitempty"` - // AppUserModelID - Used to activate Package Application. Consists of Package Name and ApplicationID. Found in appxmanifest.xml. - AppUserModelID *string `json:"appUserModelID,omitempty"` - // FriendlyName - User friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // IconImageName - User friendly name. - IconImageName *string `json:"iconImageName,omitempty"` - // RawIcon - the icon a 64 bit string as a byte array. - RawIcon *[]byte `json:"rawIcon,omitempty"` - // RawPng - the icon a 64 bit string as a byte array. - RawPng *[]byte `json:"rawPng,omitempty"` -} - -// MsixPackageDependencies schema for MSIX Package Dependencies properties. -type MsixPackageDependencies struct { - // DependencyName - Name of package dependency. - DependencyName *string `json:"dependencyName,omitempty"` - // Publisher - Name of dependency publisher. - Publisher *string `json:"publisher,omitempty"` - // MinVersion - Dependency version required. - MinVersion *string `json:"minVersion,omitempty"` -} - -// MSIXPackageList list of MSIX Package definitions. -type MSIXPackageList struct { - autorest.Response `json:"-"` - // Value - List of MSIX Package definitions. - Value *[]MSIXPackage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for MSIXPackageList. -func (mpl MSIXPackageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpl.Value != nil { - objectMap["value"] = mpl.Value - } - return json.Marshal(objectMap) -} - -// MSIXPackageListIterator provides access to a complete listing of MSIXPackage values. -type MSIXPackageListIterator struct { - i int - page MSIXPackageListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MSIXPackageListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackageListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MSIXPackageListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MSIXPackageListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MSIXPackageListIterator) Response() MSIXPackageList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MSIXPackageListIterator) Value() MSIXPackage { - if !iter.page.NotDone() { - return MSIXPackage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MSIXPackageListIterator type. -func NewMSIXPackageListIterator(page MSIXPackageListPage) MSIXPackageListIterator { - return MSIXPackageListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mpl MSIXPackageList) IsEmpty() bool { - return mpl.Value == nil || len(*mpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mpl MSIXPackageList) hasNextLink() bool { - return mpl.NextLink != nil && len(*mpl.NextLink) != 0 -} - -// mSIXPackageListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mpl MSIXPackageList) mSIXPackageListPreparer(ctx context.Context) (*http.Request, error) { - if !mpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mpl.NextLink))) -} - -// MSIXPackageListPage contains a page of MSIXPackage values. -type MSIXPackageListPage struct { - fn func(context.Context, MSIXPackageList) (MSIXPackageList, error) - mpl MSIXPackageList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MSIXPackageListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackageListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mpl) - if err != nil { - return err - } - page.mpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MSIXPackageListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MSIXPackageListPage) NotDone() bool { - return !page.mpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MSIXPackageListPage) Response() MSIXPackageList { - return page.mpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MSIXPackageListPage) Values() []MSIXPackage { - if page.mpl.IsEmpty() { - return nil - } - return *page.mpl.Value -} - -// Creates a new instance of the MSIXPackageListPage type. -func NewMSIXPackageListPage(cur MSIXPackageList, getNextPage func(context.Context, MSIXPackageList) (MSIXPackageList, error)) MSIXPackageListPage { - return MSIXPackageListPage{ - fn: getNextPage, - mpl: cur, - } -} - -// MSIXPackagePatch MSIX Package properties that can be patched. -type MSIXPackagePatch struct { - // MSIXPackagePatchProperties - Detailed properties for MSIX Package - *MSIXPackagePatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MSIXPackagePatch. -func (mpp MSIXPackagePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpp.MSIXPackagePatchProperties != nil { - objectMap["properties"] = mpp.MSIXPackagePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MSIXPackagePatch struct. -func (mpp *MSIXPackagePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var mSIXPackagePatchProperties MSIXPackagePatchProperties - err = json.Unmarshal(*v, &mSIXPackagePatchProperties) - if err != nil { - return err - } - mpp.MSIXPackagePatchProperties = &mSIXPackagePatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mpp.Type = &typeVar - } - } - } - - return nil -} - -// MSIXPackagePatchProperties MSIX Package properties that can be patched. -type MSIXPackagePatchProperties struct { - // IsActive - Set a version of the package to be active across hostpool. - IsActive *bool `json:"isActive,omitempty"` - // IsRegularRegistration - Set Registration mode. Regular or Delayed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` - // DisplayName - Display name for MSIX Package. - DisplayName *string `json:"displayName,omitempty"` -} - -// MSIXPackageProperties schema for MSIX Package properties. -type MSIXPackageProperties struct { - // ImagePath - VHD/CIM image path on Network Share. - ImagePath *string `json:"imagePath,omitempty"` - // PackageName - Package Name from appxmanifest.xml. - PackageName *string `json:"packageName,omitempty"` - // PackageFamilyName - Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - PackageFamilyName *string `json:"packageFamilyName,omitempty"` - // DisplayName - User friendly Name to be displayed in the portal. - DisplayName *string `json:"displayName,omitempty"` - // PackageRelativePath - Relative Path to the package inside the image. - PackageRelativePath *string `json:"packageRelativePath,omitempty"` - // IsRegularRegistration - Specifies how to register Package in feed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` - // IsActive - Make this version of the package the active one across the hostpool. - IsActive *bool `json:"isActive,omitempty"` - // PackageDependencies - List of package dependencies. - PackageDependencies *[]MsixPackageDependencies `json:"packageDependencies,omitempty"` - // Version - Package Version found in the appxmanifest.xml. - Version *string `json:"version,omitempty"` - // LastUpdated - Date Package was last updated, found in the appxmanifest.xml. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // PackageApplications - List of package applications. - PackageApplications *[]MsixPackageApplications `json:"packageApplications,omitempty"` -} - -// OperationProperties properties of the operation -type OperationProperties struct { - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// Plan plan for the resource. -type Plan struct { - // Name - A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` - // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` - // Product - 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"` - // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The version of the desired product/artifact. - Version *string `json:"version,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResultWithSystemData list of private endpoint connection associated with -// the specified storage account -type PrivateEndpointConnectionListResultWithSystemData struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnectionWithSystemData `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResultWithSystemData. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peclrwsd.Value != nil { - objectMap["value"] = peclrwsd.Value - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultWithSystemDataIterator provides access to a complete listing of -// PrivateEndpointConnectionWithSystemData values. -type PrivateEndpointConnectionListResultWithSystemDataIterator struct { - i int - page PrivateEndpointConnectionListResultWithSystemDataPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultWithSystemDataIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultWithSystemDataIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultWithSystemDataIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultWithSystemDataIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultWithSystemDataIterator) Response() PrivateEndpointConnectionListResultWithSystemData { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultWithSystemDataIterator) Value() PrivateEndpointConnectionWithSystemData { - if !iter.page.NotDone() { - return PrivateEndpointConnectionWithSystemData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultWithSystemDataIterator type. -func NewPrivateEndpointConnectionListResultWithSystemDataIterator(page PrivateEndpointConnectionListResultWithSystemDataPage) PrivateEndpointConnectionListResultWithSystemDataIterator { - return PrivateEndpointConnectionListResultWithSystemDataIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) IsEmpty() bool { - return peclrwsd.Value == nil || len(*peclrwsd.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) hasNextLink() bool { - return peclrwsd.NextLink != nil && len(*peclrwsd.NextLink) != 0 -} - -// privateEndpointConnectionListResultWithSystemDataPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) privateEndpointConnectionListResultWithSystemDataPreparer(ctx context.Context) (*http.Request, error) { - if !peclrwsd.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclrwsd.NextLink))) -} - -// PrivateEndpointConnectionListResultWithSystemDataPage contains a page of -// PrivateEndpointConnectionWithSystemData values. -type PrivateEndpointConnectionListResultWithSystemDataPage struct { - fn func(context.Context, PrivateEndpointConnectionListResultWithSystemData) (PrivateEndpointConnectionListResultWithSystemData, error) - peclrwsd PrivateEndpointConnectionListResultWithSystemData -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultWithSystemDataPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultWithSystemDataPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclrwsd) - if err != nil { - return err - } - page.peclrwsd = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultWithSystemDataPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultWithSystemDataPage) NotDone() bool { - return !page.peclrwsd.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultWithSystemDataPage) Response() PrivateEndpointConnectionListResultWithSystemData { - return page.peclrwsd -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultWithSystemDataPage) Values() []PrivateEndpointConnectionWithSystemData { - if page.peclrwsd.IsEmpty() { - return nil - } - return *page.peclrwsd.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultWithSystemDataPage type. -func NewPrivateEndpointConnectionListResultWithSystemDataPage(cur PrivateEndpointConnectionListResultWithSystemData, getNextPage func(context.Context, PrivateEndpointConnectionListResultWithSystemData) (PrivateEndpointConnectionListResultWithSystemData, error)) PrivateEndpointConnectionListResultWithSystemDataPage { - return PrivateEndpointConnectionListResultWithSystemDataPage{ - fn: getNextPage, - peclrwsd: cur, - } -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionWithSystemData the Private Endpoint Connection resource. -type PrivateEndpointConnectionWithSystemData struct { - autorest.Response `json:"-"` - SystemData *SystemData `json:"systemData,omitempty"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionWithSystemData. -func (pecwsd PrivateEndpointConnectionWithSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecwsd.SystemData != nil { - objectMap["systemData"] = pecwsd.SystemData - } - if pecwsd.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pecwsd.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionWithSystemData struct. -func (pecwsd *PrivateEndpointConnectionWithSystemData) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pecwsd.SystemData = &systemData - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pecwsd.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pecwsd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pecwsd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pecwsd.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrlr.Value != nil { - objectMap["value"] = plrlr.Value - } - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrlr) - if err != nil { - return err - } - page.plrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RegistrationInfo represents a RegistrationInfo definition. -type RegistrationInfo struct { - autorest.Response `json:"-"` - // ExpirationTime - Expiration time of registration token. - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // Token - The registration token base64 encoded string. - Token *string `json:"token,omitempty"` - // RegistrationTokenOperation - The type of resetting the token. Possible values include: 'RegistrationTokenOperationDelete', 'RegistrationTokenOperationNone', 'RegistrationTokenOperationUpdate' - RegistrationTokenOperation RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` -} - -// RegistrationInfoPatch represents a RegistrationInfo definition. -type RegistrationInfoPatch struct { - // ExpirationTime - Expiration time of registration token. - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // RegistrationTokenOperation - The type of resetting the token. Possible values include: 'RegistrationTokenOperationDelete', 'RegistrationTokenOperationNone', 'RegistrationTokenOperationUpdate' - RegistrationTokenOperation RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// 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 { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - 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"` - // Kind - 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"` - // Etag - 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"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. -func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmwaps.Location != nil { - objectMap["location"] = rmwaps.Location - } - if rmwaps.ManagedBy != nil { - objectMap["managedBy"] = rmwaps.ManagedBy - } - if rmwaps.Kind != nil { - objectMap["kind"] = rmwaps.Kind - } - if rmwaps.Tags != nil { - objectMap["tags"] = rmwaps.Tags - } - if rmwaps.Identity != nil { - objectMap["identity"] = rmwaps.Identity - } - if rmwaps.Sku != nil { - objectMap["sku"] = rmwaps.Sku - } - if rmwaps.Plan != nil { - objectMap["plan"] = rmwaps.Plan - } - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySetIdentity ... -type ResourceModelWithAllowedPropertySetIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. -func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmwaps.Type != "" { - objectMap["type"] = rmwaps.Type - } - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySetPlan ... -type ResourceModelWithAllowedPropertySetPlan struct { - // Name - A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` - // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` - // Product - 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"` - // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The version of the desired product/artifact. - Version *string `json:"version,omitempty"` -} - -// ResourceModelWithAllowedPropertySetSku ... -type ResourceModelWithAllowedPropertySetSku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` - // Tier - 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. Possible values include: 'SkuTierFree', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // Size - 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"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - 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"` -} - -// ResourceProviderOperation supported operation of this resource provider. -type ResourceProviderOperation struct { - // Name - Operation name, in format of {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay `json:"display,omitempty"` - // IsDataAction - Is a data action. - IsDataAction *bool `json:"isDataAction,omitempty"` - Properties *OperationProperties `json:"properties,omitempty"` -} - -// ResourceProviderOperationDisplay display metadata associated with the operation. -type ResourceProviderOperationDisplay struct { - // Provider - Resource provider: Microsoft Desktop Virtualization. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of this operation. - Description *string `json:"description,omitempty"` -} - -// ResourceProviderOperationList result of the request to list operations. -type ResourceProviderOperationList struct { - autorest.Response `json:"-"` - // Value - List of operations supported by this resource provider. - Value *[]ResourceProviderOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceProviderOperationList. -func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpol.Value != nil { - objectMap["value"] = rpol.Value - } - return json.Marshal(objectMap) -} - -// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation -// values. -type ResourceProviderOperationListIterator struct { - i int - page ResourceProviderOperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceProviderOperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceProviderOperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { - if !iter.page.NotDone() { - return ResourceProviderOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceProviderOperationListIterator type. -func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { - return ResourceProviderOperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rpol ResourceProviderOperationList) IsEmpty() bool { - return rpol.Value == nil || len(*rpol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rpol ResourceProviderOperationList) hasNextLink() bool { - return rpol.NextLink != nil && len(*rpol.NextLink) != 0 -} - -// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { - if !rpol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rpol.NextLink))) -} - -// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. -type ResourceProviderOperationListPage struct { - fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) - rpol ResourceProviderOperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rpol) - if err != nil { - return err - } - page.rpol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceProviderOperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceProviderOperationListPage) NotDone() bool { - return !page.rpol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { - return page.rpol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { - if page.rpol.IsEmpty() { - return nil - } - return *page.rpol.Value -} - -// Creates a new instance of the ResourceProviderOperationListPage type. -func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { - return ResourceProviderOperationListPage{ - fn: getNextPage, - rpol: cur, - } -} - -// ScalingHostPoolReference scaling plan reference to hostpool. -type ScalingHostPoolReference struct { - // HostPoolArmPath - Arm path of referenced hostpool. - HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` - // ScalingPlanEnabled - Is the scaling plan enabled for this hostpool. - ScalingPlanEnabled *bool `json:"scalingPlanEnabled,omitempty"` -} - -// ScalingPlan represents a scaling plan definition. -type ScalingPlan struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ScalingPlanProperties - Detailed properties for scaling plan. - *ScalingPlanProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - 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"` - // Kind - 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"` - // Etag - 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"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlan. -func (sp ScalingPlan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.SystemData != nil { - objectMap["systemData"] = sp.SystemData - } - if sp.ScalingPlanProperties != nil { - objectMap["properties"] = sp.ScalingPlanProperties - } - if sp.Location != nil { - objectMap["location"] = sp.Location - } - if sp.ManagedBy != nil { - objectMap["managedBy"] = sp.ManagedBy - } - if sp.Kind != nil { - objectMap["kind"] = sp.Kind - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.Identity != nil { - objectMap["identity"] = sp.Identity - } - if sp.Sku != nil { - objectMap["sku"] = sp.Sku - } - if sp.Plan != nil { - objectMap["plan"] = sp.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScalingPlan struct. -func (sp *ScalingPlan) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sp.SystemData = &systemData - } - case "properties": - if v != nil { - var scalingPlanProperties ScalingPlanProperties - err = json.Unmarshal(*v, &scalingPlanProperties) - if err != nil { - return err - } - sp.ScalingPlanProperties = &scalingPlanProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sp.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - sp.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sp.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sp.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sp.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sp.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - sp.Plan = &plan - } - } - } - - return nil -} - -// ScalingPlanList list of scaling plan definitions. -type ScalingPlanList struct { - autorest.Response `json:"-"` - // Value - List of scaling plan definitions. - Value *[]ScalingPlan `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlanList. -func (spl ScalingPlanList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spl.Value != nil { - objectMap["value"] = spl.Value - } - return json.Marshal(objectMap) -} - -// ScalingPlanListIterator provides access to a complete listing of ScalingPlan values. -type ScalingPlanListIterator struct { - i int - page ScalingPlanListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ScalingPlanListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlanListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ScalingPlanListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScalingPlanListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ScalingPlanListIterator) Response() ScalingPlanList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ScalingPlanListIterator) Value() ScalingPlan { - if !iter.page.NotDone() { - return ScalingPlan{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScalingPlanListIterator type. -func NewScalingPlanListIterator(page ScalingPlanListPage) ScalingPlanListIterator { - return ScalingPlanListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spl ScalingPlanList) IsEmpty() bool { - return spl.Value == nil || len(*spl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spl ScalingPlanList) hasNextLink() bool { - return spl.NextLink != nil && len(*spl.NextLink) != 0 -} - -// scalingPlanListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spl ScalingPlanList) scalingPlanListPreparer(ctx context.Context) (*http.Request, error) { - if !spl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spl.NextLink))) -} - -// ScalingPlanListPage contains a page of ScalingPlan values. -type ScalingPlanListPage struct { - fn func(context.Context, ScalingPlanList) (ScalingPlanList, error) - spl ScalingPlanList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ScalingPlanListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlanListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.spl) - if err != nil { - return err - } - page.spl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ScalingPlanListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScalingPlanListPage) NotDone() bool { - return !page.spl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScalingPlanListPage) Response() ScalingPlanList { - return page.spl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScalingPlanListPage) Values() []ScalingPlan { - if page.spl.IsEmpty() { - return nil - } - return *page.spl.Value -} - -// Creates a new instance of the ScalingPlanListPage type. -func NewScalingPlanListPage(cur ScalingPlanList, getNextPage func(context.Context, ScalingPlanList) (ScalingPlanList, error)) ScalingPlanListPage { - return ScalingPlanListPage{ - fn: getNextPage, - spl: cur, - } -} - -// ScalingPlanPatch scaling plan properties that can be patched. -type ScalingPlanPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // ScalingPlanPatchProperties - Detailed properties for scaling plan - *ScalingPlanPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlanPatch. -func (spp ScalingPlanPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Tags != nil { - objectMap["tags"] = spp.Tags - } - if spp.ScalingPlanPatchProperties != nil { - objectMap["properties"] = spp.ScalingPlanPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScalingPlanPatch struct. -func (spp *ScalingPlanPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spp.Tags = tags - } - case "properties": - if v != nil { - var scalingPlanPatchProperties ScalingPlanPatchProperties - err = json.Unmarshal(*v, &scalingPlanPatchProperties) - if err != nil { - return err - } - spp.ScalingPlanPatchProperties = &scalingPlanPatchProperties - } - } - } - - return nil -} - -// ScalingPlanPatchProperties scaling plan properties. -type ScalingPlanPatchProperties struct { - // Description - Description of scaling plan. - Description *string `json:"description,omitempty"` - // FriendlyName - User friendly name of scaling plan. - FriendlyName *string `json:"friendlyName,omitempty"` - // TimeZone - Timezone of the scaling plan. - TimeZone *string `json:"timeZone,omitempty"` - // ExclusionTag - Exclusion tag for scaling plan. - ExclusionTag *string `json:"exclusionTag,omitempty"` - // Schedules - List of ScalingSchedule definitions. - Schedules *[]ScalingSchedule `json:"schedules,omitempty"` - // HostPoolReferences - List of ScalingHostPoolReference definitions. - HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` -} - -// ScalingPlanProperties scaling plan properties. -type ScalingPlanProperties struct { - // ObjectID - READ-ONLY; ObjectId of scaling plan. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of scaling plan. - Description *string `json:"description,omitempty"` - // FriendlyName - User friendly name of scaling plan. - FriendlyName *string `json:"friendlyName,omitempty"` - // TimeZone - Timezone of the scaling plan. - TimeZone *string `json:"timeZone,omitempty"` - // HostPoolType - HostPool type for desktop. Possible values include: 'ScalingHostPoolTypePooled' - HostPoolType ScalingHostPoolType `json:"hostPoolType,omitempty"` - // ExclusionTag - Exclusion tag for scaling plan. - ExclusionTag *string `json:"exclusionTag,omitempty"` - // Schedules - List of ScalingSchedule definitions. - Schedules *[]ScalingSchedule `json:"schedules,omitempty"` - // HostPoolReferences - List of ScalingHostPoolReference definitions. - HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlanProperties. -func (spp ScalingPlanProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Description != nil { - objectMap["description"] = spp.Description - } - if spp.FriendlyName != nil { - objectMap["friendlyName"] = spp.FriendlyName - } - if spp.TimeZone != nil { - objectMap["timeZone"] = spp.TimeZone - } - if spp.HostPoolType != "" { - objectMap["hostPoolType"] = spp.HostPoolType - } - if spp.ExclusionTag != nil { - objectMap["exclusionTag"] = spp.ExclusionTag - } - if spp.Schedules != nil { - objectMap["schedules"] = spp.Schedules - } - if spp.HostPoolReferences != nil { - objectMap["hostPoolReferences"] = spp.HostPoolReferences - } - return json.Marshal(objectMap) -} - -// ScalingSchedule scaling plan schedule. -type ScalingSchedule struct { - // Name - Name of the scaling schedule. - Name *string `json:"name,omitempty"` - // DaysOfWeek - Set of days of the week on which this schedule is active. - DaysOfWeek *[]string `json:"daysOfWeek,omitempty"` - // RampUpStartTime - Starting time for ramp up period. - RampUpStartTime *Time `json:"rampUpStartTime,omitempty"` - // RampUpLoadBalancingAlgorithm - Load balancing algorithm for ramp up period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - RampUpLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"rampUpLoadBalancingAlgorithm,omitempty"` - // RampUpMinimumHostsPct - Minimum host percentage for ramp up period. - RampUpMinimumHostsPct *int32 `json:"rampUpMinimumHostsPct,omitempty"` - // RampUpCapacityThresholdPct - Capacity threshold for ramp up period. - RampUpCapacityThresholdPct *int32 `json:"rampUpCapacityThresholdPct,omitempty"` - // PeakStartTime - Starting time for peak period. - PeakStartTime *Time `json:"peakStartTime,omitempty"` - // PeakLoadBalancingAlgorithm - Load balancing algorithm for peak period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - PeakLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"peakLoadBalancingAlgorithm,omitempty"` - // RampDownStartTime - Starting time for ramp down period. - RampDownStartTime *Time `json:"rampDownStartTime,omitempty"` - // RampDownLoadBalancingAlgorithm - Load balancing algorithm for ramp down period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - RampDownLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"rampDownLoadBalancingAlgorithm,omitempty"` - // RampDownMinimumHostsPct - Minimum host percentage for ramp down period. - RampDownMinimumHostsPct *int32 `json:"rampDownMinimumHostsPct,omitempty"` - // RampDownCapacityThresholdPct - Capacity threshold for ramp down period. - RampDownCapacityThresholdPct *int32 `json:"rampDownCapacityThresholdPct,omitempty"` - // RampDownForceLogoffUsers - Should users be logged off forcefully from hosts. - RampDownForceLogoffUsers *bool `json:"rampDownForceLogoffUsers,omitempty"` - // RampDownStopHostsWhen - Specifies when to stop hosts during ramp down period. Possible values include: 'StopHostsWhenZeroSessions', 'StopHostsWhenZeroActiveSessions' - RampDownStopHostsWhen StopHostsWhen `json:"rampDownStopHostsWhen,omitempty"` - // RampDownWaitTimeMinutes - Number of minutes to wait to stop hosts during ramp down period. - RampDownWaitTimeMinutes *int32 `json:"rampDownWaitTimeMinutes,omitempty"` - // RampDownNotificationMessage - Notification message for users during ramp down period. - RampDownNotificationMessage *string `json:"rampDownNotificationMessage,omitempty"` - // OffPeakStartTime - Starting time for off-peak period. - OffPeakStartTime *Time `json:"offPeakStartTime,omitempty"` - // OffPeakLoadBalancingAlgorithm - Load balancing algorithm for off-peak period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - OffPeakLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"offPeakLoadBalancingAlgorithm,omitempty"` -} - -// SendMessage represents message sent to a UserSession. -type SendMessage struct { - // MessageTitle - Title of message. - MessageTitle *string `json:"messageTitle,omitempty"` - // MessageBody - Body of message. - MessageBody *string `json:"messageBody,omitempty"` -} - -// ServiceSpecification service specification payload -type ServiceSpecification struct { - // LogSpecifications - Specifications of the Log for Azure Monitoring - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` -} - -// SessionHost represents a SessionHost definition. -type SessionHost struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // SessionHostProperties - Detailed properties for SessionHost - *SessionHostProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHost. -func (sh SessionHost) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sh.SystemData != nil { - objectMap["systemData"] = sh.SystemData - } - if sh.SessionHostProperties != nil { - objectMap["properties"] = sh.SessionHostProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SessionHost struct. -func (sh *SessionHost) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sh.SystemData = &systemData - } - case "properties": - if v != nil { - var sessionHostProperties SessionHostProperties - err = json.Unmarshal(*v, &sessionHostProperties) - if err != nil { - return err - } - sh.SessionHostProperties = &sessionHostProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sh.Type = &typeVar - } - } - } - - return nil -} - -// SessionHostHealthCheckFailureDetails contains details on the failure. -type SessionHostHealthCheckFailureDetails struct { - // Message - READ-ONLY; Failure message: hints on what is wrong and how to recover. - Message *string `json:"message,omitempty"` - // ErrorCode - READ-ONLY; Error code corresponding for the failure. - ErrorCode *int32 `json:"errorCode,omitempty"` - // LastHealthCheckDateTime - READ-ONLY; The timestamp of the last update. - LastHealthCheckDateTime *date.Time `json:"lastHealthCheckDateTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostHealthCheckFailureDetails. -func (shhcfd SessionHostHealthCheckFailureDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SessionHostHealthCheckReport the report for session host information. -type SessionHostHealthCheckReport struct { - // HealthCheckName - READ-ONLY; Represents the name of the health check operation performed. Possible values include: 'HealthCheckNameDomainJoinedCheck', 'HealthCheckNameDomainTrustCheck', 'HealthCheckNameFSLogixHealthCheck', 'HealthCheckNameSxSStackListenerCheck', 'HealthCheckNameUrlsAccessibleCheck', 'HealthCheckNameMonitoringAgentCheck', 'HealthCheckNameDomainReachable', 'HealthCheckNameWebRTCRedirectorCheck', 'HealthCheckNameSupportedEncryptionCheck', 'HealthCheckNameMetaDataServiceCheck', 'HealthCheckNameAppAttachHealthCheck' - HealthCheckName HealthCheckName `json:"healthCheckName,omitempty"` - // HealthCheckResult - READ-ONLY; Represents the Health state of the health check we performed. Possible values include: 'HealthCheckResultUnknown', 'HealthCheckResultHealthCheckSucceeded', 'HealthCheckResultHealthCheckFailed', 'HealthCheckResultSessionHostShutdown' - HealthCheckResult HealthCheckResult `json:"healthCheckResult,omitempty"` - // AdditionalFailureDetails - READ-ONLY; Additional detailed information on the failure. - AdditionalFailureDetails *SessionHostHealthCheckFailureDetails `json:"additionalFailureDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostHealthCheckReport. -func (shhcr SessionHostHealthCheckReport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SessionHostList list of SessionHost definitions. -type SessionHostList struct { - autorest.Response `json:"-"` - // Value - List of SessionHost definitions. - Value *[]SessionHost `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostList. -func (shl SessionHostList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shl.Value != nil { - objectMap["value"] = shl.Value - } - return json.Marshal(objectMap) -} - -// SessionHostListIterator provides access to a complete listing of SessionHost values. -type SessionHostListIterator struct { - i int - page SessionHostListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SessionHostListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SessionHostListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SessionHostListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SessionHostListIterator) Response() SessionHostList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SessionHostListIterator) Value() SessionHost { - if !iter.page.NotDone() { - return SessionHost{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SessionHostListIterator type. -func NewSessionHostListIterator(page SessionHostListPage) SessionHostListIterator { - return SessionHostListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (shl SessionHostList) IsEmpty() bool { - return shl.Value == nil || len(*shl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (shl SessionHostList) hasNextLink() bool { - return shl.NextLink != nil && len(*shl.NextLink) != 0 -} - -// sessionHostListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (shl SessionHostList) sessionHostListPreparer(ctx context.Context) (*http.Request, error) { - if !shl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(shl.NextLink))) -} - -// SessionHostListPage contains a page of SessionHost values. -type SessionHostListPage struct { - fn func(context.Context, SessionHostList) (SessionHostList, error) - shl SessionHostList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SessionHostListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.shl) - if err != nil { - return err - } - page.shl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SessionHostListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SessionHostListPage) NotDone() bool { - return !page.shl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SessionHostListPage) Response() SessionHostList { - return page.shl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SessionHostListPage) Values() []SessionHost { - if page.shl.IsEmpty() { - return nil - } - return *page.shl.Value -} - -// Creates a new instance of the SessionHostListPage type. -func NewSessionHostListPage(cur SessionHostList, getNextPage func(context.Context, SessionHostList) (SessionHostList, error)) SessionHostListPage { - return SessionHostListPage{ - fn: getNextPage, - shl: cur, - } -} - -// SessionHostPatch sessionHost properties that can be patched. -type SessionHostPatch struct { - // SessionHostPatchProperties - Detailed properties for SessionHost - *SessionHostPatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostPatch. -func (shp SessionHostPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shp.SessionHostPatchProperties != nil { - objectMap["properties"] = shp.SessionHostPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SessionHostPatch struct. -func (shp *SessionHostPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sessionHostPatchProperties SessionHostPatchProperties - err = json.Unmarshal(*v, &sessionHostPatchProperties) - if err != nil { - return err - } - shp.SessionHostPatchProperties = &sessionHostPatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - shp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - shp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - shp.Type = &typeVar - } - } - } - - return nil -} - -// SessionHostPatchProperties sessionHost properties that can be patched. -type SessionHostPatchProperties struct { - // AllowNewSession - Allow a new session. - AllowNewSession *bool `json:"allowNewSession,omitempty"` - // AssignedUser - User assigned to SessionHost. - AssignedUser *string `json:"assignedUser,omitempty"` -} - -// SessionHostProperties schema for SessionHost properties. -type SessionHostProperties struct { - // ObjectID - READ-ONLY; ObjectId of SessionHost. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // LastHeartBeat - Last heart beat from SessionHost. - LastHeartBeat *date.Time `json:"lastHeartBeat,omitempty"` - // Sessions - Number of sessions on SessionHost. - Sessions *int32 `json:"sessions,omitempty"` - // AgentVersion - Version of agent on SessionHost. - AgentVersion *string `json:"agentVersion,omitempty"` - // AllowNewSession - Allow a new session. - AllowNewSession *bool `json:"allowNewSession,omitempty"` - // VirtualMachineID - READ-ONLY; Virtual Machine Id of SessionHost's underlying virtual machine. - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - // ResourceID - READ-ONLY; Resource Id of SessionHost's underlying virtual machine. - ResourceID *string `json:"resourceId,omitempty"` - // AssignedUser - User assigned to SessionHost. - AssignedUser *string `json:"assignedUser,omitempty"` - // Status - Status for a SessionHost. Possible values include: 'StatusAvailable', 'StatusUnavailable', 'StatusShutdown', 'StatusDisconnected', 'StatusUpgrading', 'StatusUpgradeFailed', 'StatusNoHeartbeat', 'StatusNotJoinedToDomain', 'StatusDomainTrustRelationshipLost', 'StatusSxSStackListenerNotReady', 'StatusFSLogixNotHealthy', 'StatusNeedsAssistance' - Status Status `json:"status,omitempty"` - // StatusTimestamp - READ-ONLY; The timestamp of the status. - StatusTimestamp *date.Time `json:"statusTimestamp,omitempty"` - // OsVersion - The version of the OS on the session host. - OsVersion *string `json:"osVersion,omitempty"` - // SxSStackVersion - The version of the side by side stack on the session host. - SxSStackVersion *string `json:"sxSStackVersion,omitempty"` - // UpdateState - Update state of a SessionHost. Possible values include: 'UpdateStateInitial', 'UpdateStatePending', 'UpdateStateStarted', 'UpdateStateSucceeded', 'UpdateStateFailed' - UpdateState UpdateState `json:"updateState,omitempty"` - // LastUpdateTime - READ-ONLY; The timestamp of the last update. - LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` - // UpdateErrorMessage - The error message. - UpdateErrorMessage *string `json:"updateErrorMessage,omitempty"` - // SessionHostHealthCheckResults - READ-ONLY; List of SessionHostHealthCheckReports - SessionHostHealthCheckResults *[]SessionHostHealthCheckReport `json:"sessionHostHealthCheckResults,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostProperties. -func (shp SessionHostProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shp.LastHeartBeat != nil { - objectMap["lastHeartBeat"] = shp.LastHeartBeat - } - if shp.Sessions != nil { - objectMap["sessions"] = shp.Sessions - } - if shp.AgentVersion != nil { - objectMap["agentVersion"] = shp.AgentVersion - } - if shp.AllowNewSession != nil { - objectMap["allowNewSession"] = shp.AllowNewSession - } - if shp.AssignedUser != nil { - objectMap["assignedUser"] = shp.AssignedUser - } - if shp.Status != "" { - objectMap["status"] = shp.Status - } - if shp.OsVersion != nil { - objectMap["osVersion"] = shp.OsVersion - } - if shp.SxSStackVersion != nil { - objectMap["sxSStackVersion"] = shp.SxSStackVersion - } - if shp.UpdateState != "" { - objectMap["updateState"] = shp.UpdateState - } - if shp.UpdateErrorMessage != nil { - objectMap["updateErrorMessage"] = shp.UpdateErrorMessage - } - return json.Marshal(objectMap) -} - -// Sku the resource model definition representing SKU -type Sku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` - // Tier - 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. Possible values include: 'SkuTierFree', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // Size - 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"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - 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"` -} - -// StartMenuItem represents a StartMenuItem definition. -type StartMenuItem struct { - // StartMenuItemProperties - Detailed properties for StartMenuItem - *StartMenuItemProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for StartMenuItem. -func (smi StartMenuItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smi.StartMenuItemProperties != nil { - objectMap["properties"] = smi.StartMenuItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for StartMenuItem struct. -func (smi *StartMenuItem) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var startMenuItemProperties StartMenuItemProperties - err = json.Unmarshal(*v, &startMenuItemProperties) - if err != nil { - return err - } - smi.StartMenuItemProperties = &startMenuItemProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - smi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smi.Type = &typeVar - } - } - } - - return nil -} - -// StartMenuItemList list of StartMenuItem definitions. -type StartMenuItemList struct { - autorest.Response `json:"-"` - // Value - List of StartMenuItem definitions. - Value *[]StartMenuItem `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for StartMenuItemList. -func (smil StartMenuItemList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smil.Value != nil { - objectMap["value"] = smil.Value - } - return json.Marshal(objectMap) -} - -// StartMenuItemListIterator provides access to a complete listing of StartMenuItem values. -type StartMenuItemListIterator struct { - i int - page StartMenuItemListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *StartMenuItemListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *StartMenuItemListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter StartMenuItemListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter StartMenuItemListIterator) Response() StartMenuItemList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter StartMenuItemListIterator) Value() StartMenuItem { - if !iter.page.NotDone() { - return StartMenuItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the StartMenuItemListIterator type. -func NewStartMenuItemListIterator(page StartMenuItemListPage) StartMenuItemListIterator { - return StartMenuItemListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smil StartMenuItemList) IsEmpty() bool { - return smil.Value == nil || len(*smil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smil StartMenuItemList) hasNextLink() bool { - return smil.NextLink != nil && len(*smil.NextLink) != 0 -} - -// startMenuItemListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smil StartMenuItemList) startMenuItemListPreparer(ctx context.Context) (*http.Request, error) { - if !smil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smil.NextLink))) -} - -// StartMenuItemListPage contains a page of StartMenuItem values. -type StartMenuItemListPage struct { - fn func(context.Context, StartMenuItemList) (StartMenuItemList, error) - smil StartMenuItemList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *StartMenuItemListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.smil) - if err != nil { - return err - } - page.smil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *StartMenuItemListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page StartMenuItemListPage) NotDone() bool { - return !page.smil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page StartMenuItemListPage) Response() StartMenuItemList { - return page.smil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page StartMenuItemListPage) Values() []StartMenuItem { - if page.smil.IsEmpty() { - return nil - } - return *page.smil.Value -} - -// Creates a new instance of the StartMenuItemListPage type. -func NewStartMenuItemListPage(cur StartMenuItemList, getNextPage func(context.Context, StartMenuItemList) (StartMenuItemList, error)) StartMenuItemListPage { - return StartMenuItemListPage{ - fn: getNextPage, - smil: cur, - } -} - -// StartMenuItemProperties schema for StartMenuItem properties. -type StartMenuItemProperties struct { - // AppAlias - Alias of StartMenuItem. - AppAlias *string `json:"appAlias,omitempty"` - // FilePath - Path to the file of StartMenuItem. - FilePath *string `json:"filePath,omitempty"` - // CommandLineArguments - Command line arguments for StartMenuItem. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` - // IconPath - Path to the icon. - IconPath *string `json:"iconPath,omitempty"` - // IconIndex - Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Time the time for a scaling action to occur. -type Time struct { - // Hour - The hour. - Hour *int32 `json:"hour,omitempty"` - // Minute - The minute. - Minute *int32 `json:"minute,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UserSession represents a UserSession definition. -type UserSession struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // UserSessionProperties - Detailed properties for UserSession - *UserSessionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserSession. -func (us UserSession) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if us.SystemData != nil { - objectMap["systemData"] = us.SystemData - } - if us.UserSessionProperties != nil { - objectMap["properties"] = us.UserSessionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserSession struct. -func (us *UserSession) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - us.SystemData = &systemData - } - case "properties": - if v != nil { - var userSessionProperties UserSessionProperties - err = json.Unmarshal(*v, &userSessionProperties) - if err != nil { - return err - } - us.UserSessionProperties = &userSessionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - us.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - us.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - us.Type = &typeVar - } - } - } - - return nil -} - -// UserSessionList list of UserSession definitions. -type UserSessionList struct { - autorest.Response `json:"-"` - // Value - List of UserSession definitions. - Value *[]UserSession `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserSessionList. -func (usl UserSessionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if usl.Value != nil { - objectMap["value"] = usl.Value - } - return json.Marshal(objectMap) -} - -// UserSessionListIterator provides access to a complete listing of UserSession values. -type UserSessionListIterator struct { - i int - page UserSessionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UserSessionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UserSessionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserSessionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UserSessionListIterator) Response() UserSessionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UserSessionListIterator) Value() UserSession { - if !iter.page.NotDone() { - return UserSession{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserSessionListIterator type. -func NewUserSessionListIterator(page UserSessionListPage) UserSessionListIterator { - return UserSessionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (usl UserSessionList) IsEmpty() bool { - return usl.Value == nil || len(*usl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (usl UserSessionList) hasNextLink() bool { - return usl.NextLink != nil && len(*usl.NextLink) != 0 -} - -// userSessionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (usl UserSessionList) userSessionListPreparer(ctx context.Context) (*http.Request, error) { - if !usl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(usl.NextLink))) -} - -// UserSessionListPage contains a page of UserSession values. -type UserSessionListPage struct { - fn func(context.Context, UserSessionList) (UserSessionList, error) - usl UserSessionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UserSessionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.usl) - if err != nil { - return err - } - page.usl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UserSessionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserSessionListPage) NotDone() bool { - return !page.usl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserSessionListPage) Response() UserSessionList { - return page.usl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserSessionListPage) Values() []UserSession { - if page.usl.IsEmpty() { - return nil - } - return *page.usl.Value -} - -// Creates a new instance of the UserSessionListPage type. -func NewUserSessionListPage(cur UserSessionList, getNextPage func(context.Context, UserSessionList) (UserSessionList, error)) UserSessionListPage { - return UserSessionListPage{ - fn: getNextPage, - usl: cur, - } -} - -// UserSessionProperties schema for UserSession properties. -type UserSessionProperties struct { - // ObjectID - READ-ONLY; ObjectId of user session. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // UserPrincipalName - The user principal name. - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - // ApplicationType - Application type of application. Possible values include: 'ApplicationTypeRemoteApp', 'ApplicationTypeDesktop' - ApplicationType ApplicationType `json:"applicationType,omitempty"` - // SessionState - State of user session. Possible values include: 'SessionStateUnknown', 'SessionStateActive', 'SessionStateDisconnected', 'SessionStatePending', 'SessionStateLogOff', 'SessionStateUserProfileDiskMounted' - SessionState SessionState `json:"sessionState,omitempty"` - // ActiveDirectoryUserName - The active directory user name. - ActiveDirectoryUserName *string `json:"activeDirectoryUserName,omitempty"` - // CreateTime - The timestamp of the user session create. - CreateTime *date.Time `json:"createTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserSessionProperties. -func (usp UserSessionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if usp.UserPrincipalName != nil { - objectMap["userPrincipalName"] = usp.UserPrincipalName - } - if usp.ApplicationType != "" { - objectMap["applicationType"] = usp.ApplicationType - } - if usp.SessionState != "" { - objectMap["sessionState"] = usp.SessionState - } - if usp.ActiveDirectoryUserName != nil { - objectMap["activeDirectoryUserName"] = usp.ActiveDirectoryUserName - } - if usp.CreateTime != nil { - objectMap["createTime"] = usp.CreateTime - } - return json.Marshal(objectMap) -} - -// Workspace represents a Workspace definition. -type Workspace struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // WorkspaceProperties - Detailed properties for Workspace - *WorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - 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"` - // Kind - 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"` - // Etag - 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"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for Workspace. -func (w Workspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.SystemData != nil { - objectMap["systemData"] = w.SystemData - } - if w.WorkspaceProperties != nil { - objectMap["properties"] = w.WorkspaceProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.ManagedBy != nil { - objectMap["managedBy"] = w.ManagedBy - } - if w.Kind != nil { - objectMap["kind"] = w.Kind - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - if w.Identity != nil { - objectMap["identity"] = w.Identity - } - if w.Sku != nil { - objectMap["sku"] = w.Sku - } - if w.Plan != nil { - objectMap["plan"] = w.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Workspace struct. -func (w *Workspace) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - w.SystemData = &systemData - } - case "properties": - if v != nil { - var workspaceProperties WorkspaceProperties - err = json.Unmarshal(*v, &workspaceProperties) - if err != nil { - return err - } - w.WorkspaceProperties = &workspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - w.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - w.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - w.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - w.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - w.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - w.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - w.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - w.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - w.Plan = &plan - } - } - } - - return nil -} - -// WorkspaceList list of Workspace definitions. -type WorkspaceList struct { - autorest.Response `json:"-"` - // Value - List of Workspace definitions. - Value *[]Workspace `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceList. -func (wl WorkspaceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wl.Value != nil { - objectMap["value"] = wl.Value - } - return json.Marshal(objectMap) -} - -// WorkspaceListIterator provides access to a complete listing of Workspace values. -type WorkspaceListIterator struct { - i int - page WorkspaceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkspaceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkspaceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkspaceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkspaceListIterator) Response() WorkspaceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkspaceListIterator) Value() Workspace { - if !iter.page.NotDone() { - return Workspace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkspaceListIterator type. -func NewWorkspaceListIterator(page WorkspaceListPage) WorkspaceListIterator { - return WorkspaceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wl WorkspaceList) IsEmpty() bool { - return wl.Value == nil || len(*wl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wl WorkspaceList) hasNextLink() bool { - return wl.NextLink != nil && len(*wl.NextLink) != 0 -} - -// workspaceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wl WorkspaceList) workspaceListPreparer(ctx context.Context) (*http.Request, error) { - if !wl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wl.NextLink))) -} - -// WorkspaceListPage contains a page of Workspace values. -type WorkspaceListPage struct { - fn func(context.Context, WorkspaceList) (WorkspaceList, error) - wl WorkspaceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkspaceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wl) - if err != nil { - return err - } - page.wl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkspaceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkspaceListPage) NotDone() bool { - return !page.wl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkspaceListPage) Response() WorkspaceList { - return page.wl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkspaceListPage) Values() []Workspace { - if page.wl.IsEmpty() { - return nil - } - return *page.wl.Value -} - -// Creates a new instance of the WorkspaceListPage type. -func NewWorkspaceListPage(cur WorkspaceList, getNextPage func(context.Context, WorkspaceList) (WorkspaceList, error)) WorkspaceListPage { - return WorkspaceListPage{ - fn: getNextPage, - wl: cur, - } -} - -// WorkspacePatch workspace properties that can be patched. -type WorkspacePatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // WorkspacePatchProperties - Detailed properties for Workspace - *WorkspacePatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspacePatch. -func (wp WorkspacePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Tags != nil { - objectMap["tags"] = wp.Tags - } - if wp.WorkspacePatchProperties != nil { - objectMap["properties"] = wp.WorkspacePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspacePatch struct. -func (wp *WorkspacePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wp.Tags = tags - } - case "properties": - if v != nil { - var workspacePatchProperties WorkspacePatchProperties - err = json.Unmarshal(*v, &workspacePatchProperties) - if err != nil { - return err - } - wp.WorkspacePatchProperties = &workspacePatchProperties - } - } - } - - return nil -} - -// WorkspacePatchProperties workspace properties that can be patched. -type WorkspacePatchProperties struct { - // Description - Description of Workspace. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Workspace. - FriendlyName *string `json:"friendlyName,omitempty"` - // ApplicationGroupReferences - List of applicationGroup links. - ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` - // PublicNetworkAccess - Enabled to allow this resource to be access from the public network. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// WorkspaceProperties schema for Workspace properties. -type WorkspaceProperties struct { - // ObjectID - READ-ONLY; ObjectId of Workspace. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of Workspace. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Workspace. - FriendlyName *string `json:"friendlyName,omitempty"` - // ApplicationGroupReferences - List of applicationGroup resource Ids. - ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` - // CloudPcResource - READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty"` - // 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. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceProperties. -func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Description != nil { - objectMap["description"] = wp.Description - } - if wp.FriendlyName != nil { - objectMap["friendlyName"] = wp.FriendlyName - } - if wp.ApplicationGroupReferences != nil { - objectMap["applicationGroupReferences"] = wp.ApplicationGroupReferences - } - if wp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msiximages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msiximages.go deleted file mode 100644 index ae7b4d38218fd..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msiximages.go +++ /dev/null @@ -1,165 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MsixImagesClient is the client for the MsixImages methods of the Desktopvirtualization service. -type MsixImagesClient struct { - BaseClient -} - -// NewMsixImagesClient creates an instance of the MsixImagesClient client. -func NewMsixImagesClient(subscriptionID string) MsixImagesClient { - return NewMsixImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMsixImagesClientWithBaseURI creates an instance of the MsixImagesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMsixImagesClientWithBaseURI(baseURI string, subscriptionID string) MsixImagesClient { - return MsixImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Expand expands and Lists MSIX packages in an Image, given the Image Path. -// Parameters: -// 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 -func (client MsixImagesClient) Expand(ctx context.Context, resourceGroupName string, hostPoolName string, msixImageURI MSIXImageURI) (result ExpandMsixImageListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MsixImagesClient.Expand") - defer func() { - sc := -1 - if result.emil.Response.Response != nil { - sc = result.emil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MsixImagesClient", "Expand", err.Error()) - } - - result.fn = client.expandNextResults - req, err := client.ExpandPreparer(ctx, resourceGroupName, hostPoolName, msixImageURI) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "Expand", nil, "Failure preparing request") - return - } - - resp, err := client.ExpandSender(req) - if err != nil { - result.emil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "Expand", resp, "Failure sending request") - return - } - - result.emil, err = client.ExpandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "Expand", resp, "Failure responding to request") - return - } - if result.emil.hasNextLink() && result.emil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ExpandPreparer prepares the Expand request. -func (client MsixImagesClient) ExpandPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixImageURI MSIXImageURI) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage", pathParameters), - autorest.WithJSON(msixImageURI), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExpandSender sends the Expand request. The method will close the -// http.Response Body if it receives an error. -func (client MsixImagesClient) ExpandSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExpandResponder handles the response to the Expand request. The method always -// closes the http.Response Body. -func (client MsixImagesClient) ExpandResponder(resp *http.Response) (result ExpandMsixImageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// expandNextResults retrieves the next set of results, if any. -func (client MsixImagesClient) expandNextResults(ctx context.Context, lastResults ExpandMsixImageList) (result ExpandMsixImageList, err error) { - req, err := lastResults.expandMsixImageListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "expandNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ExpandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "expandNextResults", resp, "Failure sending next results request") - } - result, err = client.ExpandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "expandNextResults", resp, "Failure responding to next results request") - } - return -} - -// ExpandComplete enumerates all values, automatically crossing page boundaries as required. -func (client MsixImagesClient) ExpandComplete(ctx context.Context, resourceGroupName string, hostPoolName string, msixImageURI MSIXImageURI) (result ExpandMsixImageListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MsixImagesClient.Expand") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.Expand(ctx, resourceGroupName, hostPoolName, msixImageURI) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msixpackages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msixpackages.go deleted file mode 100644 index 2883ff86a0a3b..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msixpackages.go +++ /dev/null @@ -1,544 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MSIXPackagesClient is the client for the MSIXPackages methods of the Desktopvirtualization service. -type MSIXPackagesClient struct { - BaseClient -} - -// NewMSIXPackagesClient creates an instance of the MSIXPackagesClient client. -func NewMSIXPackagesClient(subscriptionID string) MSIXPackagesClient { - return NewMSIXPackagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMSIXPackagesClientWithBaseURI creates an instance of the MSIXPackagesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMSIXPackagesClientWithBaseURI(baseURI string, subscriptionID string) MSIXPackagesClient { - return MSIXPackagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a MSIX package. -// Parameters: -// 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 -// msixPackage - object containing MSIX Package definitions. -func (client MSIXPackagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage MSIXPackage) (result MSIXPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackage, - Constraints: []validation.Constraint{{Target: "msixPackage.MSIXPackageProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MSIXPackagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage MSIXPackage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithJSON(msixPackage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) CreateOrUpdateResponder(resp *http.Response) (result MSIXPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove an MSIX Package. -// Parameters: -// 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 -func (client MSIXPackagesClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MSIXPackagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a msixpackage. -// Parameters: -// 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 -func (client MSIXPackagesClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (result MSIXPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MSIXPackagesClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) GetResponder(resp *http.Response) (result MSIXPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list MSIX packages in hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client MSIXPackagesClient) List(ctx context.Context, resourceGroupName string, hostPoolName string) (result MSIXPackageListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.List") - defer func() { - sc := -1 - if result.mpl.Response.Response != nil { - sc = result.mpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "List", resp, "Failure sending request") - return - } - - result.mpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "List", resp, "Failure responding to request") - return - } - if result.mpl.hasNextLink() && result.mpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MSIXPackagesClient) ListPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) ListResponder(resp *http.Response) (result MSIXPackageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client MSIXPackagesClient) listNextResults(ctx context.Context, lastResults MSIXPackageList) (result MSIXPackageList, err error) { - req, err := lastResults.mSIXPackageListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client MSIXPackagesClient) ListComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result MSIXPackageListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, hostPoolName) - return -} - -// Update update an MSIX Package. -// Parameters: -// 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 -// msixPackage - object containing MSIX Package definitions. -func (client MSIXPackagesClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage *MSIXPackagePatch) (result MSIXPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MSIXPackagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage *MSIXPackagePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if msixPackage != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(msixPackage)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) UpdateResponder(resp *http.Response) (result MSIXPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/operations.go deleted file mode 100644 index e7983362934fe..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Desktopvirtualization service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all of the available operations the Desktop Virtualization resource provider supports. -func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.rpol.Response.Response != nil { - sc = result.rpol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rpol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.rpol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.rpol.hasNextLink() && result.rpol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DesktopVirtualization/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { - req, err := lastResults.resourceProviderOperationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privateendpointconnections.go deleted file mode 100644 index d9a2045dc49e7..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privateendpointconnections.go +++ /dev/null @@ -1,850 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the -// Desktopvirtualization service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// DeleteByHostPool remove a connection. -// Parameters: -// 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 -func (client PrivateEndpointConnectionsClient) DeleteByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.DeleteByHostPool") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", err.Error()) - } - - req, err := client.DeleteByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByHostPoolSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", resp, "Failure sending request") - return - } - - result, err = client.DeleteByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByHostPoolPreparer prepares the DeleteByHostPool request. -func (client PrivateEndpointConnectionsClient) DeleteByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByHostPoolSender sends the DeleteByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteByHostPoolResponder handles the response to the DeleteByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteByHostPoolResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByWorkspace remove a connection. -// Parameters: -// 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 -func (client PrivateEndpointConnectionsClient) DeleteByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.DeleteByWorkspace") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", err.Error()) - } - - req, err := client.DeleteByWorkspacePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByWorkspaceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.DeleteByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByWorkspacePreparer prepares the DeleteByWorkspace request. -func (client PrivateEndpointConnectionsClient) DeleteByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByWorkspaceSender sends the DeleteByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteByWorkspaceResponder handles the response to the DeleteByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteByWorkspaceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetByHostPool get a private endpoint connection. -// Parameters: -// 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 -func (client PrivateEndpointConnectionsClient) GetByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.GetByHostPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", err.Error()) - } - - req, err := client.GetByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.GetByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", resp, "Failure sending request") - return - } - - result, err = client.GetByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", resp, "Failure responding to request") - return - } - - return -} - -// GetByHostPoolPreparer prepares the GetByHostPool request. -func (client PrivateEndpointConnectionsClient) GetByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByHostPoolSender sends the GetByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByHostPoolResponder handles the response to the GetByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetByHostPoolResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByWorkspace get a private endpoint connection. -// Parameters: -// 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 -func (client PrivateEndpointConnectionsClient) GetByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.GetByWorkspace") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", err.Error()) - } - - req, err := client.GetByWorkspacePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.GetByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// GetByWorkspacePreparer prepares the GetByWorkspace request. -func (client PrivateEndpointConnectionsClient) GetByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByWorkspaceSender sends the GetByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByWorkspaceResponder handles the response to the GetByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetByWorkspaceResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHostPool list private endpoint connections associated with hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client PrivateEndpointConnectionsClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateEndpointConnectionListResultWithSystemDataPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.peclrwsd.Response.Response != nil { - sc = result.peclrwsd.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.peclrwsd.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.peclrwsd, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.peclrwsd.hasNextLink() && result.peclrwsd.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client PrivateEndpointConnectionsClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByHostPoolResponder(resp *http.Response) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByHostPoolNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResultWithSystemData) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - req, err := lastResults.privateEndpointConnectionListResultWithSystemDataPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateEndpointConnectionListResultWithSystemDataIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName) - return -} - -// ListByWorkspace list private endpoint connections. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client PrivateEndpointConnectionsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListResultWithSystemDataPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.peclrwsd.Response.Response != nil { - sc = result.peclrwsd.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.peclrwsd.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.peclrwsd, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.peclrwsd.hasNextLink() && result.peclrwsd.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client PrivateEndpointConnectionsClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByWorkspaceResponder(resp *http.Response) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByWorkspaceNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResultWithSystemData) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - req, err := lastResults.privateEndpointConnectionListResultWithSystemDataPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListResultWithSystemDataIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// UpdateByHostPool approve or reject a private endpoint connection. -// Parameters: -// 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. -func (client PrivateEndpointConnectionsClient) UpdateByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateByHostPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: connection, - Constraints: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", err.Error()) - } - - req, err := client.UpdateByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName, connection) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", resp, "Failure sending request") - return - } - - result, err = client.UpdateByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", resp, "Failure responding to request") - return - } - - return -} - -// UpdateByHostPoolPreparer prepares the UpdateByHostPool request. -func (client PrivateEndpointConnectionsClient) UpdateByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(connection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateByHostPoolSender sends the UpdateByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateByHostPoolResponder handles the response to the UpdateByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateByHostPoolResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateByWorkspace approve or reject a private endpoint connection. -// Parameters: -// 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. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateByWorkspace") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: connection, - Constraints: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", err.Error()) - } - - req, err := client.UpdateByWorkspacePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, connection) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.UpdateByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// UpdateByWorkspacePreparer prepares the UpdateByWorkspace request. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(connection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateByWorkspaceSender sends the UpdateByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateByWorkspaceResponder handles the response to the UpdateByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspaceResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privatelinkresources.go deleted file mode 100644 index 3126be922c031..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privatelinkresources.go +++ /dev/null @@ -1,293 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Desktopvirtualization service. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByHostPool list the private link resources available for this hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client PrivateLinkResourcesClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByHostPool") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client PrivateLinkResourcesClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByHostPoolResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByHostPoolNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName) - return -} - -// ListByWorkspace list the private link resources available for this workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client PrivateLinkResourcesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client PrivateLinkResourcesClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByWorkspaceResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByWorkspaceNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/scalingplans.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/scalingplans.go deleted file mode 100644 index 74f05f8cd0d11..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/scalingplans.go +++ /dev/null @@ -1,766 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ScalingPlansClient is the client for the ScalingPlans methods of the Desktopvirtualization service. -type ScalingPlansClient struct { - BaseClient -} - -// NewScalingPlansClient creates an instance of the ScalingPlansClient client. -func NewScalingPlansClient(subscriptionID string) ScalingPlansClient { - return NewScalingPlansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScalingPlansClientWithBaseURI creates an instance of the ScalingPlansClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewScalingPlansClientWithBaseURI(baseURI string, subscriptionID string) ScalingPlansClient { - return ScalingPlansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create or update a scaling plan. -// Parameters: -// 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. -func (client ScalingPlansClient) Create(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan ScalingPlan) (result ScalingPlan, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, scalingPlanName, scalingPlan) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ScalingPlansClient) CreatePreparer(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan ScalingPlan) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithJSON(scalingPlan), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) CreateResponder(resp *http.Response) (result ScalingPlan, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a scaling plan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scalingPlanName - the name of the scaling plan. -func (client ScalingPlansClient) Delete(ctx context.Context, resourceGroupName string, scalingPlanName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scalingPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScalingPlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, scalingPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a scaling plan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scalingPlanName - the name of the scaling plan. -func (client ScalingPlansClient) Get(ctx context.Context, resourceGroupName string, scalingPlanName string) (result ScalingPlan, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scalingPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScalingPlansClient) GetPreparer(ctx context.Context, resourceGroupName string, scalingPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) GetResponder(resp *http.Response) (result ScalingPlan, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHostPool list scaling plan associated with hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client ScalingPlansClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string) (result ScalingPlanListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByHostPool") - defer func() { - sc := -1 - if result.spl.Response.Response != nil { - sc = result.spl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.spl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.spl, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.spl.hasNextLink() && result.spl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client ScalingPlansClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) ListByHostPoolResponder(resp *http.Response) (result ScalingPlanList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client ScalingPlansClient) listByHostPoolNextResults(ctx context.Context, lastResults ScalingPlanList) (result ScalingPlanList, err error) { - req, err := lastResults.scalingPlanListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScalingPlansClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result ScalingPlanListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName) - return -} - -// ListByResourceGroup list scaling plans. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ScalingPlansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ScalingPlanListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.spl.Response.Response != nil { - sc = result.spl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.spl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.spl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.spl.hasNextLink() && result.spl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScalingPlansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) ListByResourceGroupResponder(resp *http.Response) (result ScalingPlanList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ScalingPlansClient) listByResourceGroupNextResults(ctx context.Context, lastResults ScalingPlanList) (result ScalingPlanList, err error) { - req, err := lastResults.scalingPlanListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScalingPlansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ScalingPlanListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list scaling plans in subscription. -func (client ScalingPlansClient) ListBySubscription(ctx context.Context) (result ScalingPlanListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListBySubscription") - defer func() { - sc := -1 - if result.spl.Response.Response != nil { - sc = result.spl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.spl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.spl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.spl.hasNextLink() && result.spl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScalingPlansClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) ListBySubscriptionResponder(resp *http.Response) (result ScalingPlanList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ScalingPlansClient) listBySubscriptionNextResults(ctx context.Context, lastResults ScalingPlanList) (result ScalingPlanList, err error) { - req, err := lastResults.scalingPlanListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScalingPlansClient) ListBySubscriptionComplete(ctx context.Context) (result ScalingPlanListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update update a scaling plan. -// Parameters: -// 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. -func (client ScalingPlansClient) Update(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan *ScalingPlanPatch) (result ScalingPlan, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, scalingPlanName, scalingPlan) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScalingPlansClient) UpdatePreparer(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan *ScalingPlanPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if scalingPlan != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(scalingPlan)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) UpdateResponder(resp *http.Response) (result ScalingPlan, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/sessionhosts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/sessionhosts.go deleted file mode 100644 index c48a94fdb187a..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/sessionhosts.go +++ /dev/null @@ -1,454 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SessionHostsClient is the client for the SessionHosts methods of the Desktopvirtualization service. -type SessionHostsClient struct { - BaseClient -} - -// NewSessionHostsClient creates an instance of the SessionHostsClient client. -func NewSessionHostsClient(subscriptionID string) SessionHostsClient { - return NewSessionHostsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSessionHostsClientWithBaseURI creates an instance of the SessionHostsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSessionHostsClientWithBaseURI(baseURI string, subscriptionID string) SessionHostsClient { - return SessionHostsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete remove a SessionHost. -// Parameters: -// 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 -// force - force flag to force sessionHost deletion even when userSession exists. -func (client SessionHostsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SessionHostsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a session host. -// Parameters: -// 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 -func (client SessionHostsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (result SessionHost, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SessionHostsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) GetResponder(resp *http.Response) (result SessionHost, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list sessionHosts. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client SessionHostsClient) List(ctx context.Context, resourceGroupName string, hostPoolName string) (result SessionHostListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.List") - defer func() { - sc := -1 - if result.shl.Response.Response != nil { - sc = result.shl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.shl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "List", resp, "Failure sending request") - return - } - - result.shl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "List", resp, "Failure responding to request") - return - } - if result.shl.hasNextLink() && result.shl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SessionHostsClient) ListPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) ListResponder(resp *http.Response) (result SessionHostList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SessionHostsClient) listNextResults(ctx context.Context, lastResults SessionHostList) (result SessionHostList, err error) { - req, err := lastResults.sessionHostListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SessionHostsClient) ListComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result SessionHostListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, hostPoolName) - return -} - -// Update update a session host. -// Parameters: -// 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 -// sessionHost - object containing SessionHost definitions. -// force - force flag to update assign, unassign or reassign personal desktop. -func (client SessionHostsClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, sessionHost *SessionHostPatch, force *bool) (result SessionHost, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, sessionHost, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SessionHostsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, sessionHost *SessionHostPatch, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if sessionHost != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(sessionHost)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) UpdateResponder(resp *http.Response) (result SessionHost, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/startmenuitems.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/startmenuitems.go deleted file mode 100644 index c471392cf0629..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/startmenuitems.go +++ /dev/null @@ -1,162 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// StartMenuItemsClient is the client for the StartMenuItems methods of the Desktopvirtualization service. -type StartMenuItemsClient struct { - BaseClient -} - -// NewStartMenuItemsClient creates an instance of the StartMenuItemsClient client. -func NewStartMenuItemsClient(subscriptionID string) StartMenuItemsClient { - return NewStartMenuItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStartMenuItemsClientWithBaseURI creates an instance of the StartMenuItemsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewStartMenuItemsClientWithBaseURI(baseURI string, subscriptionID string) StartMenuItemsClient { - return StartMenuItemsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list start menu items in the given application group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client StartMenuItemsClient) List(ctx context.Context, resourceGroupName string, applicationGroupName string) (result StartMenuItemListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemsClient.List") - defer func() { - sc := -1 - if result.smil.Response.Response != nil { - sc = result.smil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.StartMenuItemsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.smil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "List", resp, "Failure sending request") - return - } - - result.smil, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "List", resp, "Failure responding to request") - return - } - if result.smil.hasNextLink() && result.smil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client StartMenuItemsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client StartMenuItemsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client StartMenuItemsClient) ListResponder(resp *http.Response) (result StartMenuItemList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client StartMenuItemsClient) listNextResults(ctx context.Context, lastResults StartMenuItemList) (result StartMenuItemList, err error) { - req, err := lastResults.startMenuItemListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client StartMenuItemsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result StartMenuItemListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, applicationGroupName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/usersessions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/usersessions.go deleted file mode 100644 index 5f09aea2c4ae1..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/usersessions.go +++ /dev/null @@ -1,700 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserSessionsClient is the client for the UserSessions methods of the Desktopvirtualization service. -type UserSessionsClient struct { - BaseClient -} - -// NewUserSessionsClient creates an instance of the UserSessionsClient client. -func NewUserSessionsClient(subscriptionID string) UserSessionsClient { - return NewUserSessionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserSessionsClientWithBaseURI creates an instance of the UserSessionsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUserSessionsClientWithBaseURI(baseURI string, subscriptionID string) UserSessionsClient { - return UserSessionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete remove a userSession. -// Parameters: -// 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 -// force - force flag to login off userSession. -func (client UserSessionsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UserSessionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Disconnect disconnect a userSession. -// Parameters: -// 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 -func (client UserSessionsClient) Disconnect(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.Disconnect") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "Disconnect", err.Error()) - } - - req, err := client.DisconnectPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Disconnect", nil, "Failure preparing request") - return - } - - resp, err := client.DisconnectSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Disconnect", resp, "Failure sending request") - return - } - - result, err = client.DisconnectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Disconnect", resp, "Failure responding to request") - return - } - - return -} - -// DisconnectPreparer prepares the Disconnect request. -func (client UserSessionsClient) DisconnectPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisconnectSender sends the Disconnect request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) DisconnectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisconnectResponder handles the response to the Disconnect request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) DisconnectResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a userSession. -// Parameters: -// 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 -func (client UserSessionsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (result UserSession, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UserSessionsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) GetResponder(resp *http.Response) (result UserSession, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list userSessions. -// Parameters: -// 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 -func (client UserSessionsClient) List(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (result UserSessionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.List") - defer func() { - sc := -1 - if result.usl.Response.Response != nil { - sc = result.usl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.usl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "List", resp, "Failure sending request") - return - } - - result.usl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "List", resp, "Failure responding to request") - return - } - if result.usl.hasNextLink() && result.usl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserSessionsClient) ListPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) ListResponder(resp *http.Response) (result UserSessionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UserSessionsClient) listNextResults(ctx context.Context, lastResults UserSessionList) (result UserSessionList, err error) { - req, err := lastResults.userSessionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSessionsClient) ListComplete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (result UserSessionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, hostPoolName, sessionHostName) - return -} - -// ListByHostPool list userSessions. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// filter - oData filter expression. Valid properties for filtering are userprincipalname and sessionstate. -func (client UserSessionsClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, filter string) (result UserSessionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.usl.Response.Response != nil { - sc = result.usl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.usl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.usl, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.usl.hasNextLink() && result.usl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client UserSessionsClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) ListByHostPoolResponder(resp *http.Response) (result UserSessionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client UserSessionsClient) listByHostPoolNextResults(ctx context.Context, lastResults UserSessionList) (result UserSessionList, err error) { - req, err := lastResults.userSessionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSessionsClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string, filter string) (result UserSessionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName, filter) - return -} - -// SendMessageMethod send a message to a user. -// Parameters: -// 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 -// sendMessage - object containing message includes title and message body -func (client UserSessionsClient) SendMessageMethod(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, sendMessage *SendMessage) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.SendMessageMethod") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "SendMessageMethod", err.Error()) - } - - req, err := client.SendMessageMethodPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, sendMessage) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "SendMessageMethod", nil, "Failure preparing request") - return - } - - resp, err := client.SendMessageMethodSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "SendMessageMethod", resp, "Failure sending request") - return - } - - result, err = client.SendMessageMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "SendMessageMethod", resp, "Failure responding to request") - return - } - - return -} - -// SendMessageMethodPreparer prepares the SendMessageMethod request. -func (client UserSessionsClient) SendMessageMethodPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, sendMessage *SendMessage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if sendMessage != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(sendMessage)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SendMessageMethodSender sends the SendMessageMethod request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) SendMessageMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SendMessageMethodResponder handles the response to the SendMessageMethod request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) SendMessageMethodResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/version.go deleted file mode 100644 index 44c98c076df73..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package desktopvirtualization - -import "github.com/Azure/azure-sdk-for-go/version" - -// 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. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " desktopvirtualization/2021-09-03-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/workspaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/workspaces.go deleted file mode 100644 index e390eb2d80166..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/workspaces.go +++ /dev/null @@ -1,636 +0,0 @@ -package desktopvirtualization - -// 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. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkspacesClient is the client for the Workspaces methods of the Desktopvirtualization service. -type WorkspacesClient struct { - BaseClient -} - -// NewWorkspacesClient creates an instance of the WorkspacesClient client. -func NewWorkspacesClient(subscriptionID string) WorkspacesClient { - return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { - return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspace - object containing Workspace definitions. -func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, workspace) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(workspace), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list workspaces. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.wl.Response.Response != nil { - sc = result.wl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.wl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.wl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.wl.hasNextLink() && result.wl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkspacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceList) (result WorkspaceList, err error) { - req, err := lastResults.workspaceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WorkspaceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list workspaces in subscription. -func (client WorkspacesClient) ListBySubscription(ctx context.Context) (result WorkspaceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") - defer func() { - sc := -1 - if result.wl.Response.Response != nil { - sc = result.wl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.wl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.wl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.wl.hasNextLink() && result.wl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client WorkspacesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client WorkspacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkspaceList) (result WorkspaceList, err error) { - req, err := lastResults.workspaceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListBySubscriptionComplete(ctx context.Context) (result WorkspaceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update update a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspace - object containing Workspace definitions. -func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, workspace *WorkspacePatch) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, workspace) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspace *WorkspacePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if workspace != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(workspace)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go new file mode 100644 index 0000000000000..56913082b9556 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go @@ -0,0 +1,18 @@ +package application + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationClientWithBaseURI(endpoint string) ApplicationClient { + return ApplicationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/constants.go new file mode 100644 index 0000000000000..5b2bf0a7cd48b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/constants.go @@ -0,0 +1,65 @@ +package application + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommandLineSetting string + +const ( + CommandLineSettingAllow CommandLineSetting = "Allow" + CommandLineSettingDoNotAllow CommandLineSetting = "DoNotAllow" + CommandLineSettingRequire CommandLineSetting = "Require" +) + +func PossibleValuesForCommandLineSetting() []string { + return []string{ + string(CommandLineSettingAllow), + string(CommandLineSettingDoNotAllow), + string(CommandLineSettingRequire), + } +} + +func parseCommandLineSetting(input string) (*CommandLineSetting, error) { + vals := map[string]CommandLineSetting{ + "allow": CommandLineSettingAllow, + "donotallow": CommandLineSettingDoNotAllow, + "require": CommandLineSettingRequire, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CommandLineSetting(input) + return &out, nil +} + +type RemoteApplicationType string + +const ( + RemoteApplicationTypeInBuilt RemoteApplicationType = "InBuilt" + RemoteApplicationTypeMsixApplication RemoteApplicationType = "MsixApplication" +) + +func PossibleValuesForRemoteApplicationType() []string { + return []string{ + string(RemoteApplicationTypeInBuilt), + string(RemoteApplicationTypeMsixApplication), + } +} + +func parseRemoteApplicationType(input string) (*RemoteApplicationType, error) { + vals := map[string]RemoteApplicationType{ + "inbuilt": RemoteApplicationTypeInBuilt, + "msixapplication": RemoteApplicationTypeMsixApplication, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RemoteApplicationType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go new file mode 100644 index 0000000000000..e5609ed2b7fc1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go @@ -0,0 +1,137 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationId{} + +// ApplicationId is a struct representing the Resource ID for a Application +type ApplicationId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string + ApplicationName string +} + +// NewApplicationID returns a new ApplicationId struct +func NewApplicationID(subscriptionId string, resourceGroupName string, applicationGroupName string, applicationName string) ApplicationId { + return ApplicationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + ApplicationName: applicationName, + } +} + +// ParseApplicationID parses 'input' into a ApplicationId +func ParseApplicationID(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationIDInsensitively parses 'input' case-insensitively into a ApplicationId +// note: this method should only be used for API response data and not user input +func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationID checks that 'input' can be parsed as a Application ID +func ValidateApplicationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application ID +func (id ApplicationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s/applications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, id.ApplicationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application ID +func (id ApplicationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + resourceids.StaticSegment("staticApplications", "applications", "applications"), + resourceids.UserSpecifiedSegment("applicationName", "applicationValue"), + } +} + +// String returns a human-readable description of this Application ID +func (id ApplicationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + fmt.Sprintf("Application Name: %q", id.ApplicationName), + } + return fmt.Sprintf("Application (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go new file mode 100644 index 0000000000000..74e10313b6a90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go @@ -0,0 +1,124 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationGroupId{} + +// ApplicationGroupId is a struct representing the Resource ID for a Application Group +type ApplicationGroupId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string +} + +// NewApplicationGroupID returns a new ApplicationGroupId struct +func NewApplicationGroupID(subscriptionId string, resourceGroupName string, applicationGroupName string) ApplicationGroupId { + return ApplicationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + } +} + +// ParseApplicationGroupID parses 'input' into a ApplicationGroupId +func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationGroupIDInsensitively parses 'input' case-insensitively into a ApplicationGroupId +// note: this method should only be used for API response data and not user input +func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID +func ValidateApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Group ID +func (id ApplicationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Group ID +func (id ApplicationGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + } +} + +// String returns a human-readable description of this Application Group ID +func (id ApplicationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + } + return fmt.Sprintf("Application Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_createorupdate_autorest.go new file mode 100644 index 0000000000000..667a27450ccf6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_createorupdate_autorest.go @@ -0,0 +1,68 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// CreateOrUpdate ... +func (c ApplicationClient) CreateOrUpdate(ctx context.Context, id ApplicationId, input Application) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ApplicationClient) preparerForCreateOrUpdate(ctx context.Context, id ApplicationId, input Application) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_delete_autorest.go new file mode 100644 index 0000000000000..0bb3f01ae02f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_delete_autorest.go @@ -0,0 +1,65 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ApplicationClient) Delete(ctx context.Context, id ApplicationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ApplicationClient) preparerForDelete(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_get_autorest.go new file mode 100644 index 0000000000000..7c04468f2c8e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_get_autorest.go @@ -0,0 +1,67 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Get ... +func (c ApplicationClient) Get(ctx context.Context, id ApplicationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ApplicationClient) preparerForGet(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_list_autorest.go new file mode 100644 index 0000000000000..6810fcb17197a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_list_autorest.go @@ -0,0 +1,186 @@ +package application + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Application + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Application +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ApplicationClient) List(ctx context.Context, id ApplicationGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ApplicationClient) ListComplete(ctx context.Context, id ApplicationGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ApplicationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationClient) ListCompleteMatchingPredicate(ctx context.Context, id ApplicationGroupId, predicate ApplicationOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Application, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c ApplicationClient) preparerForList(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/applications", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ApplicationClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Application `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_update_autorest.go new file mode 100644 index 0000000000000..ac806964944ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_update_autorest.go @@ -0,0 +1,68 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Update ... +func (c ApplicationClient) Update(ctx context.Context, id ApplicationId, input ApplicationPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ApplicationClient) preparerForUpdate(ctx context.Context, id ApplicationId, input ApplicationPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_application.go new file mode 100644 index 0000000000000..700c972b9dea5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_application.go @@ -0,0 +1,16 @@ +package application + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Application struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ApplicationProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatch.go new file mode 100644 index 0000000000000..5b0e7d1a071ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatch.go @@ -0,0 +1,9 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPatch struct { + Properties *ApplicationPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatchproperties.go new file mode 100644 index 0000000000000..ada985872c6b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatchproperties.go @@ -0,0 +1,18 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPatchProperties struct { + ApplicationType *RemoteApplicationType `json:"applicationType,omitempty"` + CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineSetting *CommandLineSetting `json:"commandLineSetting,omitempty"` + Description *string `json:"description,omitempty"` + FilePath *string `json:"filePath,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + IconIndex *int64 `json:"iconIndex,omitempty"` + IconPath *string `json:"iconPath,omitempty"` + MsixPackageApplicationId *string `json:"msixPackageApplicationId,omitempty"` + MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` + ShowInPortal *bool `json:"showInPortal,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationproperties.go new file mode 100644 index 0000000000000..74362ae1d5028 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationproperties.go @@ -0,0 +1,21 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProperties struct { + ApplicationType *RemoteApplicationType `json:"applicationType,omitempty"` + CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineSetting CommandLineSetting `json:"commandLineSetting"` + Description *string `json:"description,omitempty"` + FilePath *string `json:"filePath,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + IconContent *string `json:"iconContent,omitempty"` + IconHash *string `json:"iconHash,omitempty"` + IconIndex *int64 `json:"iconIndex,omitempty"` + IconPath *string `json:"iconPath,omitempty"` + MsixPackageApplicationId *string `json:"msixPackageApplicationId,omitempty"` + MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + ShowInPortal *bool `json:"showInPortal,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/predicates.go new file mode 100644 index 0000000000000..82c6b7d376de9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/predicates.go @@ -0,0 +1,24 @@ +package application + +type ApplicationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApplicationOperationPredicate) Matches(input Application) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/version.go new file mode 100644 index 0000000000000..b3bd5a71e05ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/version.go @@ -0,0 +1,12 @@ +package application + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/application/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go new file mode 100644 index 0000000000000..20ca14a850a78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go @@ -0,0 +1,18 @@ +package applicationgroup + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationGroupClientWithBaseURI(endpoint string) ApplicationGroupClient { + return ApplicationGroupClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/constants.go new file mode 100644 index 0000000000000..a24e7261f53fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/constants.go @@ -0,0 +1,105 @@ +package applicationgroup + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupType string + +const ( + ApplicationGroupTypeDesktop ApplicationGroupType = "Desktop" + ApplicationGroupTypeRemoteApp ApplicationGroupType = "RemoteApp" +) + +func PossibleValuesForApplicationGroupType() []string { + return []string{ + string(ApplicationGroupTypeDesktop), + string(ApplicationGroupTypeRemoteApp), + } +} + +func parseApplicationGroupType(input string) (*ApplicationGroupType, error) { + vals := map[string]ApplicationGroupType{ + "desktop": ApplicationGroupTypeDesktop, + "remoteapp": ApplicationGroupTypeRemoteApp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationGroupType(input) + return &out, nil +} + +type Operation string + +const ( + OperationComplete Operation = "Complete" + OperationHide Operation = "Hide" + OperationRevoke Operation = "Revoke" + OperationStart Operation = "Start" + OperationUnhide Operation = "Unhide" +) + +func PossibleValuesForOperation() []string { + return []string{ + string(OperationComplete), + string(OperationHide), + string(OperationRevoke), + string(OperationStart), + string(OperationUnhide), + } +} + +func parseOperation(input string) (*Operation, error) { + vals := map[string]Operation{ + "complete": OperationComplete, + "hide": OperationHide, + "revoke": OperationRevoke, + "start": OperationStart, + "unhide": OperationUnhide, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operation(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go new file mode 100644 index 0000000000000..6c20bd489e9a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go @@ -0,0 +1,124 @@ +package applicationgroup + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationGroupId{} + +// ApplicationGroupId is a struct representing the Resource ID for a Application Group +type ApplicationGroupId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string +} + +// NewApplicationGroupID returns a new ApplicationGroupId struct +func NewApplicationGroupID(subscriptionId string, resourceGroupName string, applicationGroupName string) ApplicationGroupId { + return ApplicationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + } +} + +// ParseApplicationGroupID parses 'input' into a ApplicationGroupId +func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationGroupIDInsensitively parses 'input' case-insensitively into a ApplicationGroupId +// note: this method should only be used for API response data and not user input +func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID +func ValidateApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Group ID +func (id ApplicationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Group ID +func (id ApplicationGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + } +} + +// String returns a human-readable description of this Application Group ID +func (id ApplicationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + } + return fmt.Sprintf("Application Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_createorupdate_autorest.go new file mode 100644 index 0000000000000..268106c8d09fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_createorupdate_autorest.go @@ -0,0 +1,68 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ApplicationGroup +} + +// CreateOrUpdate ... +func (c ApplicationGroupClient) CreateOrUpdate(ctx context.Context, id ApplicationGroupId, input ApplicationGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ApplicationGroupClient) preparerForCreateOrUpdate(ctx context.Context, id ApplicationGroupId, input ApplicationGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_delete_autorest.go new file mode 100644 index 0000000000000..981983b00a9c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_delete_autorest.go @@ -0,0 +1,65 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ApplicationGroupClient) Delete(ctx context.Context, id ApplicationGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ApplicationGroupClient) preparerForDelete(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_get_autorest.go new file mode 100644 index 0000000000000..77376fc5b5cdb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_get_autorest.go @@ -0,0 +1,67 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ApplicationGroup +} + +// Get ... +func (c ApplicationGroupClient) Get(ctx context.Context, id ApplicationGroupId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ApplicationGroupClient) preparerForGet(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbyresourcegroup_autorest.go new file mode 100644 index 0000000000000..16186a1f419c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package applicationgroup + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ApplicationGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ApplicationGroup +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Filter *string +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListByResourceGroup ... +func (c ApplicationGroupClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ApplicationGroupClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ApplicationGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationGroupClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate ApplicationGroupOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ApplicationGroup, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ApplicationGroupClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/applicationGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ApplicationGroupClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ApplicationGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbysubscription_autorest.go new file mode 100644 index 0000000000000..18a438e150dbb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package applicationgroup + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ApplicationGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ApplicationGroup +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Filter *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListBySubscription ... +func (c ApplicationGroupClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ApplicationGroupClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ApplicationGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationGroupClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate ApplicationGroupOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ApplicationGroup, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ApplicationGroupClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/applicationGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ApplicationGroupClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ApplicationGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_update_autorest.go new file mode 100644 index 0000000000000..b8b18e55d4669 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_update_autorest.go @@ -0,0 +1,68 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ApplicationGroup +} + +// Update ... +func (c ApplicationGroupClient) Update(ctx context.Context, id ApplicationGroupId, input ApplicationGroupPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ApplicationGroupClient) preparerForUpdate(ctx context.Context, id ApplicationGroupId, input ApplicationGroupPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroup.go new file mode 100644 index 0000000000000..afb13f5670b78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroup.go @@ -0,0 +1,25 @@ +package applicationgroup + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroup struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties ApplicationGroupProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatch.go new file mode 100644 index 0000000000000..e5d6300254460 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatch.go @@ -0,0 +1,12 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupPatch struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApplicationGroupPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatchproperties.go new file mode 100644 index 0000000000000..2f2f5c20d7911 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatchproperties.go @@ -0,0 +1,9 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupPatchProperties struct { + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroupproperties.go new file mode 100644 index 0000000000000..8cc435c3bd91c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroupproperties.go @@ -0,0 +1,15 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupProperties struct { + ApplicationGroupType ApplicationGroupType `json:"applicationGroupType"` + CloudPcResource *bool `json:"cloudPcResource,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolArmPath string `json:"hostPoolArmPath"` + MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + WorkspaceArmPath *string `json:"workspaceArmPath,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_migrationrequestproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_migrationrequestproperties.go new file mode 100644 index 0000000000000..238d6d023656c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_migrationrequestproperties.go @@ -0,0 +1,9 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationRequestProperties struct { + MigrationPath *string `json:"migrationPath,omitempty"` + Operation *Operation `json:"operation,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_plan.go new file mode 100644 index 0000000000000..865073b6a3e46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_plan.go @@ -0,0 +1,12 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_sku.go new file mode 100644 index 0000000000000..57066762740d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_sku.go @@ -0,0 +1,12 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/predicates.go new file mode 100644 index 0000000000000..f0e69f1abd2cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/predicates.go @@ -0,0 +1,44 @@ +package applicationgroup + +type ApplicationGroupOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p ApplicationGroupOperationPredicate) Matches(input ApplicationGroup) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/version.go new file mode 100644 index 0000000000000..abe65319f8b5d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/version.go @@ -0,0 +1,12 @@ +package applicationgroup + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/applicationgroup/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go new file mode 100644 index 0000000000000..cc153930daa78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go @@ -0,0 +1,18 @@ +package desktop + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopClient struct { + Client autorest.Client + baseUri string +} + +func NewDesktopClientWithBaseURI(endpoint string) DesktopClient { + return DesktopClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go new file mode 100644 index 0000000000000..fe30e445a4fd3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go @@ -0,0 +1,124 @@ +package desktop + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationGroupId{} + +// ApplicationGroupId is a struct representing the Resource ID for a Application Group +type ApplicationGroupId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string +} + +// NewApplicationGroupID returns a new ApplicationGroupId struct +func NewApplicationGroupID(subscriptionId string, resourceGroupName string, applicationGroupName string) ApplicationGroupId { + return ApplicationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + } +} + +// ParseApplicationGroupID parses 'input' into a ApplicationGroupId +func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationGroupIDInsensitively parses 'input' case-insensitively into a ApplicationGroupId +// note: this method should only be used for API response data and not user input +func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID +func ValidateApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Group ID +func (id ApplicationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Group ID +func (id ApplicationGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + } +} + +// String returns a human-readable description of this Application Group ID +func (id ApplicationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + } + return fmt.Sprintf("Application Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go new file mode 100644 index 0000000000000..1b44ed2f2829f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go @@ -0,0 +1,137 @@ +package desktop + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DesktopId{} + +// DesktopId is a struct representing the Resource ID for a Desktop +type DesktopId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string + DesktopName string +} + +// NewDesktopID returns a new DesktopId struct +func NewDesktopID(subscriptionId string, resourceGroupName string, applicationGroupName string, desktopName string) DesktopId { + return DesktopId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + DesktopName: desktopName, + } +} + +// ParseDesktopID parses 'input' into a DesktopId +func ParseDesktopID(input string) (*DesktopId, error) { + parser := resourceids.NewParserFromResourceIdType(DesktopId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DesktopId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { + return nil, fmt.Errorf("the segment 'desktopName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDesktopIDInsensitively parses 'input' case-insensitively into a DesktopId +// note: this method should only be used for API response data and not user input +func ParseDesktopIDInsensitively(input string) (*DesktopId, error) { + parser := resourceids.NewParserFromResourceIdType(DesktopId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DesktopId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { + return nil, fmt.Errorf("the segment 'desktopName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDesktopID checks that 'input' can be parsed as a Desktop ID +func ValidateDesktopID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDesktopID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Desktop ID +func (id DesktopId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s/desktops/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, id.DesktopName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Desktop ID +func (id DesktopId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + resourceids.StaticSegment("staticDesktops", "desktops", "desktops"), + resourceids.UserSpecifiedSegment("desktopName", "desktopValue"), + } +} + +// String returns a human-readable description of this Desktop ID +func (id DesktopId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + fmt.Sprintf("Desktop Name: %q", id.DesktopName), + } + return fmt.Sprintf("Desktop (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_get_autorest.go new file mode 100644 index 0000000000000..23658f0ebe265 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_get_autorest.go @@ -0,0 +1,67 @@ +package desktop + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Desktop +} + +// Get ... +func (c DesktopClient) Get(ctx context.Context, id DesktopId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DesktopClient) preparerForGet(ctx context.Context, id DesktopId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DesktopClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_list_autorest.go new file mode 100644 index 0000000000000..145ff8981ddb3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_list_autorest.go @@ -0,0 +1,186 @@ +package desktop + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Desktop + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Desktop +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DesktopClient) List(ctx context.Context, id ApplicationGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DesktopClient) ListComplete(ctx context.Context, id ApplicationGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, DesktopOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DesktopClient) ListCompleteMatchingPredicate(ctx context.Context, id ApplicationGroupId, predicate DesktopOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Desktop, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c DesktopClient) preparerForList(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/desktops", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DesktopClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DesktopClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Desktop `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_update_autorest.go new file mode 100644 index 0000000000000..60d6fece536f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_update_autorest.go @@ -0,0 +1,68 @@ +package desktop + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Desktop +} + +// Update ... +func (c DesktopClient) Update(ctx context.Context, id DesktopId, input DesktopPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DesktopClient) preparerForUpdate(ctx context.Context, id DesktopId, input DesktopPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DesktopClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktop.go new file mode 100644 index 0000000000000..6d41ecc215e22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktop.go @@ -0,0 +1,16 @@ +package desktop + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Desktop struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DesktopProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatch.go new file mode 100644 index 0000000000000..1d7d1672159e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatch.go @@ -0,0 +1,9 @@ +package desktop + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopPatch struct { + Properties *DesktopPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatchproperties.go new file mode 100644 index 0000000000000..40b1a4577e1f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatchproperties.go @@ -0,0 +1,9 @@ +package desktop + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopPatchProperties struct { + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktopproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktopproperties.go new file mode 100644 index 0000000000000..2d961ead46cb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktopproperties.go @@ -0,0 +1,12 @@ +package desktop + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopProperties struct { + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + IconContent *string `json:"iconContent,omitempty"` + IconHash *string `json:"iconHash,omitempty"` + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/predicates.go new file mode 100644 index 0000000000000..f8bbb1e357f72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/predicates.go @@ -0,0 +1,24 @@ +package desktop + +type DesktopOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DesktopOperationPredicate) Matches(input Desktop) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/version.go new file mode 100644 index 0000000000000..82f4c83323bc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/version.go @@ -0,0 +1,12 @@ +package desktop + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/desktop/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go new file mode 100644 index 0000000000000..adce757bb860c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go @@ -0,0 +1,18 @@ +package hostpool + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolClient struct { + Client autorest.Client + baseUri string +} + +func NewHostPoolClientWithBaseURI(endpoint string) HostPoolClient { + return HostPoolClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/constants.go new file mode 100644 index 0000000000000..2566a6adc1fb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/constants.go @@ -0,0 +1,291 @@ +package hostpool + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolType string + +const ( + HostPoolTypeBYODesktop HostPoolType = "BYODesktop" + HostPoolTypePersonal HostPoolType = "Personal" + HostPoolTypePooled HostPoolType = "Pooled" +) + +func PossibleValuesForHostPoolType() []string { + return []string{ + string(HostPoolTypeBYODesktop), + string(HostPoolTypePersonal), + string(HostPoolTypePooled), + } +} + +func parseHostPoolType(input string) (*HostPoolType, error) { + vals := map[string]HostPoolType{ + "byodesktop": HostPoolTypeBYODesktop, + "personal": HostPoolTypePersonal, + "pooled": HostPoolTypePooled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostPoolType(input) + return &out, nil +} + +type LoadBalancerType string + +const ( + LoadBalancerTypeBreadthFirst LoadBalancerType = "BreadthFirst" + LoadBalancerTypeDepthFirst LoadBalancerType = "DepthFirst" + LoadBalancerTypePersistent LoadBalancerType = "Persistent" +) + +func PossibleValuesForLoadBalancerType() []string { + return []string{ + string(LoadBalancerTypeBreadthFirst), + string(LoadBalancerTypeDepthFirst), + string(LoadBalancerTypePersistent), + } +} + +func parseLoadBalancerType(input string) (*LoadBalancerType, error) { + vals := map[string]LoadBalancerType{ + "breadthfirst": LoadBalancerTypeBreadthFirst, + "depthfirst": LoadBalancerTypeDepthFirst, + "persistent": LoadBalancerTypePersistent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LoadBalancerType(input) + return &out, nil +} + +type Operation string + +const ( + OperationComplete Operation = "Complete" + OperationHide Operation = "Hide" + OperationRevoke Operation = "Revoke" + OperationStart Operation = "Start" + OperationUnhide Operation = "Unhide" +) + +func PossibleValuesForOperation() []string { + return []string{ + string(OperationComplete), + string(OperationHide), + string(OperationRevoke), + string(OperationStart), + string(OperationUnhide), + } +} + +func parseOperation(input string) (*Operation, error) { + vals := map[string]Operation{ + "complete": OperationComplete, + "hide": OperationHide, + "revoke": OperationRevoke, + "start": OperationStart, + "unhide": OperationUnhide, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operation(input) + return &out, nil +} + +type PersonalDesktopAssignmentType string + +const ( + PersonalDesktopAssignmentTypeAutomatic PersonalDesktopAssignmentType = "Automatic" + PersonalDesktopAssignmentTypeDirect PersonalDesktopAssignmentType = "Direct" +) + +func PossibleValuesForPersonalDesktopAssignmentType() []string { + return []string{ + string(PersonalDesktopAssignmentTypeAutomatic), + string(PersonalDesktopAssignmentTypeDirect), + } +} + +func parsePersonalDesktopAssignmentType(input string) (*PersonalDesktopAssignmentType, error) { + vals := map[string]PersonalDesktopAssignmentType{ + "automatic": PersonalDesktopAssignmentTypeAutomatic, + "direct": PersonalDesktopAssignmentTypeDirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PersonalDesktopAssignmentType(input) + return &out, nil +} + +type PreferredAppGroupType string + +const ( + PreferredAppGroupTypeDesktop PreferredAppGroupType = "Desktop" + PreferredAppGroupTypeNone PreferredAppGroupType = "None" + PreferredAppGroupTypeRailApplications PreferredAppGroupType = "RailApplications" +) + +func PossibleValuesForPreferredAppGroupType() []string { + return []string{ + string(PreferredAppGroupTypeDesktop), + string(PreferredAppGroupTypeNone), + string(PreferredAppGroupTypeRailApplications), + } +} + +func parsePreferredAppGroupType(input string) (*PreferredAppGroupType, error) { + vals := map[string]PreferredAppGroupType{ + "desktop": PreferredAppGroupTypeDesktop, + "none": PreferredAppGroupTypeNone, + "railapplications": PreferredAppGroupTypeRailApplications, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PreferredAppGroupType(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RegistrationTokenOperation string + +const ( + RegistrationTokenOperationDelete RegistrationTokenOperation = "Delete" + RegistrationTokenOperationNone RegistrationTokenOperation = "None" + RegistrationTokenOperationUpdate RegistrationTokenOperation = "Update" +) + +func PossibleValuesForRegistrationTokenOperation() []string { + return []string{ + string(RegistrationTokenOperationDelete), + string(RegistrationTokenOperationNone), + string(RegistrationTokenOperationUpdate), + } +} + +func parseRegistrationTokenOperation(input string) (*RegistrationTokenOperation, error) { + vals := map[string]RegistrationTokenOperation{ + "delete": RegistrationTokenOperationDelete, + "none": RegistrationTokenOperationNone, + "update": RegistrationTokenOperationUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RegistrationTokenOperation(input) + return &out, nil +} + +type SSOSecretType string + +const ( + SSOSecretTypeCertificate SSOSecretType = "Certificate" + SSOSecretTypeCertificateInKeyVault SSOSecretType = "CertificateInKeyVault" + SSOSecretTypeSharedKey SSOSecretType = "SharedKey" + SSOSecretTypeSharedKeyInKeyVault SSOSecretType = "SharedKeyInKeyVault" +) + +func PossibleValuesForSSOSecretType() []string { + return []string{ + string(SSOSecretTypeCertificate), + string(SSOSecretTypeCertificateInKeyVault), + string(SSOSecretTypeSharedKey), + string(SSOSecretTypeSharedKeyInKeyVault), + } +} + +func parseSSOSecretType(input string) (*SSOSecretType, error) { + vals := map[string]SSOSecretType{ + "certificate": SSOSecretTypeCertificate, + "certificateinkeyvault": SSOSecretTypeCertificateInKeyVault, + "sharedkey": SSOSecretTypeSharedKey, + "sharedkeyinkeyvault": SSOSecretTypeSharedKeyInKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SSOSecretType(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go new file mode 100644 index 0000000000000..61c8294302452 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go @@ -0,0 +1,124 @@ +package hostpool + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostPoolId{} + +// HostPoolId is a struct representing the Resource ID for a Host Pool +type HostPoolId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string +} + +// NewHostPoolID returns a new HostPoolId struct +func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId { + return HostPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + } +} + +// ParseHostPoolID parses 'input' into a HostPoolId +func ParseHostPoolID(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostPoolIDInsensitively parses 'input' case-insensitively into a HostPoolId +// note: this method should only be used for API response data and not user input +func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID +func ValidateHostPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Pool ID +func (id HostPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID +func (id HostPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + } +} + +// String returns a human-readable description of this Host Pool ID +func (id HostPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + } + return fmt.Sprintf("Host Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_createorupdate_autorest.go new file mode 100644 index 0000000000000..6ba8c24c25847 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_createorupdate_autorest.go @@ -0,0 +1,68 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *HostPool +} + +// CreateOrUpdate ... +func (c HostPoolClient) CreateOrUpdate(ctx context.Context, id HostPoolId, input HostPool) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c HostPoolClient) preparerForCreateOrUpdate(ctx context.Context, id HostPoolId, input HostPool) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_delete_autorest.go new file mode 100644 index 0000000000000..4483478b8e490 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_delete_autorest.go @@ -0,0 +1,94 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + Force *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Delete ... +func (c HostPoolClient) Delete(ctx context.Context, id HostPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c HostPoolClient) preparerForDelete(ctx context.Context, id HostPoolId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_get_autorest.go new file mode 100644 index 0000000000000..c442f70a28650 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_get_autorest.go @@ -0,0 +1,67 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *HostPool +} + +// Get ... +func (c HostPoolClient) Get(ctx context.Context, id HostPoolId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c HostPoolClient) preparerForGet(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_list_autorest.go new file mode 100644 index 0000000000000..d776af10f11c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_list_autorest.go @@ -0,0 +1,187 @@ +package hostpool + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]HostPool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []HostPool +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c HostPoolClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c HostPoolClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, HostPoolOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HostPoolClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate HostPoolOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]HostPool, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c HostPoolClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/hostPools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c HostPoolClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []HostPool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_listbyresourcegroup_autorest.go new file mode 100644 index 0000000000000..10e2fdbcb6302 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package hostpool + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]HostPool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []HostPool +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c HostPoolClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c HostPoolClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, HostPoolOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HostPoolClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate HostPoolOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]HostPool, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c HostPoolClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/hostPools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c HostPoolClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []HostPool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_retrieveregistrationtoken_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_retrieveregistrationtoken_autorest.go new file mode 100644 index 0000000000000..9e3317f180795 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_retrieveregistrationtoken_autorest.go @@ -0,0 +1,68 @@ +package hostpool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveRegistrationTokenOperationResponse struct { + HttpResponse *http.Response + Model *RegistrationInfo +} + +// RetrieveRegistrationToken ... +func (c HostPoolClient) RetrieveRegistrationToken(ctx context.Context, id HostPoolId) (result RetrieveRegistrationTokenOperationResponse, err error) { + req, err := c.preparerForRetrieveRegistrationToken(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "RetrieveRegistrationToken", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "RetrieveRegistrationToken", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRetrieveRegistrationToken(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "RetrieveRegistrationToken", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRetrieveRegistrationToken prepares the RetrieveRegistrationToken request. +func (c HostPoolClient) preparerForRetrieveRegistrationToken(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/retrieveRegistrationToken", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRetrieveRegistrationToken handles the response to the RetrieveRegistrationToken request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForRetrieveRegistrationToken(resp *http.Response) (result RetrieveRegistrationTokenOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_update_autorest.go new file mode 100644 index 0000000000000..9de04a30cfcbf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_update_autorest.go @@ -0,0 +1,68 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *HostPool +} + +// Update ... +func (c HostPoolClient) Update(ctx context.Context, id HostPoolId, input HostPoolPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c HostPoolClient) preparerForUpdate(ctx context.Context, id HostPoolId, input HostPoolPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpool.go new file mode 100644 index 0000000000000..e3d98e6ba0cba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpool.go @@ -0,0 +1,25 @@ +package hostpool + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPool struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties HostPoolProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatch.go new file mode 100644 index 0000000000000..6895ce28a7d36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatch.go @@ -0,0 +1,12 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolPatch struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *HostPoolPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatchproperties.go new file mode 100644 index 0000000000000..00cd5a495440f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatchproperties.go @@ -0,0 +1,24 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolPatchProperties struct { + CustomRdpProperty *string `json:"customRdpProperty,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + LoadBalancerType *LoadBalancerType `json:"loadBalancerType,omitempty"` + MaxSessionLimit *int64 `json:"maxSessionLimit,omitempty"` + PersonalDesktopAssignmentType *PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` + PreferredAppGroupType *PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RegistrationInfo *RegistrationInfoPatch `json:"registrationInfo,omitempty"` + Ring *int64 `json:"ring,omitempty"` + SsoClientId *string `json:"ssoClientId,omitempty"` + SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` + SsoSecretType *SSOSecretType `json:"ssoSecretType,omitempty"` + SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` + StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` + ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` + VmTemplate *string `json:"vmTemplate,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolproperties.go new file mode 100644 index 0000000000000..065010f580ce6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolproperties.go @@ -0,0 +1,29 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolProperties struct { + ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` + CloudPcResource *bool `json:"cloudPcResource,omitempty"` + CustomRdpProperty *string `json:"customRdpProperty,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolType HostPoolType `json:"hostPoolType"` + LoadBalancerType LoadBalancerType `json:"loadBalancerType"` + MaxSessionLimit *int64 `json:"maxSessionLimit,omitempty"` + MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + PersonalDesktopAssignmentType *PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` + PreferredAppGroupType PreferredAppGroupType `json:"preferredAppGroupType"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RegistrationInfo *RegistrationInfo `json:"registrationInfo,omitempty"` + Ring *int64 `json:"ring,omitempty"` + SsoClientId *string `json:"ssoClientId,omitempty"` + SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` + SsoSecretType *SSOSecretType `json:"ssoSecretType,omitempty"` + SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` + StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` + ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` + VmTemplate *string `json:"vmTemplate,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_migrationrequestproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_migrationrequestproperties.go new file mode 100644 index 0000000000000..2f6b968453d7b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_migrationrequestproperties.go @@ -0,0 +1,9 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationRequestProperties struct { + MigrationPath *string `json:"migrationPath,omitempty"` + Operation *Operation `json:"operation,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_plan.go new file mode 100644 index 0000000000000..f81691c1b9aa7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_plan.go @@ -0,0 +1,12 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfo.go new file mode 100644 index 0000000000000..ed356c7e596d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfo.go @@ -0,0 +1,28 @@ +package hostpool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationInfo struct { + ExpirationTime *string `json:"expirationTime,omitempty"` + RegistrationTokenOperation *RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` + Token *string `json:"token,omitempty"` +} + +func (o *RegistrationInfo) GetExpirationTimeAsTime() (*time.Time, error) { + if o.ExpirationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RegistrationInfo) SetExpirationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfopatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfopatch.go new file mode 100644 index 0000000000000..7340343045e97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfopatch.go @@ -0,0 +1,27 @@ +package hostpool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationInfoPatch struct { + ExpirationTime *string `json:"expirationTime,omitempty"` + RegistrationTokenOperation *RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` +} + +func (o *RegistrationInfoPatch) GetExpirationTimeAsTime() (*time.Time, error) { + if o.ExpirationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RegistrationInfoPatch) SetExpirationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_sku.go new file mode 100644 index 0000000000000..26583f4fcea09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_sku.go @@ -0,0 +1,12 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/predicates.go new file mode 100644 index 0000000000000..27e04add21236 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/predicates.go @@ -0,0 +1,44 @@ +package hostpool + +type HostPoolOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p HostPoolOperationPredicate) Matches(input HostPool) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/version.go new file mode 100644 index 0000000000000..3601ff52ba216 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/version.go @@ -0,0 +1,12 @@ +package hostpool + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/hostpool/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go new file mode 100644 index 0000000000000..eaee7bdef154b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go @@ -0,0 +1,18 @@ +package scalingplan + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanClient struct { + Client autorest.Client + baseUri string +} + +func NewScalingPlanClientWithBaseURI(endpoint string) ScalingPlanClient { + return ScalingPlanClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/constants.go new file mode 100644 index 0000000000000..9a7fcbb8a5e6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/constants.go @@ -0,0 +1,164 @@ +package scalingplan + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaysOfWeek string + +const ( + DaysOfWeekFriday DaysOfWeek = "Friday" + DaysOfWeekMonday DaysOfWeek = "Monday" + DaysOfWeekSaturday DaysOfWeek = "Saturday" + DaysOfWeekSunday DaysOfWeek = "Sunday" + DaysOfWeekThursday DaysOfWeek = "Thursday" + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +func PossibleValuesForDaysOfWeek() []string { + return []string{ + string(DaysOfWeekFriday), + string(DaysOfWeekMonday), + string(DaysOfWeekSaturday), + string(DaysOfWeekSunday), + string(DaysOfWeekThursday), + string(DaysOfWeekTuesday), + string(DaysOfWeekWednesday), + } +} + +func parseDaysOfWeek(input string) (*DaysOfWeek, error) { + vals := map[string]DaysOfWeek{ + "friday": DaysOfWeekFriday, + "monday": DaysOfWeekMonday, + "saturday": DaysOfWeekSaturday, + "sunday": DaysOfWeekSunday, + "thursday": DaysOfWeekThursday, + "tuesday": DaysOfWeekTuesday, + "wednesday": DaysOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DaysOfWeek(input) + return &out, nil +} + +type ScalingHostPoolType string + +const ( + ScalingHostPoolTypePooled ScalingHostPoolType = "Pooled" +) + +func PossibleValuesForScalingHostPoolType() []string { + return []string{ + string(ScalingHostPoolTypePooled), + } +} + +func parseScalingHostPoolType(input string) (*ScalingHostPoolType, error) { + vals := map[string]ScalingHostPoolType{ + "pooled": ScalingHostPoolTypePooled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScalingHostPoolType(input) + return &out, nil +} + +type SessionHostLoadBalancingAlgorithm string + +const ( + SessionHostLoadBalancingAlgorithmBreadthFirst SessionHostLoadBalancingAlgorithm = "BreadthFirst" + SessionHostLoadBalancingAlgorithmDepthFirst SessionHostLoadBalancingAlgorithm = "DepthFirst" +) + +func PossibleValuesForSessionHostLoadBalancingAlgorithm() []string { + return []string{ + string(SessionHostLoadBalancingAlgorithmBreadthFirst), + string(SessionHostLoadBalancingAlgorithmDepthFirst), + } +} + +func parseSessionHostLoadBalancingAlgorithm(input string) (*SessionHostLoadBalancingAlgorithm, error) { + vals := map[string]SessionHostLoadBalancingAlgorithm{ + "breadthfirst": SessionHostLoadBalancingAlgorithmBreadthFirst, + "depthfirst": SessionHostLoadBalancingAlgorithmDepthFirst, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SessionHostLoadBalancingAlgorithm(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type StopHostsWhen string + +const ( + StopHostsWhenZeroActiveSessions StopHostsWhen = "ZeroActiveSessions" + StopHostsWhenZeroSessions StopHostsWhen = "ZeroSessions" +) + +func PossibleValuesForStopHostsWhen() []string { + return []string{ + string(StopHostsWhenZeroActiveSessions), + string(StopHostsWhenZeroSessions), + } +} + +func parseStopHostsWhen(input string) (*StopHostsWhen, error) { + vals := map[string]StopHostsWhen{ + "zeroactivesessions": StopHostsWhenZeroActiveSessions, + "zerosessions": StopHostsWhenZeroSessions, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StopHostsWhen(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go new file mode 100644 index 0000000000000..403b28434e098 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go @@ -0,0 +1,124 @@ +package scalingplan + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostPoolId{} + +// HostPoolId is a struct representing the Resource ID for a Host Pool +type HostPoolId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string +} + +// NewHostPoolID returns a new HostPoolId struct +func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId { + return HostPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + } +} + +// ParseHostPoolID parses 'input' into a HostPoolId +func ParseHostPoolID(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostPoolIDInsensitively parses 'input' case-insensitively into a HostPoolId +// note: this method should only be used for API response data and not user input +func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID +func ValidateHostPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Pool ID +func (id HostPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID +func (id HostPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + } +} + +// String returns a human-readable description of this Host Pool ID +func (id HostPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + } + return fmt.Sprintf("Host Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go new file mode 100644 index 0000000000000..7ab8c80a40c26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go @@ -0,0 +1,124 @@ +package scalingplan + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScalingPlanId{} + +// ScalingPlanId is a struct representing the Resource ID for a Scaling Plan +type ScalingPlanId struct { + SubscriptionId string + ResourceGroupName string + ScalingPlanName string +} + +// NewScalingPlanID returns a new ScalingPlanId struct +func NewScalingPlanID(subscriptionId string, resourceGroupName string, scalingPlanName string) ScalingPlanId { + return ScalingPlanId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ScalingPlanName: scalingPlanName, + } +} + +// ParseScalingPlanID parses 'input' into a ScalingPlanId +func ParseScalingPlanID(input string) (*ScalingPlanId, error) { + parser := resourceids.NewParserFromResourceIdType(ScalingPlanId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScalingPlanId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { + return nil, fmt.Errorf("the segment 'scalingPlanName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScalingPlanIDInsensitively parses 'input' case-insensitively into a ScalingPlanId +// note: this method should only be used for API response data and not user input +func ParseScalingPlanIDInsensitively(input string) (*ScalingPlanId, error) { + parser := resourceids.NewParserFromResourceIdType(ScalingPlanId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScalingPlanId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { + return nil, fmt.Errorf("the segment 'scalingPlanName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScalingPlanID checks that 'input' can be parsed as a Scaling Plan ID +func ValidateScalingPlanID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScalingPlanID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scaling Plan ID +func (id ScalingPlanId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/scalingPlans/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ScalingPlanName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scaling Plan ID +func (id ScalingPlanId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticScalingPlans", "scalingPlans", "scalingPlans"), + resourceids.UserSpecifiedSegment("scalingPlanName", "scalingPlanValue"), + } +} + +// String returns a human-readable description of this Scaling Plan ID +func (id ScalingPlanId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scaling Plan Name: %q", id.ScalingPlanName), + } + return fmt.Sprintf("Scaling Plan (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_create_autorest.go new file mode 100644 index 0000000000000..8841c6898fd26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_create_autorest.go @@ -0,0 +1,68 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *ScalingPlan +} + +// Create ... +func (c ScalingPlanClient) Create(ctx context.Context, id ScalingPlanId, input ScalingPlan) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c ScalingPlanClient) preparerForCreate(ctx context.Context, id ScalingPlanId, input ScalingPlan) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_delete_autorest.go new file mode 100644 index 0000000000000..75755b5784c9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_delete_autorest.go @@ -0,0 +1,65 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ScalingPlanClient) Delete(ctx context.Context, id ScalingPlanId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ScalingPlanClient) preparerForDelete(ctx context.Context, id ScalingPlanId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_get_autorest.go new file mode 100644 index 0000000000000..5550e0d3eb9d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_get_autorest.go @@ -0,0 +1,67 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ScalingPlan +} + +// Get ... +func (c ScalingPlanClient) Get(ctx context.Context, id ScalingPlanId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ScalingPlanClient) preparerForGet(ctx context.Context, id ScalingPlanId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyhostpool_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyhostpool_autorest.go new file mode 100644 index 0000000000000..b60add783d35a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyhostpool_autorest.go @@ -0,0 +1,186 @@ +package scalingplan + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByHostPoolOperationResponse struct { + HttpResponse *http.Response + Model *[]ScalingPlan + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByHostPoolOperationResponse, error) +} + +type ListByHostPoolCompleteResult struct { + Items []ScalingPlan +} + +func (r ListByHostPoolOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByHostPoolOperationResponse) LoadMore(ctx context.Context) (resp ListByHostPoolOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByHostPool ... +func (c ScalingPlanClient) ListByHostPool(ctx context.Context, id HostPoolId) (resp ListByHostPoolOperationResponse, err error) { + req, err := c.preparerForListByHostPool(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByHostPool(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListByHostPoolComplete retrieves all of the results into a single object +func (c ScalingPlanClient) ListByHostPoolComplete(ctx context.Context, id HostPoolId) (ListByHostPoolCompleteResult, error) { + return c.ListByHostPoolCompleteMatchingPredicate(ctx, id, ScalingPlanOperationPredicate{}) +} + +// ListByHostPoolCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScalingPlanClient) ListByHostPoolCompleteMatchingPredicate(ctx context.Context, id HostPoolId, predicate ScalingPlanOperationPredicate) (resp ListByHostPoolCompleteResult, err error) { + items := make([]ScalingPlan, 0) + + page, err := c.ListByHostPool(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByHostPoolCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListByHostPool prepares the ListByHostPool request. +func (c ScalingPlanClient) preparerForListByHostPool(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/scalingPlans", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByHostPoolWithNextLink prepares the ListByHostPool request with the given nextLink token. +func (c ScalingPlanClient) preparerForListByHostPoolWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByHostPool handles the response to the ListByHostPool request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForListByHostPool(resp *http.Response) (result ListByHostPoolOperationResponse, err error) { + type page struct { + Values []ScalingPlan `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByHostPoolOperationResponse, err error) { + req, err := c.preparerForListByHostPoolWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByHostPool(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyresourcegroup_autorest.go new file mode 100644 index 0000000000000..81cad260899e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package scalingplan + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ScalingPlan + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ScalingPlan +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ScalingPlanClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ScalingPlanClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ScalingPlanOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScalingPlanClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ScalingPlanOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ScalingPlan, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ScalingPlanClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/scalingPlans", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ScalingPlanClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ScalingPlan `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbysubscription_autorest.go new file mode 100644 index 0000000000000..aa6c7049d5a58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package scalingplan + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ScalingPlan + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ScalingPlan +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ScalingPlanClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ScalingPlanClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ScalingPlanOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScalingPlanClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ScalingPlanOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ScalingPlan, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ScalingPlanClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/scalingPlans", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ScalingPlanClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ScalingPlan `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_update_autorest.go new file mode 100644 index 0000000000000..1a91bb1169413 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_update_autorest.go @@ -0,0 +1,68 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ScalingPlan +} + +// Update ... +func (c ScalingPlanClient) Update(ctx context.Context, id ScalingPlanId, input ScalingPlanPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ScalingPlanClient) preparerForUpdate(ctx context.Context, id ScalingPlanId, input ScalingPlanPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_plan.go new file mode 100644 index 0000000000000..07296ec47650f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_plan.go @@ -0,0 +1,12 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalinghostpoolreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalinghostpoolreference.go new file mode 100644 index 0000000000000..0bd8fd048bb74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalinghostpoolreference.go @@ -0,0 +1,9 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingHostPoolReference struct { + HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` + ScalingPlanEnabled *bool `json:"scalingPlanEnabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplan.go new file mode 100644 index 0000000000000..8b59d34339ec3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplan.go @@ -0,0 +1,25 @@ +package scalingplan + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlan struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *ScalingPlanProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatch.go new file mode 100644 index 0000000000000..642647709fed5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatch.go @@ -0,0 +1,9 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanPatch struct { + Properties *ScalingPlanPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatchproperties.go new file mode 100644 index 0000000000000..393a26bb413a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatchproperties.go @@ -0,0 +1,13 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanPatchProperties struct { + Description *string `json:"description,omitempty"` + ExclusionTag *string `json:"exclusionTag,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` + Schedules *[]ScalingSchedule `json:"schedules,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanproperties.go new file mode 100644 index 0000000000000..520ed16aa9af3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanproperties.go @@ -0,0 +1,15 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanProperties struct { + Description *string `json:"description,omitempty"` + ExclusionTag *string `json:"exclusionTag,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` + HostPoolType *ScalingHostPoolType `json:"hostPoolType,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + Schedules *[]ScalingSchedule `json:"schedules,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingschedule.go new file mode 100644 index 0000000000000..313ed8bdf137a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingschedule.go @@ -0,0 +1,25 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingSchedule struct { + DaysOfWeek *[]DaysOfWeek `json:"daysOfWeek,omitempty"` + Name *string `json:"name,omitempty"` + OffPeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"offPeakLoadBalancingAlgorithm,omitempty"` + OffPeakStartTime *Time `json:"offPeakStartTime,omitempty"` + PeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"peakLoadBalancingAlgorithm,omitempty"` + PeakStartTime *Time `json:"peakStartTime,omitempty"` + RampDownCapacityThresholdPct *int64 `json:"rampDownCapacityThresholdPct,omitempty"` + RampDownForceLogoffUsers *bool `json:"rampDownForceLogoffUsers,omitempty"` + RampDownLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampDownLoadBalancingAlgorithm,omitempty"` + RampDownMinimumHostsPct *int64 `json:"rampDownMinimumHostsPct,omitempty"` + RampDownNotificationMessage *string `json:"rampDownNotificationMessage,omitempty"` + RampDownStartTime *Time `json:"rampDownStartTime,omitempty"` + RampDownStopHostsWhen *StopHostsWhen `json:"rampDownStopHostsWhen,omitempty"` + RampDownWaitTimeMinutes *int64 `json:"rampDownWaitTimeMinutes,omitempty"` + RampUpCapacityThresholdPct *int64 `json:"rampUpCapacityThresholdPct,omitempty"` + RampUpLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampUpLoadBalancingAlgorithm,omitempty"` + RampUpMinimumHostsPct *int64 `json:"rampUpMinimumHostsPct,omitempty"` + RampUpStartTime *Time `json:"rampUpStartTime,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_sku.go new file mode 100644 index 0000000000000..364fdaef1a0f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_sku.go @@ -0,0 +1,12 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_time.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_time.go new file mode 100644 index 0000000000000..f9e8b6f4484a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_time.go @@ -0,0 +1,9 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Time struct { + Hour int64 `json:"hour"` + Minute int64 `json:"minute"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/predicates.go new file mode 100644 index 0000000000000..7633debe90664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/predicates.go @@ -0,0 +1,44 @@ +package scalingplan + +type ScalingPlanOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p ScalingPlanOperationPredicate) Matches(input ScalingPlan) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/version.go new file mode 100644 index 0000000000000..577b2cdd7db40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/version.go @@ -0,0 +1,12 @@ +package scalingplan + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/scalingplan/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go new file mode 100644 index 0000000000000..69a79d045fe34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go @@ -0,0 +1,18 @@ +package sessionhost + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostClient struct { + Client autorest.Client + baseUri string +} + +func NewSessionHostClientWithBaseURI(endpoint string) SessionHostClient { + return SessionHostClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/constants.go new file mode 100644 index 0000000000000..ef4b007d663b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/constants.go @@ -0,0 +1,190 @@ +package sessionhost + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthCheckName string + +const ( + HealthCheckNameAppAttachHealthCheck HealthCheckName = "AppAttachHealthCheck" + HealthCheckNameDomainJoinedCheck HealthCheckName = "DomainJoinedCheck" + HealthCheckNameDomainReachable HealthCheckName = "DomainReachable" + HealthCheckNameDomainTrustCheck HealthCheckName = "DomainTrustCheck" + HealthCheckNameFSLogixHealthCheck HealthCheckName = "FSLogixHealthCheck" + HealthCheckNameMetaDataServiceCheck HealthCheckName = "MetaDataServiceCheck" + HealthCheckNameMonitoringAgentCheck HealthCheckName = "MonitoringAgentCheck" + HealthCheckNameSupportedEncryptionCheck HealthCheckName = "SupportedEncryptionCheck" + HealthCheckNameSxSStackListenerCheck HealthCheckName = "SxSStackListenerCheck" + HealthCheckNameUrlsAccessibleCheck HealthCheckName = "UrlsAccessibleCheck" + HealthCheckNameWebRTCRedirectorCheck HealthCheckName = "WebRTCRedirectorCheck" +) + +func PossibleValuesForHealthCheckName() []string { + return []string{ + string(HealthCheckNameAppAttachHealthCheck), + string(HealthCheckNameDomainJoinedCheck), + string(HealthCheckNameDomainReachable), + string(HealthCheckNameDomainTrustCheck), + string(HealthCheckNameFSLogixHealthCheck), + string(HealthCheckNameMetaDataServiceCheck), + string(HealthCheckNameMonitoringAgentCheck), + string(HealthCheckNameSupportedEncryptionCheck), + string(HealthCheckNameSxSStackListenerCheck), + string(HealthCheckNameUrlsAccessibleCheck), + string(HealthCheckNameWebRTCRedirectorCheck), + } +} + +func parseHealthCheckName(input string) (*HealthCheckName, error) { + vals := map[string]HealthCheckName{ + "appattachhealthcheck": HealthCheckNameAppAttachHealthCheck, + "domainjoinedcheck": HealthCheckNameDomainJoinedCheck, + "domainreachable": HealthCheckNameDomainReachable, + "domaintrustcheck": HealthCheckNameDomainTrustCheck, + "fslogixhealthcheck": HealthCheckNameFSLogixHealthCheck, + "metadataservicecheck": HealthCheckNameMetaDataServiceCheck, + "monitoringagentcheck": HealthCheckNameMonitoringAgentCheck, + "supportedencryptioncheck": HealthCheckNameSupportedEncryptionCheck, + "sxsstacklistenercheck": HealthCheckNameSxSStackListenerCheck, + "urlsaccessiblecheck": HealthCheckNameUrlsAccessibleCheck, + "webrtcredirectorcheck": HealthCheckNameWebRTCRedirectorCheck, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthCheckName(input) + return &out, nil +} + +type HealthCheckResult string + +const ( + HealthCheckResultHealthCheckFailed HealthCheckResult = "HealthCheckFailed" + HealthCheckResultHealthCheckSucceeded HealthCheckResult = "HealthCheckSucceeded" + HealthCheckResultSessionHostShutdown HealthCheckResult = "SessionHostShutdown" + HealthCheckResultUnknown HealthCheckResult = "Unknown" +) + +func PossibleValuesForHealthCheckResult() []string { + return []string{ + string(HealthCheckResultHealthCheckFailed), + string(HealthCheckResultHealthCheckSucceeded), + string(HealthCheckResultSessionHostShutdown), + string(HealthCheckResultUnknown), + } +} + +func parseHealthCheckResult(input string) (*HealthCheckResult, error) { + vals := map[string]HealthCheckResult{ + "healthcheckfailed": HealthCheckResultHealthCheckFailed, + "healthchecksucceeded": HealthCheckResultHealthCheckSucceeded, + "sessionhostshutdown": HealthCheckResultSessionHostShutdown, + "unknown": HealthCheckResultUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthCheckResult(input) + return &out, nil +} + +type Status string + +const ( + StatusAvailable Status = "Available" + StatusDisconnected Status = "Disconnected" + StatusDomainTrustRelationshipLost Status = "DomainTrustRelationshipLost" + StatusFSLogixNotHealthy Status = "FSLogixNotHealthy" + StatusNeedsAssistance Status = "NeedsAssistance" + StatusNoHeartbeat Status = "NoHeartbeat" + StatusNotJoinedToDomain Status = "NotJoinedToDomain" + StatusShutdown Status = "Shutdown" + StatusSxSStackListenerNotReady Status = "SxSStackListenerNotReady" + StatusUnavailable Status = "Unavailable" + StatusUpgradeFailed Status = "UpgradeFailed" + StatusUpgrading Status = "Upgrading" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusAvailable), + string(StatusDisconnected), + string(StatusDomainTrustRelationshipLost), + string(StatusFSLogixNotHealthy), + string(StatusNeedsAssistance), + string(StatusNoHeartbeat), + string(StatusNotJoinedToDomain), + string(StatusShutdown), + string(StatusSxSStackListenerNotReady), + string(StatusUnavailable), + string(StatusUpgradeFailed), + string(StatusUpgrading), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "available": StatusAvailable, + "disconnected": StatusDisconnected, + "domaintrustrelationshiplost": StatusDomainTrustRelationshipLost, + "fslogixnothealthy": StatusFSLogixNotHealthy, + "needsassistance": StatusNeedsAssistance, + "noheartbeat": StatusNoHeartbeat, + "notjoinedtodomain": StatusNotJoinedToDomain, + "shutdown": StatusShutdown, + "sxsstacklistenernotready": StatusSxSStackListenerNotReady, + "unavailable": StatusUnavailable, + "upgradefailed": StatusUpgradeFailed, + "upgrading": StatusUpgrading, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type UpdateState string + +const ( + UpdateStateFailed UpdateState = "Failed" + UpdateStateInitial UpdateState = "Initial" + UpdateStatePending UpdateState = "Pending" + UpdateStateStarted UpdateState = "Started" + UpdateStateSucceeded UpdateState = "Succeeded" +) + +func PossibleValuesForUpdateState() []string { + return []string{ + string(UpdateStateFailed), + string(UpdateStateInitial), + string(UpdateStatePending), + string(UpdateStateStarted), + string(UpdateStateSucceeded), + } +} + +func parseUpdateState(input string) (*UpdateState, error) { + vals := map[string]UpdateState{ + "failed": UpdateStateFailed, + "initial": UpdateStateInitial, + "pending": UpdateStatePending, + "started": UpdateStateStarted, + "succeeded": UpdateStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go new file mode 100644 index 0000000000000..b42dea32fb03c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go @@ -0,0 +1,124 @@ +package sessionhost + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostPoolId{} + +// HostPoolId is a struct representing the Resource ID for a Host Pool +type HostPoolId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string +} + +// NewHostPoolID returns a new HostPoolId struct +func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId { + return HostPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + } +} + +// ParseHostPoolID parses 'input' into a HostPoolId +func ParseHostPoolID(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostPoolIDInsensitively parses 'input' case-insensitively into a HostPoolId +// note: this method should only be used for API response data and not user input +func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID +func ValidateHostPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Pool ID +func (id HostPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID +func (id HostPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + } +} + +// String returns a human-readable description of this Host Pool ID +func (id HostPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + } + return fmt.Sprintf("Host Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go new file mode 100644 index 0000000000000..cd3fe90122cf1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go @@ -0,0 +1,137 @@ +package sessionhost + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SessionHostId{} + +// SessionHostId is a struct representing the Resource ID for a Session Host +type SessionHostId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string + SessionHostName string +} + +// NewSessionHostID returns a new SessionHostId struct +func NewSessionHostID(subscriptionId string, resourceGroupName string, hostPoolName string, sessionHostName string) SessionHostId { + return SessionHostId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + SessionHostName: sessionHostName, + } +} + +// ParseSessionHostID parses 'input' into a SessionHostId +func ParseSessionHostID(input string) (*SessionHostId, error) { + parser := resourceids.NewParserFromResourceIdType(SessionHostId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SessionHostId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { + return nil, fmt.Errorf("the segment 'sessionHostName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSessionHostIDInsensitively parses 'input' case-insensitively into a SessionHostId +// note: this method should only be used for API response data and not user input +func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { + parser := resourceids.NewParserFromResourceIdType(SessionHostId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SessionHostId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { + return nil, fmt.Errorf("the segment 'sessionHostName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID +func ValidateSessionHostID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSessionHostID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Session Host ID +func (id SessionHostId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s/sessionHosts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName, id.SessionHostName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Session Host ID +func (id SessionHostId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + resourceids.StaticSegment("staticSessionHosts", "sessionHosts", "sessionHosts"), + resourceids.UserSpecifiedSegment("sessionHostName", "sessionHostValue"), + } +} + +// String returns a human-readable description of this Session Host ID +func (id SessionHostId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + fmt.Sprintf("Session Host Name: %q", id.SessionHostName), + } + return fmt.Sprintf("Session Host (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_delete_autorest.go new file mode 100644 index 0000000000000..3eb9fdf7cf7b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_delete_autorest.go @@ -0,0 +1,94 @@ +package sessionhost + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + Force *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Delete ... +func (c SessionHostClient) Delete(ctx context.Context, id SessionHostId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SessionHostClient) preparerForDelete(ctx context.Context, id SessionHostId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_get_autorest.go new file mode 100644 index 0000000000000..e28f5b328c624 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_get_autorest.go @@ -0,0 +1,67 @@ +package sessionhost + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SessionHost +} + +// Get ... +func (c SessionHostClient) Get(ctx context.Context, id SessionHostId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SessionHostClient) preparerForGet(ctx context.Context, id SessionHostId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_list_autorest.go new file mode 100644 index 0000000000000..5d42759afa686 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_list_autorest.go @@ -0,0 +1,186 @@ +package sessionhost + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]SessionHost + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []SessionHost +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c SessionHostClient) List(ctx context.Context, id HostPoolId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c SessionHostClient) ListComplete(ctx context.Context, id HostPoolId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SessionHostOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SessionHostClient) ListCompleteMatchingPredicate(ctx context.Context, id HostPoolId, predicate SessionHostOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]SessionHost, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c SessionHostClient) preparerForList(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/sessionHosts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c SessionHostClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []SessionHost `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_update_autorest.go new file mode 100644 index 0000000000000..8036bc4eb720b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_update_autorest.go @@ -0,0 +1,97 @@ +package sessionhost + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *SessionHost +} + +type UpdateOperationOptions struct { + Force *bool +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Update ... +func (c SessionHostClient) Update(ctx context.Context, id SessionHostId, input SessionHostPatch, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c SessionHostClient) preparerForUpdate(ctx context.Context, id SessionHostId, input SessionHostPatch, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhost.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhost.go new file mode 100644 index 0000000000000..6a59b593c4cd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhost.go @@ -0,0 +1,16 @@ +package sessionhost + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHost struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SessionHostProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckfailuredetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckfailuredetails.go new file mode 100644 index 0000000000000..e2430e721a249 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckfailuredetails.go @@ -0,0 +1,28 @@ +package sessionhost + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostHealthCheckFailureDetails struct { + ErrorCode *int64 `json:"errorCode,omitempty"` + LastHealthCheckDateTime *string `json:"lastHealthCheckDateTime,omitempty"` + Message *string `json:"message,omitempty"` +} + +func (o *SessionHostHealthCheckFailureDetails) GetLastHealthCheckDateTimeAsTime() (*time.Time, error) { + if o.LastHealthCheckDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastHealthCheckDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostHealthCheckFailureDetails) SetLastHealthCheckDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastHealthCheckDateTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckreport.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckreport.go new file mode 100644 index 0000000000000..6545cf0a0386b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckreport.go @@ -0,0 +1,10 @@ +package sessionhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostHealthCheckReport struct { + AdditionalFailureDetails *SessionHostHealthCheckFailureDetails `json:"additionalFailureDetails,omitempty"` + HealthCheckName *HealthCheckName `json:"healthCheckName,omitempty"` + HealthCheckResult *HealthCheckResult `json:"healthCheckResult,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatch.go new file mode 100644 index 0000000000000..f8fa6a576244b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatch.go @@ -0,0 +1,11 @@ +package sessionhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostPatch struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SessionHostPatchProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatchproperties.go new file mode 100644 index 0000000000000..11eecb2240bcf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatchproperties.go @@ -0,0 +1,9 @@ +package sessionhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostPatchProperties struct { + AllowNewSession *bool `json:"allowNewSession,omitempty"` + AssignedUser *string `json:"assignedUser,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostproperties.go new file mode 100644 index 0000000000000..71f9dc987b979 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostproperties.go @@ -0,0 +1,65 @@ +package sessionhost + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostProperties struct { + AgentVersion *string `json:"agentVersion,omitempty"` + AllowNewSession *bool `json:"allowNewSession,omitempty"` + AssignedUser *string `json:"assignedUser,omitempty"` + LastHeartBeat *string `json:"lastHeartBeat,omitempty"` + LastUpdateTime *string `json:"lastUpdateTime,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + SessionHostHealthCheckResults *[]SessionHostHealthCheckReport `json:"sessionHostHealthCheckResults,omitempty"` + Sessions *int64 `json:"sessions,omitempty"` + Status *Status `json:"status,omitempty"` + StatusTimestamp *string `json:"statusTimestamp,omitempty"` + SxSStackVersion *string `json:"sxSStackVersion,omitempty"` + UpdateErrorMessage *string `json:"updateErrorMessage,omitempty"` + UpdateState *UpdateState `json:"updateState,omitempty"` + VirtualMachineId *string `json:"virtualMachineId,omitempty"` +} + +func (o *SessionHostProperties) GetLastHeartBeatAsTime() (*time.Time, error) { + if o.LastHeartBeat == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastHeartBeat, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostProperties) SetLastHeartBeatAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastHeartBeat = &formatted +} + +func (o *SessionHostProperties) GetLastUpdateTimeAsTime() (*time.Time, error) { + if o.LastUpdateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostProperties) SetLastUpdateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdateTime = &formatted +} + +func (o *SessionHostProperties) GetStatusTimestampAsTime() (*time.Time, error) { + if o.StatusTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StatusTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostProperties) SetStatusTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StatusTimestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/predicates.go new file mode 100644 index 0000000000000..e1112a03be00d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/predicates.go @@ -0,0 +1,24 @@ +package sessionhost + +type SessionHostOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SessionHostOperationPredicate) Matches(input SessionHost) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/version.go new file mode 100644 index 0000000000000..a9a312570dfc1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/version.go @@ -0,0 +1,12 @@ +package sessionhost + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sessionhost/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go new file mode 100644 index 0000000000000..57fd58240e094 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go @@ -0,0 +1,18 @@ +package workspace + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkspaceClientWithBaseURI(endpoint string) WorkspaceClient { + return WorkspaceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/constants.go new file mode 100644 index 0000000000000..d2244015bc220 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/constants.go @@ -0,0 +1,68 @@ +package workspace + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go new file mode 100644 index 0000000000000..90f00ab2c3147 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go @@ -0,0 +1,124 @@ +package workspace + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_createorupdate_autorest.go new file mode 100644 index 0000000000000..2dfa75cfe3152 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_createorupdate_autorest.go @@ -0,0 +1,68 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// CreateOrUpdate ... +func (c WorkspaceClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c WorkspaceClient) preparerForCreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_delete_autorest.go new file mode 100644 index 0000000000000..dceeb977a12e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_delete_autorest.go @@ -0,0 +1,65 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c WorkspaceClient) Delete(ctx context.Context, id WorkspaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c WorkspaceClient) preparerForDelete(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_get_autorest.go new file mode 100644 index 0000000000000..93915990f1cee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_get_autorest.go @@ -0,0 +1,67 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Get ... +func (c WorkspaceClient) Get(ctx context.Context, id WorkspaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkspaceClient) preparerForGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbyresourcegroup_autorest.go new file mode 100644 index 0000000000000..426896e954186 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package workspace + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Workspace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c WorkspaceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c WorkspaceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspaceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WorkspaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c WorkspaceClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c WorkspaceClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbysubscription_autorest.go new file mode 100644 index 0000000000000..6ab5742aa3f6d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package workspace + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Workspace +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c WorkspaceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c WorkspaceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspaceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate WorkspaceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c WorkspaceClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c WorkspaceClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_update_autorest.go new file mode 100644 index 0000000000000..d822ab589a658 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_update_autorest.go @@ -0,0 +1,68 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Update ... +func (c WorkspaceClient) Update(ctx context.Context, id WorkspaceId, input WorkspacePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c WorkspaceClient) preparerForUpdate(ctx context.Context, id WorkspaceId, input WorkspacePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_plan.go new file mode 100644 index 0000000000000..5fb713a75feb8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_plan.go @@ -0,0 +1,12 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_sku.go new file mode 100644 index 0000000000000..8b18e233d75ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_sku.go @@ -0,0 +1,12 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspace.go new file mode 100644 index 0000000000000..6b48aa9873788 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspace.go @@ -0,0 +1,25 @@ +package workspace + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workspace struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *WorkspaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatch.go new file mode 100644 index 0000000000000..1ac870f647e56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatch.go @@ -0,0 +1,9 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePatch struct { + Properties *WorkspacePatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatchproperties.go new file mode 100644 index 0000000000000..3f010914b6500 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatchproperties.go @@ -0,0 +1,11 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePatchProperties struct { + ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspaceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspaceproperties.go new file mode 100644 index 0000000000000..8c39ae8289bb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspaceproperties.go @@ -0,0 +1,13 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProperties struct { + ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` + CloudPcResource *bool `json:"cloudPcResource,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/predicates.go new file mode 100644 index 0000000000000..232537375c96a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/predicates.go @@ -0,0 +1,44 @@ +package workspace + +type WorkspaceOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p WorkspaceOperationPredicate) Matches(input Workspace) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/version.go new file mode 100644 index 0000000000000..2337ea8938f7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/version.go @@ -0,0 +1,12 @@ +package workspace + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workspace/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0c2a3f97589d3..69bd1cd99a974 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -67,7 +67,6 @@ github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-0 github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders -github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights @@ -223,6 +222,13 @@ github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attest github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis # github.com/hashicorp/go-checkpoint v0.5.0