From 0163d4f504cd6617cf82647d37979dfec6d1b472 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 21 Jan 2021 01:50:18 +0000 Subject: [PATCH] CodeGen from PR 11937 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.AzureStack to add version stable/2017-06-01 (#11937) * added default error response where missing and fixed camel case action names * removed readonly properties from examples * removed more readonly properties from examples * remove hard-coded product name from swagger action * added enable remote management action * ran npm prettier on new jsong files * moved remote management action to registrations --- .../mgmt/2017-06-01/azurestack/CHANGELOG.md | 27 +++++++- .../azurestack/azurestackapi/interfaces.go | 3 +- .../mgmt/2017-06-01/azurestack/products.go | 12 ++-- .../2017-06-01/azurestack/registrations.go | 69 +++++++++++++++++++ 4 files changed, 102 insertions(+), 9 deletions(-) diff --git a/services/azurestack/mgmt/2017-06-01/azurestack/CHANGELOG.md b/services/azurestack/mgmt/2017-06-01/azurestack/CHANGELOG.md index 28035c04faf5..82ee93a14aa6 100644 --- a/services/azurestack/mgmt/2017-06-01/azurestack/CHANGELOG.md +++ b/services/azurestack/mgmt/2017-06-01/azurestack/CHANGELOG.md @@ -1,5 +1,26 @@ -Generated from https://github.com/Azure/azure-rest-api-specs/tree/3c764635e7d442b3e74caf593029fcd440b3ef82/specification/azurestack/resource-manager/readme.md tag: `package-2017-06-01` +Generated from https://github.com/Azure/azure-rest-api-specs/tree/../../../../../azure-rest-api-specs/specification/azurestack/resource-manager/readme.md tag: `package-2017-06-01` -Code generator @microsoft.azure/autorest.go@2.1.168 +Code generator -No exported changes \ No newline at end of file + +### Breaking Changes + +### Signature Changes + +#### Funcs + +1. ProductsClient.GetProducts + - Params + - From: context.Context, string, string, *DeviceConfiguration + - To: context.Context, string, string, string, *DeviceConfiguration +1. ProductsClient.GetProductsPreparer + - Params + - From: context.Context, string, string, *DeviceConfiguration + - To: context.Context, string, string, string, *DeviceConfiguration + +#### New Funcs + +1. RegistrationsClient.EnableRemoteManagement(context.Context, string, string) (autorest.Response, error) +1. RegistrationsClient.EnableRemoteManagementPreparer(context.Context, string, string) (*http.Request, error) +1. RegistrationsClient.EnableRemoteManagementResponder(*http.Response) (autorest.Response, error) +1. RegistrationsClient.EnableRemoteManagementSender(*http.Request) (*http.Response, error) diff --git a/services/azurestack/mgmt/2017-06-01/azurestack/azurestackapi/interfaces.go b/services/azurestack/mgmt/2017-06-01/azurestack/azurestackapi/interfaces.go index 6410a37865c9..e87610970c2d 100644 --- a/services/azurestack/mgmt/2017-06-01/azurestack/azurestackapi/interfaces.go +++ b/services/azurestack/mgmt/2017-06-01/azurestack/azurestackapi/interfaces.go @@ -43,7 +43,7 @@ var _ CloudManifestFileClientAPI = (*azurestack.CloudManifestFileClient)(nil) type ProductsClientAPI interface { Get(ctx context.Context, resourceGroup string, registrationName string, productName string) (result azurestack.Product, err error) GetProduct(ctx context.Context, resourceGroup string, registrationName string, productName string, deviceConfiguration *azurestack.DeviceConfiguration) (result azurestack.Product, err error) - GetProducts(ctx context.Context, resourceGroup string, registrationName string, deviceConfiguration *azurestack.DeviceConfiguration) (result azurestack.ProductList, err error) + GetProducts(ctx context.Context, resourceGroup string, registrationName string, productName string, deviceConfiguration *azurestack.DeviceConfiguration) (result azurestack.ProductList, err error) List(ctx context.Context, resourceGroup string, registrationName string) (result azurestack.ProductListPage, err error) ListComplete(ctx context.Context, resourceGroup string, registrationName string) (result azurestack.ProductListIterator, err error) ListDetails(ctx context.Context, resourceGroup string, registrationName string, productName string) (result azurestack.ExtendedProduct, err error) @@ -56,6 +56,7 @@ var _ ProductsClientAPI = (*azurestack.ProductsClient)(nil) type RegistrationsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroup string, registrationName string, tokenParameter azurestack.RegistrationParameter) (result azurestack.Registration, err error) Delete(ctx context.Context, resourceGroup string, registrationName string) (result autorest.Response, err error) + EnableRemoteManagement(ctx context.Context, resourceGroup string, registrationName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroup string, registrationName string) (result azurestack.Registration, err error) GetActivationKey(ctx context.Context, resourceGroup string, registrationName string) (result azurestack.ActivationKeyResult, err error) List(ctx context.Context, resourceGroup string) (result azurestack.RegistrationListPage, err error) diff --git a/services/azurestack/mgmt/2017-06-01/azurestack/products.go b/services/azurestack/mgmt/2017-06-01/azurestack/products.go index 437e7ca7ee48..861f90ceba29 100644 --- a/services/azurestack/mgmt/2017-06-01/azurestack/products.go +++ b/services/azurestack/mgmt/2017-06-01/azurestack/products.go @@ -178,7 +178,7 @@ func (client ProductsClient) GetProductPreparer(ctx context.Context, resourceGro autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/GetProduct", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct", pathParameters), autorest.WithQueryParameters(queryParameters)) if deviceConfiguration != nil { preparer = autorest.DecoratePreparer(preparer, @@ -209,8 +209,9 @@ func (client ProductsClient) GetProductResponder(resp *http.Response) (result Pr // Parameters: // resourceGroup - name of the resource group. // registrationName - name of the Azure Stack registration. +// productName - name of the product. // deviceConfiguration - device configuration. -func (client ProductsClient) GetProducts(ctx context.Context, resourceGroup string, registrationName string, deviceConfiguration *DeviceConfiguration) (result ProductList, err error) { +func (client ProductsClient) GetProducts(ctx context.Context, resourceGroup string, registrationName string, productName string, deviceConfiguration *DeviceConfiguration) (result ProductList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.GetProducts") defer func() { @@ -221,7 +222,7 @@ func (client ProductsClient) GetProducts(ctx context.Context, resourceGroup stri tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetProductsPreparer(ctx, resourceGroup, registrationName, deviceConfiguration) + req, err := client.GetProductsPreparer(ctx, resourceGroup, registrationName, productName, deviceConfiguration) if err != nil { err = autorest.NewErrorWithError(err, "azurestack.ProductsClient", "GetProducts", nil, "Failure preparing request") return @@ -244,8 +245,9 @@ func (client ProductsClient) GetProducts(ctx context.Context, resourceGroup stri } // GetProductsPreparer prepares the GetProducts request. -func (client ProductsClient) GetProductsPreparer(ctx context.Context, resourceGroup string, registrationName string, deviceConfiguration *DeviceConfiguration) (*http.Request, error) { +func (client ProductsClient) GetProductsPreparer(ctx context.Context, resourceGroup string, registrationName string, productName string, deviceConfiguration *DeviceConfiguration) (*http.Request, error) { pathParameters := map[string]interface{}{ + "productName": autorest.Encode("path", productName), "registrationName": autorest.Encode("path", registrationName), "resourceGroup": autorest.Encode("path", resourceGroup), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -262,7 +264,7 @@ func (client ProductsClient) GetProductsPreparer(ctx context.Context, resourceGr autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/_all/GetProducts", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts", pathParameters), autorest.WithQueryParameters(queryParameters)) if deviceConfiguration != nil { preparer = autorest.DecoratePreparer(preparer, diff --git a/services/azurestack/mgmt/2017-06-01/azurestack/registrations.go b/services/azurestack/mgmt/2017-06-01/azurestack/registrations.go index f95fd04a3806..64d87372110d 100644 --- a/services/azurestack/mgmt/2017-06-01/azurestack/registrations.go +++ b/services/azurestack/mgmt/2017-06-01/azurestack/registrations.go @@ -204,6 +204,75 @@ func (client RegistrationsClient) DeleteResponder(resp *http.Response) (result a return } +// EnableRemoteManagement enables remote management for device under the Azure Stack registration. +// Parameters: +// resourceGroup - name of the resource group. +// registrationName - name of the Azure Stack registration. +func (client RegistrationsClient) EnableRemoteManagement(ctx context.Context, resourceGroup string, registrationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationsClient.EnableRemoteManagement") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableRemoteManagementPreparer(ctx, resourceGroup, registrationName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestack.RegistrationsClient", "EnableRemoteManagement", nil, "Failure preparing request") + return + } + + resp, err := client.EnableRemoteManagementSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "azurestack.RegistrationsClient", "EnableRemoteManagement", resp, "Failure sending request") + return + } + + result, err = client.EnableRemoteManagementResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestack.RegistrationsClient", "EnableRemoteManagement", resp, "Failure responding to request") + return + } + + return +} + +// EnableRemoteManagementPreparer prepares the EnableRemoteManagement request. +func (client RegistrationsClient) EnableRemoteManagementPreparer(ctx context.Context, resourceGroup string, registrationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registrationName": autorest.Encode("path", registrationName), + "resourceGroup": autorest.Encode("path", resourceGroup), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableRemoteManagementSender sends the EnableRemoteManagement request. The method will close the +// http.Response Body if it receives an error. +func (client RegistrationsClient) EnableRemoteManagementSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableRemoteManagementResponder handles the response to the EnableRemoteManagement request. The method always +// closes the http.Response Body. +func (client RegistrationsClient) EnableRemoteManagementResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + // Get returns the properties of an Azure Stack registration. // Parameters: // resourceGroup - name of the resource group.