diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md b/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md index ae1e03374653..25c11a30a849 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 0.7.0 (Unreleased) + +### Breaking Changes + +* The `acceptLanguage` parameter has been moved out of client constructors and into each method's options type. + ## 0.6.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md b/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md index 7f5807d3d25c..a9e8a5feba72 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md @@ -8,6 +8,10 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/readme.md - https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.6.1 +module-version: 0.7.0 -``` \ No newline at end of file +directive: + - from: swagger-document + where: $.parameters.Accept-Language + transform: $['x-ms-parameter-location'] = "method" +``` diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go index 3bf6558afeb6..197ded708bdc 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport @@ -26,22 +25,19 @@ import ( type BitLockerKeysClient struct { internal *arm.Client subscriptionID string - acceptLanguage *string } // NewBitLockerKeysClient creates a new instance of BitLockerKeysClient with the specified values. // - subscriptionID - The subscription ID for the Azure user. -// - acceptLanguage - Specifies the preferred language for the response. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewBitLockerKeysClient(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BitLockerKeysClient, error) { +func NewBitLockerKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BitLockerKeysClient, error) { cl, err := arm.NewClient(moduleName+".BitLockerKeysClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &BitLockerKeysClient{ subscriptionID: subscriptionID, - acceptLanguage: acceptLanguage, internal: cl, } return client, nil @@ -97,8 +93,8 @@ func (client *BitLockerKeysClient) listCreateRequest(ctx context.Context, jobNam reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go index 0525bcfa9258..5487effb79b1 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go @@ -24,7 +24,7 @@ func ExampleBitLockerKeysClient_NewListPager() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go index fa16b73cce2b..ab4810278683 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport @@ -18,7 +17,6 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - acceptLanguage *string credential azcore.TokenCredential options *arm.ClientOptions } @@ -26,36 +24,35 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. // - subscriptionID - The subscription ID for the Azure user. -// - acceptLanguage - Specifies the preferred language for the response. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewClientFactory(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, acceptLanguage: acceptLanguage, credential: credential, + subscriptionID: subscriptionID, credential: credential, options: options.Clone(), }, nil } -func (c *ClientFactory) NewLocationsClient() *LocationsClient { - subClient, _ := NewLocationsClient(c.acceptLanguage, c.credential, c.options) +func (c *ClientFactory) NewBitLockerKeysClient() *BitLockerKeysClient { + subClient, _ := NewBitLockerKeysClient(c.subscriptionID, c.credential, c.options) return subClient } func (c *ClientFactory) NewJobsClient() *JobsClient { - subClient, _ := NewJobsClient(c.subscriptionID, c.acceptLanguage, c.credential, c.options) + subClient, _ := NewJobsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBitLockerKeysClient() *BitLockerKeysClient { - subClient, _ := NewBitLockerKeysClient(c.subscriptionID, c.acceptLanguage, c.credential, c.options) +func (c *ClientFactory) NewLocationsClient() *LocationsClient { + subClient, _ := NewLocationsClient(c.credential, c.options) return subClient } func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.acceptLanguage, c.credential, c.options) + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go index 728a189af918..a1ad87813e10 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport const ( moduleName = "armstorageimportexport" - moduleVersion = "v0.6.1" + moduleVersion = "v0.7.0" ) // CreatedByType - The type of identity that created the resource. diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go index b6ee56a327fe..b8578c1627c0 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport @@ -27,22 +26,19 @@ import ( type JobsClient struct { internal *arm.Client subscriptionID string - acceptLanguage *string } // NewJobsClient creates a new instance of JobsClient with the specified values. // - subscriptionID - The subscription ID for the Azure user. -// - acceptLanguage - Specifies the preferred language for the response. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewJobsClient(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { cl, err := arm.NewClient(moduleName+".JobsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &JobsClient{ subscriptionID: subscriptionID, - acceptLanguage: acceptLanguage, internal: cl, } return client, nil @@ -57,18 +53,21 @@ func NewJobsClient(subscriptionID string, acceptLanguage *string, credential azc // - body - The parameters used for creating the job // - options - JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method. func (client *JobsClient) Create(ctx context.Context, jobName string, resourceGroupName string, body PutJobParameters, options *JobsClientCreateOptions) (JobsClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, jobName, resourceGroupName, body, options) if err != nil { return JobsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return JobsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return JobsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -93,14 +92,17 @@ func (client *JobsClient) createCreateRequest(ctx context.Context, jobName strin reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } if options != nil && options.ClientTenantID != nil { req.Raw().Header["x-ms-client-tenant-id"] = []string{*options.ClientTenantID} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -120,16 +122,18 @@ func (client *JobsClient) createHandleResponse(resp *http.Response) (JobsClientC // - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. // - options - JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. func (client *JobsClient) Delete(ctx context.Context, jobName string, resourceGroupName string, options *JobsClientDeleteOptions) (JobsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, jobName, resourceGroupName, options) if err != nil { return JobsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobsClientDeleteResponse{}, err } return JobsClientDeleteResponse{}, nil } @@ -156,8 +160,8 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, jobName strin reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,18 +175,21 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, jobName strin // - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. // - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. func (client *JobsClient) Get(ctx context.Context, jobName string, resourceGroupName string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, jobName, resourceGroupName, options) if err != nil { return JobsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -207,8 +214,8 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, jobName string, reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,8 +288,8 @@ func (client *JobsClient) listByResourceGroupCreateRequest(ctx context.Context, } reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,8 +357,8 @@ func (client *JobsClient) listBySubscriptionCreateRequest(ctx context.Context, o } reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,18 +384,21 @@ func (client *JobsClient) listBySubscriptionHandleResponse(resp *http.Response) // - body - The parameters to update in the job // - options - JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method. func (client *JobsClient) Update(ctx context.Context, jobName string, resourceGroupName string, body UpdateJobParameters, options *JobsClientUpdateOptions) (JobsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, jobName, resourceGroupName, body, options) if err != nil { return JobsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -413,11 +423,14 @@ func (client *JobsClient) updateCreateRequest(ctx context.Context, jobName strin reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go index 190b99a16da4..0a7dd2506dba 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go @@ -25,7 +25,7 @@ func ExampleJobsClient_NewListBySubscriptionPager() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -194,7 +194,7 @@ func ExampleJobsClient_NewListByResourceGroupPager() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -286,7 +286,7 @@ func ExampleJobsClient_Get_getExportJob() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -370,7 +370,7 @@ func ExampleJobsClient_Get_getImportJob() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -454,7 +454,7 @@ func ExampleJobsClient_Update_updateExportJob() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -542,7 +542,7 @@ func ExampleJobsClient_Update_updateImportJob() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -632,7 +632,7 @@ func ExampleJobsClient_Create_createExportJob() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -744,7 +744,7 @@ func ExampleJobsClient_Create_createImportJob() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -860,7 +860,7 @@ func ExampleJobsClient_Delete() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go index 74dba45dd410..1ba2a66ba237 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport @@ -24,22 +23,19 @@ import ( // LocationsClient contains the methods for the Locations group. // Don't use this type directly, use NewLocationsClient() instead. type LocationsClient struct { - internal *arm.Client - acceptLanguage *string + internal *arm.Client } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -// - acceptLanguage - Specifies the preferred language for the response. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewLocationsClient(acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { +func NewLocationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { cl, err := arm.NewClient(moduleName+".LocationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &LocationsClient{ - acceptLanguage: acceptLanguage, - internal: cl, + internal: cl, } return client, nil } @@ -52,18 +48,21 @@ func NewLocationsClient(acceptLanguage *string, credential azcore.TokenCredentia // - locationName - The name of the location. For example, West US or westus. // - options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. func (client *LocationsClient) Get(ctx context.Context, locationName string, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, options) if err != nil { return LocationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LocationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -80,8 +79,8 @@ func (client *LocationsClient) getCreateRequest(ctx context.Context, locationNam reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -133,8 +132,8 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, options *L reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go index 265dbd265cab..480c2ebbcaf0 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go @@ -24,7 +24,7 @@ func ExampleLocationsClient_NewListPager() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -92,7 +92,7 @@ func ExampleLocationsClient_Get() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go index 03134aa85557..86cc321a00be 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go @@ -3,18 +3,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport import "time" -// BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.NewListPager method. -type BitLockerKeysClientListOptions struct { -} - // DeliveryPackageInformation - Contains information about the delivery package being shipped by the customer to the Microsoft // data center. type DeliveryPackageInformation struct { @@ -256,43 +251,6 @@ type JobResponse struct { Type *string } -// JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method. -type JobsClientCreateOptions struct { - // The tenant ID of the client making the request. - ClientTenantID *string -} - -// JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. -type JobsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. -type JobsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager method. -type JobsClientListByResourceGroupOptions struct { - // Can be used to restrict the results to certain conditions. - Filter *string - // An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. - Top *int64 -} - -// JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager method. -type JobsClientListBySubscriptionOptions struct { - // Can be used to restrict the results to certain conditions. - Filter *string - // An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. - Top *int64 -} - -// JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method. -type JobsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // ListJobsResponse - List jobs response type ListJobsResponse struct { // link to next batch of jobs @@ -361,15 +319,6 @@ type LocationProperties struct { SupportedCarriers []*string } -// LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. -type LocationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. -type LocationsClientListOptions struct { -} - // LocationsResponse - Locations response type LocationsResponse struct { // locations @@ -400,10 +349,6 @@ type OperationDisplay struct { Resource *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { -} - // PackageInformation - Contains information about the package being shipped by the customer to the Microsoft data center. type PackageInformation struct { // REQUIRED; The name of the carrier that is used to ship the import or export drives. diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go index 860506fa72f2..99ffa7f64a6e 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go index c83343a7be88..96864c881bde 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport @@ -21,22 +20,19 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - internal *arm.Client - acceptLanguage *string + internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// - acceptLanguage - Specifies the preferred language for the response. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewOperationsClient(acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - acceptLanguage: acceptLanguage, - internal: cl, + internal: cl, } return client, nil } @@ -77,8 +73,8 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - if client.acceptLanguage != nil { - req.Raw().Header["Accept-Language"] = []string{*client.acceptLanguage} + if options != nil && options.AcceptLanguage != nil { + req.Raw().Header["Accept-Language"] = []string{*options.AcceptLanguage} } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go index 8c630ac18a80..cb09088dd28b 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go @@ -24,7 +24,7 @@ func ExampleOperationsClient_NewListPager() { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + clientFactory, err := armstorageimportexport.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/options.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/options.go new file mode 100644 index 000000000000..3a76e3b243a4 --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/options.go @@ -0,0 +1,84 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorageimportexport + +// BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.NewListPager method. +type BitLockerKeysClientListOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} + +// JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method. +type JobsClientCreateOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string + + // The tenant ID of the client making the request. + ClientTenantID *string +} + +// JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. +type JobsClientDeleteOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} + +// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +type JobsClientGetOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} + +// JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager method. +type JobsClientListByResourceGroupOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string + + // Can be used to restrict the results to certain conditions. + Filter *string + + // An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + Top *int64 +} + +// JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager method. +type JobsClientListBySubscriptionOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string + + // Can be used to restrict the results to certain conditions. + Filter *string + + // An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + Top *int64 +} + +// JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method. +type JobsClientUpdateOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} + +// LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. +type LocationsClientGetOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} + +// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. +type LocationsClientListOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // Specifies the preferred language for the response. + AcceptLanguage *string +} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go index 9d00fbcf4913..97a332ea5703 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go @@ -3,19 +3,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport // BitLockerKeysClientListResponse contains the response from method BitLockerKeysClient.NewListPager. type BitLockerKeysClientListResponse struct { + // GetBitLockerKeys response GetBitLockerKeysResponse } // JobsClientCreateResponse contains the response from method JobsClient.Create. type JobsClientCreateResponse struct { + // Contains the job information. JobResponse } @@ -26,35 +27,42 @@ type JobsClientDeleteResponse struct { // JobsClientGetResponse contains the response from method JobsClient.Get. type JobsClientGetResponse struct { + // Contains the job information. JobResponse } // JobsClientListByResourceGroupResponse contains the response from method JobsClient.NewListByResourceGroupPager. type JobsClientListByResourceGroupResponse struct { + // List jobs response ListJobsResponse } // JobsClientListBySubscriptionResponse contains the response from method JobsClient.NewListBySubscriptionPager. type JobsClientListBySubscriptionResponse struct { + // List jobs response ListJobsResponse } // JobsClientUpdateResponse contains the response from method JobsClient.Update. type JobsClientUpdateResponse struct { + // Contains the job information. JobResponse } // LocationsClientGetResponse contains the response from method LocationsClient.Get. type LocationsClientGetResponse struct { + // Provides information about an Azure data center location. Location } // LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { + // Locations response LocationsResponse } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // List operations response ListOperationsResponse } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go index 4ba2f79b07ac..d53cd0090908 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armstorageimportexport