From 60e91b142d5935b0b8993deabd2fc08858322e60 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 27 Sep 2023 18:25:04 +0000 Subject: [PATCH] CodeGen from PR 25990 in Azure/azure-rest-api-specs Merge 0a29e425902a227cc2e0ee6bfad2fef36e7aa7fa into 5a87d16c995b295007087d9a0b3a5050d3eeb22d --- .../sphere/armsphere/CHANGELOG.md | 4 + .../sphere/armsphere/autorest.md | 7 +- .../sphere/armsphere/catalogs_client.go | 77 ++-- .../armsphere/catalogs_client_example_test.go | 407 ------------------ .../sphere/armsphere/certificates_client.go | 41 +- .../certificates_client_example_test.go | 122 ------ .../sphere/armsphere/client_factory.go | 33 +- .../sphere/armsphere/constants.go | 5 +- .../sphere/armsphere/deployments_client.go | 45 +- .../deployments_client_example_test.go | 173 -------- .../sphere/armsphere/devicegroups_client.go | 92 ++-- .../devicegroups_client_example_test.go | 230 ---------- .../sphere/armsphere/devices_client.go | 81 ++-- .../armsphere/devices_client_example_test.go | 205 --------- sdk/resourcemanager/sphere/armsphere/go.mod | 14 +- sdk/resourcemanager/sphere/armsphere/go.sum | 26 +- .../sphere/armsphere/images_client.go | 45 +- .../armsphere/images_client_example_test.go | 135 ------ .../sphere/armsphere/models.go | 311 +------------ .../sphere/armsphere/models_serde.go | 3 +- .../sphere/armsphere/operations_client.go | 3 +- .../operations_client_example_test.go | 64 --- .../sphere/armsphere/options.go | 341 +++++++++++++++ .../sphere/armsphere/products_client.go | 74 ++-- .../armsphere/products_client_example_test.go | 235 ---------- .../sphere/armsphere/response_types.go | 40 +- .../sphere/armsphere/time_rfc3339.go | 3 +- 27 files changed, 706 insertions(+), 2110 deletions(-) delete mode 100644 sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/images_client_example_test.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go create mode 100644 sdk/resourcemanager/sphere/armsphere/options.go delete mode 100644 sdk/resourcemanager/sphere/armsphere/products_client_example_test.go diff --git a/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md b/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md index 99f6f9f0aff2..8d89c5b06bcc 100644 --- a/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md +++ b/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2023-09-27) +### Other Changes + + ## 0.1.0 (2023-07-28) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/sphere/armsphere/autorest.md b/sdk/resourcemanager/sphere/armsphere/autorest.md index d521ba44a301..944a9ebb66ab 100644 --- a/sdk/resourcemanager/sphere/armsphere/autorest.md +++ b/sdk/resourcemanager/sphere/armsphere/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sphere/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sphere/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-2022-09-01-preview +module-version: 0.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sphere/armsphere/catalogs_client.go b/sdk/resourcemanager/sphere/armsphere/catalogs_client.go index a1b2bb720efe..382cac3468eb 100644 --- a/sdk/resourcemanager/sphere/armsphere/catalogs_client.go +++ b/sdk/resourcemanager/sphere/armsphere/catalogs_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 armsphere @@ -53,18 +52,21 @@ func NewCatalogsClient(subscriptionID string, credential azcore.TokenCredential, // - catalogName - Name of catalog // - options - CatalogsClientCountDevicesOptions contains the optional parameters for the CatalogsClient.CountDevices method. func (client *CatalogsClient) CountDevices(ctx context.Context, resourceGroupName string, catalogName string, options *CatalogsClientCountDevicesOptions) (CatalogsClientCountDevicesResponse, error) { + var err error req, err := client.countDevicesCreateRequest(ctx, resourceGroupName, catalogName, options) if err != nil { return CatalogsClientCountDevicesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CatalogsClientCountDevicesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CatalogsClientCountDevicesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CatalogsClientCountDevicesResponse{}, err } - return client.countDevicesHandleResponse(resp) + resp, err := client.countDevicesHandleResponse(httpResp) + return resp, err } // countDevicesCreateRequest creates the CountDevices request. @@ -117,9 +119,10 @@ func (client *CatalogsClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CatalogsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -130,18 +133,20 @@ func (client *CatalogsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // // Generated from API version 2022-09-01-preview func (client *CatalogsClient) createOrUpdate(ctx context.Context, resourceGroupName string, catalogName string, resource Catalog, options *CatalogsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, catalogName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -167,7 +172,10 @@ func (client *CatalogsClient) createOrUpdateCreateRequest(ctx context.Context, r reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Catalog @@ -183,9 +191,10 @@ func (client *CatalogsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CatalogsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -196,18 +205,20 @@ func (client *CatalogsClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2022-09-01-preview func (client *CatalogsClient) deleteOperation(ctx context.Context, resourceGroupName string, catalogName string, options *CatalogsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, catalogName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -244,18 +255,21 @@ func (client *CatalogsClient) deleteCreateRequest(ctx context.Context, resourceG // - catalogName - Name of catalog // - options - CatalogsClientGetOptions contains the optional parameters for the CatalogsClient.Get method. func (client *CatalogsClient) Get(ctx context.Context, resourceGroupName string, catalogName string, options *CatalogsClientGetOptions) (CatalogsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, options) if err != nil { return CatalogsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CatalogsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CatalogsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CatalogsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -571,7 +585,10 @@ func (client *CatalogsClient) listDeviceGroupsCreateRequest(ctx context.Context, } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, listDeviceGroupsRequest) + if err := runtime.MarshalAsJSON(req, listDeviceGroupsRequest); err != nil { + return nil, err + } + return req, nil } // listDeviceGroupsHandleResponse handles the ListDeviceGroups response. @@ -756,18 +773,21 @@ func (client *CatalogsClient) listDevicesHandleResponse(resp *http.Response) (Ca // - properties - The resource properties to be updated. // - options - CatalogsClientUpdateOptions contains the optional parameters for the CatalogsClient.Update method. func (client *CatalogsClient) Update(ctx context.Context, resourceGroupName string, catalogName string, properties CatalogUpdate, options *CatalogsClientUpdateOptions) (CatalogsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, catalogName, properties, options) if err != nil { return CatalogsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CatalogsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CatalogsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CatalogsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -793,7 +813,10 @@ func (client *CatalogsClient) updateCreateRequest(ctx context.Context, resourceG reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go deleted file mode 100644 index 5fa040921e32..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go +++ /dev/null @@ -1,407 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsSub.json -func ExampleCatalogsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CatalogListResult = armsphere.CatalogListResult{ - // Value: []*armsphere.Catalog{ - // { - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // }, - // { - // Name: to.Ptr("MyCatalog2"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup2/providers/Microsoft.AzureSphere/catalogs/MyCatalog2"), - // Location: to.Ptr("global"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsRG.json -func ExampleCatalogsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListByResourceGroupPager("MyResourceGroup1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CatalogListResult = armsphere.CatalogListResult{ - // Value: []*armsphere.Catalog{ - // { - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // }, - // { - // Name: to.Ptr("MyCatalog2"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog2"), - // Location: to.Ptr("global"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalog.json -func ExampleCatalogsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armsphere.Catalog{ - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutCatalog.json -func ExampleCatalogsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", armsphere.Catalog{ - Location: to.Ptr("global"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armsphere.Catalog{ - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchCatalog.json -func ExampleCatalogsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().Update(ctx, "MyResourceGroup1", "MyCatalog1", armsphere.CatalogUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armsphere.Catalog{ - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteCatalog.json -func ExampleCatalogsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesCatalog.json -func ExampleCatalogsClient_CountDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().CountDevices(ctx, "MyResourceGroup1", "MyCatalog1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CountDeviceResponse = armsphere.CountDeviceResponse{ - // Value: to.Ptr[int32](3), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeploymentsByCatalog.json -func ExampleCatalogsClient_NewListDeploymentsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDeploymentsPager("MyResourceGroup1", "MyCatalog1", &armsphere.CatalogsClientListDeploymentsOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeploymentListResult = armsphere.DeploymentListResult{ - // Value: []*armsphere.Deployment{ - // { - // Name: to.Ptr("DeploymentName1111"), - // Properties: &armsphere.DeploymentProperties{ - // }, - // }, - // { - // Name: to.Ptr("DeploymentName1121"), - // Properties: &armsphere.DeploymentProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceGroupsCatalog.json -func ExampleCatalogsClient_NewListDeviceGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDeviceGroupsPager("MyResourceGroup1", "MyCatalog1", armsphere.ListDeviceGroupsRequest{ - DeviceGroupName: to.Ptr("MyDeviceGroup1"), - }, &armsphere.CatalogsClientListDeviceGroupsOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeviceGroupListResult = armsphere.DeviceGroupListResult{ - // Value: []*armsphere.DeviceGroup{ - // { - // Name: to.Ptr("MyDeviceGroup1"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // }, - // { - // Name: to.Ptr("MyDeviceGroup2"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct2/devicegroups/MyDeviceGroup2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceInsightsCatalog.json -func ExampleCatalogsClient_NewListDeviceInsightsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDeviceInsightsPager("MyResourceGroup1", "MyCatalog1", &armsphere.CatalogsClientListDeviceInsightsOptions{Filter: nil, - Top: to.Ptr[int32](10), - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedDeviceInsight = armsphere.PagedDeviceInsight{ - // Value: []*armsphere.DeviceInsight{ - // { - // Description: to.Ptr("eventDescription1"), - // DeviceID: to.Ptr("eventIdentifier1"), - // EndTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-30T23:54:21.96Z"); return t}()), - // EventCategory: to.Ptr("eventCategory1"), - // EventClass: to.Ptr("eventClass1"), - // EventCount: to.Ptr[int32](1), - // EventType: to.Ptr("eventType1"), - // StartTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-30T21:51:39.26Z"); return t}()), - // }, - // { - // Description: to.Ptr("eventDescription2"), - // DeviceID: to.Ptr("eventIdentifier2"), - // EndTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-07T17:34:12.50Z"); return t}()), - // EventCategory: to.Ptr("eventCategory2"), - // EventClass: to.Ptr("eventClass2"), - // EventCount: to.Ptr[int32](1), - // EventType: to.Ptr("eventType2"), - // StartTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-06T12:41:39.26Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDevicesByCatalog.json -func ExampleCatalogsClient_NewListDevicesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDevicesPager("MyResourceGroup1", "MyCatalog1", &armsphere.CatalogsClientListDevicesOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeviceListResult = armsphere.DeviceListResult{ - // Value: []*armsphere.Device{ - // { - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }, - // { - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/certificates_client.go b/sdk/resourcemanager/sphere/armsphere/certificates_client.go index ef40df42971b..14e12474abba 100644 --- a/sdk/resourcemanager/sphere/armsphere/certificates_client.go +++ b/sdk/resourcemanager/sphere/armsphere/certificates_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 armsphere @@ -54,18 +53,21 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // - serialNumber - Serial number of the certificate. Use '.default' to get current active certificate. // - options - CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. func (client *CertificatesClient) Get(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, options *CertificatesClientGetOptions) (CertificatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, serialNumber, options) if err != nil { return CertificatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CertificatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -199,18 +201,21 @@ func (client *CertificatesClient) listByCatalogHandleResponse(resp *http.Respons // - options - CertificatesClientRetrieveCertChainOptions contains the optional parameters for the CertificatesClient.RetrieveCertChain // method. func (client *CertificatesClient) RetrieveCertChain(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, options *CertificatesClientRetrieveCertChainOptions) (CertificatesClientRetrieveCertChainResponse, error) { + var err error req, err := client.retrieveCertChainCreateRequest(ctx, resourceGroupName, catalogName, serialNumber, options) if err != nil { return CertificatesClientRetrieveCertChainResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientRetrieveCertChainResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CertificatesClientRetrieveCertChainResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientRetrieveCertChainResponse{}, err } - return client.retrieveCertChainHandleResponse(resp) + resp, err := client.retrieveCertChainHandleResponse(httpResp) + return resp, err } // retrieveCertChainCreateRequest creates the RetrieveCertChain request. @@ -263,18 +268,21 @@ func (client *CertificatesClient) retrieveCertChainHandleResponse(resp *http.Res // - options - CertificatesClientRetrieveProofOfPossessionNonceOptions contains the optional parameters for the CertificatesClient.RetrieveProofOfPossessionNonce // method. func (client *CertificatesClient) RetrieveProofOfPossessionNonce(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, proofOfPossessionNonceRequest ProofOfPossessionNonceRequest, options *CertificatesClientRetrieveProofOfPossessionNonceOptions) (CertificatesClientRetrieveProofOfPossessionNonceResponse, error) { + var err error req, err := client.retrieveProofOfPossessionNonceCreateRequest(ctx, resourceGroupName, catalogName, serialNumber, proofOfPossessionNonceRequest, options) if err != nil { return CertificatesClientRetrieveProofOfPossessionNonceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientRetrieveProofOfPossessionNonceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CertificatesClientRetrieveProofOfPossessionNonceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientRetrieveProofOfPossessionNonceResponse{}, err } - return client.retrieveProofOfPossessionNonceHandleResponse(resp) + resp, err := client.retrieveProofOfPossessionNonceHandleResponse(httpResp) + return resp, err } // retrieveProofOfPossessionNonceCreateRequest creates the RetrieveProofOfPossessionNonce request. @@ -304,7 +312,10 @@ func (client *CertificatesClient) retrieveProofOfPossessionNonceCreateRequest(ct reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, proofOfPossessionNonceRequest) + if err := runtime.MarshalAsJSON(req, proofOfPossessionNonceRequest); err != nil { + return nil, err + } + return req, nil } // retrieveProofOfPossessionNonceHandleResponse handles the RetrieveProofOfPossessionNonce response. diff --git a/sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go deleted file mode 100644 index 32ba5eddbc1e..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificates.json -func ExampleCertificatesClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCertificatesClient().NewListByCatalogPager("MyResourceGroup1", "MyCatalog1", &armsphere.CertificatesClientListByCatalogOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CertificateListResult = armsphere.CertificateListResult{ - // Value: []*armsphere.Certificate{ - // }, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificate.json -func ExampleCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Certificate = armsphere.Certificate{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveCatalogCertChain.json -func ExampleCertificatesClient_RetrieveCertChain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().RetrieveCertChain(ctx, "MyResourceGroup1", "MyCatalog1", "active", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CertificateChainResponse = armsphere.CertificateChainResponse{ - // CertificateChain: to.Ptr("ABynaryRepresentationOfTheRequestedCatalogCertificateChain"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveProofOfPossessionNonce.json -func ExampleCertificatesClient_RetrieveProofOfPossessionNonce() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().RetrieveProofOfPossessionNonce(ctx, "MyResourceGroup1", "MyCatalog1", "active", armsphere.ProofOfPossessionNonceRequest{ - ProofOfPossessionNonce: to.Ptr("proofOfPossessionNonce"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProofOfPossessionNonceResponse = armsphere.ProofOfPossessionNonceResponse{ - // Certificate: to.Ptr("bXliYXNlNjRzdHJpbmc="), - // } -} diff --git a/sdk/resourcemanager/sphere/armsphere/client_factory.go b/sdk/resourcemanager/sphere/armsphere/client_factory.go index 2475c00282b6..b5866fb0f94c 100644 --- a/sdk/resourcemanager/sphere/armsphere/client_factory.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere @@ -38,11 +37,6 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewCatalogsClient() *CatalogsClient { subClient, _ := NewCatalogsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -53,27 +47,32 @@ func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { return subClient } -func (c *ClientFactory) NewImagesClient() *ImagesClient { - subClient, _ := NewImagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { + subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewProductsClient() *ProductsClient { - subClient, _ := NewProductsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDeviceGroupsClient() *DeviceGroupsClient { + subClient, _ := NewDeviceGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDeviceGroupsClient() *DeviceGroupsClient { - subClient, _ := NewDeviceGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDevicesClient() *DevicesClient { + subClient, _ := NewDevicesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { - subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewImagesClient() *ImagesClient { + subClient, _ := NewImagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDevicesClient() *DevicesClient { - subClient, _ := NewDevicesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProductsClient() *ProductsClient { + subClient, _ := NewProductsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/sphere/armsphere/constants.go b/sdk/resourcemanager/sphere/armsphere/constants.go index 4ec2bbf9ad27..eab65118ea83 100644 --- a/sdk/resourcemanager/sphere/armsphere/constants.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere const ( moduleName = "armsphere" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/sphere/armsphere/deployments_client.go b/sdk/resourcemanager/sphere/armsphere/deployments_client.go index 5bf23d869441..5f4b78add860 100644 --- a/sdk/resourcemanager/sphere/armsphere/deployments_client.go +++ b/sdk/resourcemanager/sphere/armsphere/deployments_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 armsphere @@ -65,9 +64,10 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -79,18 +79,20 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour // // Generated from API version 2022-09-01-preview func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, resource Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -128,7 +130,10 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product @@ -149,9 +154,10 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -163,18 +169,20 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN // // Generated from API version 2022-09-01-preview func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -228,18 +236,21 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour // device group. // - options - DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (DeploymentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, options) if err != nil { return DeploymentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go deleted file mode 100644 index 00784977f0f5..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go +++ /dev/null @@ -1,173 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployments.json -func ExampleDeploymentsClient_NewListByDeviceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeploymentsClient().NewListByDeviceGroupPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", &armsphere.DeploymentsClientListByDeviceGroupOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeploymentListResult = armsphere.DeploymentListResult{ - // Value: []*armsphere.Deployment{ - // { - // Name: to.Ptr("MyDeployment1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/deviceGroups/MyDeviceGroup1/deployments/MyDeployment1"), - // Properties: &armsphere.DeploymentProperties{ - // DeployedImages: []*armsphere.Image{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/MyImage1"), - // Properties: &armsphere.ImageProperties{ - // Description: to.Ptr("description"), - // ComponentID: to.Ptr("componentId"), - // Image: to.Ptr("dGVzdGltYWdl"), - // ImageType: to.Ptr(armsphere.ImageType("ImageType")), - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // RegionalDataBoundary: to.Ptr(armsphere.RegionalDataBoundaryNone), - // URI: to.Ptr("imageUri"), - // }, - // }}, - // DeploymentDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-30T21:51:39.2698729Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployment.json -func ExampleDeploymentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeploymentsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "MyDeployment1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Deployment = armsphere.Deployment{ - // Name: to.Ptr("MyDeployment1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/deviceGroups/MyDeviceGroup1/deployments/MyDeployment1"), - // Properties: &armsphere.DeploymentProperties{ - // DeployedImages: []*armsphere.Image{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/MyImage1"), - // Properties: &armsphere.ImageProperties{ - // Description: to.Ptr("description"), - // ComponentID: to.Ptr("componentId"), - // Image: to.Ptr("dGVzdGltYWdl"), - // ImageType: to.Ptr(armsphere.ImageType("ImageType")), - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // RegionalDataBoundary: to.Ptr(armsphere.RegionalDataBoundaryNone), - // URI: to.Ptr("imageUri"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeployment.json -func ExampleDeploymentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "MyDeployment1", armsphere.Deployment{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Deployment = armsphere.Deployment{ - // Name: to.Ptr("MyDeployment1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/deviceGroups/MyDeviceGroup1/deployments/MyDeployment1"), - // Properties: &armsphere.DeploymentProperties{ - // DeployedImages: []*armsphere.Image{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/MyImage1"), - // Properties: &armsphere.ImageProperties{ - // Image: to.Ptr("MyImage"), - // ImageID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ImageType: to.Ptr(armsphere.ImageTypeInvalidImageType), - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // RegionalDataBoundary: to.Ptr(armsphere.RegionalDataBoundaryNone), - // URI: to.Ptr("imageUri"), - // }, - // }}, - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeployment.json -func ExampleDeploymentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", "MyDeploymentName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/devicegroups_client.go b/sdk/resourcemanager/sphere/armsphere/devicegroups_client.go index 267462031b8c..ebf8597656dd 100644 --- a/sdk/resourcemanager/sphere/armsphere/devicegroups_client.go +++ b/sdk/resourcemanager/sphere/armsphere/devicegroups_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 armsphere @@ -63,9 +62,10 @@ func (client *DeviceGroupsClient) BeginClaimDevices(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientClaimDevicesResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientClaimDevicesResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeviceGroupsClientClaimDevicesResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -77,18 +77,20 @@ func (client *DeviceGroupsClient) BeginClaimDevices(ctx context.Context, resourc // // Generated from API version 2022-09-01-preview func (client *DeviceGroupsClient) claimDevices(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, claimDevicesRequest ClaimDevicesRequest, options *DeviceGroupsClientBeginClaimDevicesOptions) (*http.Response, error) { + var err error req, err := client.claimDevicesCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // claimDevicesCreateRequest creates the ClaimDevices request. @@ -122,7 +124,10 @@ func (client *DeviceGroupsClient) claimDevicesCreateRequest(ctx context.Context, reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, claimDevicesRequest) + if err := runtime.MarshalAsJSON(req, claimDevicesRequest); err != nil { + return nil, err + } + return req, nil } // CountDevices - Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used @@ -137,18 +142,21 @@ func (client *DeviceGroupsClient) claimDevicesCreateRequest(ctx context.Context, // - options - DeviceGroupsClientCountDevicesOptions contains the optional parameters for the DeviceGroupsClient.CountDevices // method. func (client *DeviceGroupsClient) CountDevices(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DeviceGroupsClientCountDevicesOptions) (DeviceGroupsClientCountDevicesResponse, error) { + var err error req, err := client.countDevicesCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, options) if err != nil { return DeviceGroupsClientCountDevicesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeviceGroupsClientCountDevicesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeviceGroupsClientCountDevicesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeviceGroupsClientCountDevicesResponse{}, err } - return client.countDevicesHandleResponse(resp) + resp, err := client.countDevicesHandleResponse(httpResp) + return resp, err } // countDevicesCreateRequest creates the CountDevices request. @@ -212,9 +220,10 @@ func (client *DeviceGroupsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeviceGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -226,18 +235,20 @@ func (client *DeviceGroupsClient) BeginCreateOrUpdate(ctx context.Context, resou // // Generated from API version 2022-09-01-preview func (client *DeviceGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, resource DeviceGroup, options *DeviceGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -271,7 +282,10 @@ func (client *DeviceGroupsClient) createOrUpdateCreateRequest(ctx context.Contex reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product @@ -291,9 +305,10 @@ func (client *DeviceGroupsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeviceGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -305,18 +320,20 @@ func (client *DeviceGroupsClient) BeginDelete(ctx context.Context, resourceGroup // // Generated from API version 2022-09-01-preview func (client *DeviceGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DeviceGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -364,18 +381,21 @@ func (client *DeviceGroupsClient) deleteCreateRequest(ctx context.Context, resou // - deviceGroupName - Name of device group. // - options - DeviceGroupsClientGetOptions contains the optional parameters for the DeviceGroupsClient.Get method. func (client *DeviceGroupsClient) Get(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DeviceGroupsClientGetOptions) (DeviceGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, options) if err != nil { return DeviceGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeviceGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeviceGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeviceGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -527,9 +547,10 @@ func (client *DeviceGroupsClient) BeginUpdate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceGroupsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeviceGroupsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -541,18 +562,20 @@ func (client *DeviceGroupsClient) BeginUpdate(ctx context.Context, resourceGroup // // Generated from API version 2022-09-01-preview func (client *DeviceGroupsClient) update(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, properties DeviceGroupUpdate, options *DeviceGroupsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, properties, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -586,5 +609,8 @@ func (client *DeviceGroupsClient) updateCreateRequest(ctx context.Context, resou reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go deleted file mode 100644 index 638b958a231f..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroups.json -func ExampleDeviceGroupsClient_NewListByProductPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeviceGroupsClient().NewListByProductPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", &armsphere.DeviceGroupsClientListByProductOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeviceGroupListResult = armsphere.DeviceGroupListResult{ - // Value: []*armsphere.DeviceGroup{ - // { - // Name: to.Ptr("MyDeviceGroup1"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // }, - // { - // Name: to.Ptr("MyDeviceGroup2"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/Products/MyProduct2/devicegroups/MyDeviceGroup2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroup.json -func ExampleDeviceGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeviceGroupsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeviceGroup = armsphere.DeviceGroup{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("The description of MyDeviceGroup1"), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeviceGroup.json -func ExampleDeviceGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", armsphere.DeviceGroup{ - Properties: &armsphere.DeviceGroupProperties{ - Description: to.Ptr("Description for MyDeviceGroup1"), - OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeviceGroup = armsphere.DeviceGroup{ - // Type: to.Ptr("microsoft.AzureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("Description of MyDeviceGroup1"), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchDeviceGroup.json -func ExampleDeviceGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", armsphere.DeviceGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeviceGroup = armsphere.DeviceGroup{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("The description of MyDeviceGroup1"), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeviceGroup.json -func ExampleDeviceGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostClaimDevices.json -func ExampleDeviceGroupsClient_BeginClaimDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginClaimDevices(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", armsphere.ClaimDevicesRequest{ - DeviceIdentifiers: []*string{ - to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesDeviceGroup.json -func ExampleDeviceGroupsClient_CountDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeviceGroupsClient().CountDevices(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CountDeviceResponse = armsphere.CountDeviceResponse{ - // Value: to.Ptr[int32](3), - // } -} diff --git a/sdk/resourcemanager/sphere/armsphere/devices_client.go b/sdk/resourcemanager/sphere/armsphere/devices_client.go index f95a3520ee8e..7ff969b670f1 100644 --- a/sdk/resourcemanager/sphere/armsphere/devices_client.go +++ b/sdk/resourcemanager/sphere/armsphere/devices_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 armsphere @@ -63,9 +62,10 @@ func (client *DevicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DevicesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -77,18 +77,20 @@ func (client *DevicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // // Generated from API version 2022-09-01-preview func (client *DevicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, resource Device, options *DevicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -126,7 +128,10 @@ func (client *DevicesClient) createOrUpdateCreateRequest(ctx context.Context, re reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Device @@ -145,9 +150,10 @@ func (client *DevicesClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DevicesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -158,18 +164,20 @@ func (client *DevicesClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2022-09-01-preview func (client *DevicesClient) deleteOperation(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, options *DevicesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deviceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -230,9 +238,10 @@ func (client *DevicesClient) BeginGenerateCapabilityImage(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientGenerateCapabilityImageResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientGenerateCapabilityImageResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DevicesClientGenerateCapabilityImageResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -245,18 +254,20 @@ func (client *DevicesClient) BeginGenerateCapabilityImage(ctx context.Context, r // // Generated from API version 2022-09-01-preview func (client *DevicesClient) generateCapabilityImage(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, generateDeviceCapabilityRequest GenerateCapabilityImageRequest, options *DevicesClientBeginGenerateCapabilityImageOptions) (*http.Response, error) { + var err error req, err := client.generateCapabilityImageCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deviceName, generateDeviceCapabilityRequest, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // generateCapabilityImageCreateRequest creates the GenerateCapabilityImage request. @@ -294,7 +305,10 @@ func (client *DevicesClient) generateCapabilityImageCreateRequest(ctx context.Co reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, generateDeviceCapabilityRequest) + if err := runtime.MarshalAsJSON(req, generateDeviceCapabilityRequest); err != nil { + return nil, err + } + return req, nil } // Get - Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong @@ -309,18 +323,21 @@ func (client *DevicesClient) generateCapabilityImageCreateRequest(ctx context.Co // - deviceName - Device name // - options - DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. func (client *DevicesClient) Get(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, options *DevicesClientGetOptions) (DevicesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deviceName, options) if err != nil { return DevicesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DevicesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DevicesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DevicesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -469,9 +486,10 @@ func (client *DevicesClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevicesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DevicesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -483,18 +501,20 @@ func (client *DevicesClient) BeginUpdate(ctx context.Context, resourceGroupName // // Generated from API version 2022-09-01-preview func (client *DevicesClient) update(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, properties DeviceUpdate, options *DevicesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -532,5 +552,8 @@ func (client *DevicesClient) updateCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go deleted file mode 100644 index 8072f3597444..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go +++ /dev/null @@ -1,205 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevices.json -func ExampleDevicesClient_NewListByDeviceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDevicesClient().NewListByDeviceGroupPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeviceListResult = armsphere.DeviceListResult{ - // Value: []*armsphere.Device{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000-0000-0000-0000-000000000001"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000-0000-0000-0000-000000000002"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevice.json -func ExampleDevicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDevicesClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Device = armsphere.Device{ - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // ChipSKU: to.Ptr("MyChipSku1"), - // LastAvailableOsVersion: to.Ptr("AvailableOsVersion1"), - // LastInstalledOsVersion: to.Ptr("InstalledOsVersion1"), - // LastOsUpdateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-30T23:54:21.96Z"); return t}()), - // LastUpdateRequestUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-01T23:54:21.96Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDevice.json -func ExampleDevicesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", armsphere.Device{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Device = armsphere.Device{ - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // ChipSKU: to.Ptr("MyChipSku1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchDevice.json -func ExampleDevicesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", armsphere.DeviceUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Device = armsphere.Device{ - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1/device/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // ChipSKU: to.Ptr("MyChipSku1"), - // LastAvailableOsVersion: to.Ptr("AvailableOsVersion1"), - // LastInstalledOsVersion: to.Ptr("InstalledOsVersion1"), - // LastOsUpdateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-30T23:54:21.96Z"); return t}()), - // LastUpdateRequestUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-01T23:54:21.96Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDevice.json -func ExampleDevicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDeviceCapabilityImage.json -func ExampleDevicesClient_BeginGenerateCapabilityImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginGenerateCapabilityImage(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", armsphere.GenerateCapabilityImageRequest{ - Capabilities: []*armsphere.CapabilityType{ - to.Ptr(armsphere.CapabilityTypeApplicationDevelopment)}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SignedCapabilityImageResponse = armsphere.SignedCapabilityImageResponse{ - // Image: to.Ptr("TheDeviceCapabilityImage"), - // } -} diff --git a/sdk/resourcemanager/sphere/armsphere/go.mod b/sdk/resourcemanager/sphere/armsphere/go.mod index 44fd7836459a..b695ab684602 100644 --- a/sdk/resourcemanager/sphere/armsphere/go.mod +++ b/sdk/resourcemanager/sphere/armsphere/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/sphere/armsphere/go.sum b/sdk/resourcemanager/sphere/armsphere/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/sphere/armsphere/go.sum +++ b/sdk/resourcemanager/sphere/armsphere/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/sphere/armsphere/images_client.go b/sdk/resourcemanager/sphere/armsphere/images_client.go index 6bdafc4ee96c..daa1f55f91da 100644 --- a/sdk/resourcemanager/sphere/armsphere/images_client.go +++ b/sdk/resourcemanager/sphere/armsphere/images_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 armsphere @@ -61,9 +60,10 @@ func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ImagesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -74,18 +74,20 @@ func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // // Generated from API version 2022-09-01-preview func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, catalogName string, imageName string, resource Image, options *ImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, catalogName, imageName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,7 +117,10 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Image @@ -132,9 +137,10 @@ func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ImagesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,18 +151,20 @@ func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName s // // Generated from API version 2022-09-01-preview func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, catalogName string, imageName string, options *ImagesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, catalogName, imageName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -198,18 +206,21 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro // - imageName - Image name. Use .default for image creation. // - options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, catalogName string, imageName string, options *ImagesClientGetOptions) (ImagesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, imageName, options) if err != nil { return ImagesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImagesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImagesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/sphere/armsphere/images_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/images_client_example_test.go deleted file mode 100644 index 77fee070167c..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/images_client_example_test.go +++ /dev/null @@ -1,135 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImages.json -func ExampleImagesClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByCatalogPager("MyResourceGroup1", "MyCatalog1", &armsphere.ImagesClientListByCatalogOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armsphere.ImageListResult{ - // Value: []*armsphere.Image{ - // { - // Name: to.Ptr("MyImage1"), - // ID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }, - // { - // Name: to.Ptr("MyImage2"), - // ID: to.Ptr("00000000-0000-0000-0000-000000000002"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImage.json -func ExampleImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "myImageId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armsphere.Image{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutImage.json -func ExampleImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "default", armsphere.Image{ - Properties: &armsphere.ImageProperties{ - Image: to.Ptr("bXliYXNlNjRzdHJpbmc="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armsphere.Image{ - // Name: to.Ptr("MyProduct1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/images"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteImage.json -func ExampleImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "imageID", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/models.go b/sdk/resourcemanager/sphere/armsphere/models.go index e462fef78539..c8eff4adb92a 100644 --- a/sdk/resourcemanager/sphere/armsphere/models.go +++ b/sdk/resourcemanager/sphere/armsphere/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsphere @@ -56,95 +55,6 @@ type CatalogUpdate struct { Tags map[string]*string } -// CatalogsClientBeginCreateOrUpdateOptions contains the optional parameters for the CatalogsClient.BeginCreateOrUpdate method. -type CatalogsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CatalogsClientBeginDeleteOptions contains the optional parameters for the CatalogsClient.BeginDelete method. -type CatalogsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CatalogsClientCountDevicesOptions contains the optional parameters for the CatalogsClient.CountDevices method. -type CatalogsClientCountDevicesOptions struct { - // placeholder for future optional parameters -} - -// CatalogsClientGetOptions contains the optional parameters for the CatalogsClient.Get method. -type CatalogsClientGetOptions struct { - // placeholder for future optional parameters -} - -// CatalogsClientListByResourceGroupOptions contains the optional parameters for the CatalogsClient.NewListByResourceGroupPager -// method. -type CatalogsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// CatalogsClientListBySubscriptionOptions contains the optional parameters for the CatalogsClient.NewListBySubscriptionPager -// method. -type CatalogsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// CatalogsClientListDeploymentsOptions contains the optional parameters for the CatalogsClient.NewListDeploymentsPager method. -type CatalogsClientListDeploymentsOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - -// CatalogsClientListDeviceGroupsOptions contains the optional parameters for the CatalogsClient.NewListDeviceGroupsPager -// method. -type CatalogsClientListDeviceGroupsOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - -// CatalogsClientListDeviceInsightsOptions contains the optional parameters for the CatalogsClient.NewListDeviceInsightsPager -// method. -type CatalogsClientListDeviceInsightsOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - -// CatalogsClientListDevicesOptions contains the optional parameters for the CatalogsClient.NewListDevicesPager method. -type CatalogsClientListDevicesOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - -// CatalogsClientUpdateOptions contains the optional parameters for the CatalogsClient.Update method. -type CatalogsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // Certificate - An certificate resource belonging to a catalog resource. type Certificate struct { // The resource-specific properties for this resource. @@ -202,36 +112,6 @@ type CertificateProperties struct { Thumbprint *string } -// CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. -type CertificatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// CertificatesClientListByCatalogOptions contains the optional parameters for the CertificatesClient.NewListByCatalogPager -// method. -type CertificatesClientListByCatalogOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - -// CertificatesClientRetrieveCertChainOptions contains the optional parameters for the CertificatesClient.RetrieveCertChain -// method. -type CertificatesClientRetrieveCertChainOptions struct { - // placeholder for future optional parameters -} - -// CertificatesClientRetrieveProofOfPossessionNonceOptions contains the optional parameters for the CertificatesClient.RetrieveProofOfPossessionNonce -// method. -type CertificatesClientRetrieveProofOfPossessionNonceOptions struct { - // placeholder for future optional parameters -} - // ClaimDevicesRequest - Request to the action call to bulk claim devices. type ClaimDevicesRequest struct { // REQUIRED; Device identifiers of the devices to be claimed. @@ -286,37 +166,6 @@ type DeploymentProperties struct { ProvisioningState *ProvisioningState } -// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate -// method. -type DeploymentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. -type DeploymentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. -type DeploymentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientListByDeviceGroupOptions contains the optional parameters for the DeploymentsClient.NewListByDeviceGroupPager -// method. -type DeploymentsClientListByDeviceGroupOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - // Device - An device resource belonging to a device group resource. type Device struct { // The resource-specific properties for this resource. @@ -410,55 +259,6 @@ type DeviceGroupUpdateProperties struct { UpdatePolicy *UpdatePolicy } -// DeviceGroupsClientBeginClaimDevicesOptions contains the optional parameters for the DeviceGroupsClient.BeginClaimDevices -// method. -type DeviceGroupsClientBeginClaimDevicesOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeviceGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeviceGroupsClient.BeginCreateOrUpdate -// method. -type DeviceGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeviceGroupsClientBeginDeleteOptions contains the optional parameters for the DeviceGroupsClient.BeginDelete method. -type DeviceGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeviceGroupsClientBeginUpdateOptions contains the optional parameters for the DeviceGroupsClient.BeginUpdate method. -type DeviceGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeviceGroupsClientCountDevicesOptions contains the optional parameters for the DeviceGroupsClient.CountDevices method. -type DeviceGroupsClientCountDevicesOptions struct { - // placeholder for future optional parameters -} - -// DeviceGroupsClientGetOptions contains the optional parameters for the DeviceGroupsClient.Get method. -type DeviceGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeviceGroupsClientListByProductOptions contains the optional parameters for the DeviceGroupsClient.NewListByProductPager -// method. -type DeviceGroupsClientListByProductOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - // DeviceInsight - Device insight report. type DeviceInsight struct { // REQUIRED; Event description @@ -531,42 +331,6 @@ type DeviceUpdateProperties struct { DeviceGroupID *string } -// DevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdate method. -type DevicesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DevicesClientBeginDeleteOptions contains the optional parameters for the DevicesClient.BeginDelete method. -type DevicesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DevicesClientBeginGenerateCapabilityImageOptions contains the optional parameters for the DevicesClient.BeginGenerateCapabilityImage -// method. -type DevicesClientBeginGenerateCapabilityImageOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DevicesClientBeginUpdateOptions contains the optional parameters for the DevicesClient.BeginUpdate method. -type DevicesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. -type DevicesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DevicesClientListByDeviceGroupOptions contains the optional parameters for the DevicesClient.NewListByDeviceGroupPager -// method. -type DevicesClientListByDeviceGroupOptions struct { - // placeholder for future optional parameters -} - // GenerateCapabilityImageRequest - Request of the action to create a signed device capability image type GenerateCapabilityImageRequest struct { // REQUIRED; List of capabilities to create @@ -630,35 +394,6 @@ type ImageProperties struct { URI *string } -// ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate method. -type ImagesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. -type ImagesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. -type ImagesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ImagesClientListByCatalogOptions contains the optional parameters for the ImagesClient.NewListByCatalogPager method. -type ImagesClientListByCatalogOptions struct { - // Filter the result list using the given expression - Filter *string - // The maximum number of result items per page. - Maxpagesize *int32 - // The number of result items to skip. - Skip *int32 - // The number of result items to return. - Top *int32 -} - // ListDeviceGroupsRequest - Request of the action to list device groups for a catalog. type ListDeviceGroupsRequest struct { // Device Group name. @@ -714,11 +449,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PagedDeviceInsight - Paged collection of DeviceInsight items type PagedDeviceInsight struct { // REQUIRED; The DeviceInsight items on this page @@ -776,45 +506,6 @@ type ProductUpdateProperties struct { Description *string } -// ProductsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProductsClient.BeginCreateOrUpdate method. -type ProductsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProductsClientBeginDeleteOptions contains the optional parameters for the ProductsClient.BeginDelete method. -type ProductsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProductsClientBeginUpdateOptions contains the optional parameters for the ProductsClient.BeginUpdate method. -type ProductsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProductsClientCountDevicesOptions contains the optional parameters for the ProductsClient.CountDevices method. -type ProductsClientCountDevicesOptions struct { - // placeholder for future optional parameters -} - -// ProductsClientGenerateDefaultDeviceGroupsOptions contains the optional parameters for the ProductsClient.NewGenerateDefaultDeviceGroupsPager -// method. -type ProductsClientGenerateDefaultDeviceGroupsOptions struct { - // placeholder for future optional parameters -} - -// ProductsClientGetOptions contains the optional parameters for the ProductsClient.Get method. -type ProductsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProductsClientListByCatalogOptions contains the optional parameters for the ProductsClient.NewListByCatalogPager method. -type ProductsClientListByCatalogOptions struct { - // placeholder for future optional parameters -} - // ProofOfPossessionNonceRequest - Request for the proof of possession nonce type ProofOfPossessionNonceRequest struct { // REQUIRED; The proof of possession nonce diff --git a/sdk/resourcemanager/sphere/armsphere/models_serde.go b/sdk/resourcemanager/sphere/armsphere/models_serde.go index a1a9de901529..b79cea7109ac 100644 --- a/sdk/resourcemanager/sphere/armsphere/models_serde.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere diff --git a/sdk/resourcemanager/sphere/armsphere/operations_client.go b/sdk/resourcemanager/sphere/armsphere/operations_client.go index 7a96003eede0..d3958adb5fdb 100644 --- a/sdk/resourcemanager/sphere/armsphere/operations_client.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere diff --git a/sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go deleted file mode 100644 index e623fcbb4c38..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armsphere.OperationListResult{ - // Value: []*armsphere.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureSphere/catalogs/Read"), - // Display: &armsphere.OperationDisplay{ - // Description: to.Ptr("Read Azure Sphere catalogs"), - // Operation: to.Ptr("Gets/List catalog"), - // Provider: to.Ptr("Microsoft.AzureSphere"), - // Resource: to.Ptr("catalog"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.AzureSphere/catalogs/Write"), - // Display: &armsphere.OperationDisplay{ - // Description: to.Ptr("Writes Azure Sphere catalogs"), - // Operation: to.Ptr("Create/Update catalog"), - // Provider: to.Ptr("Microsoft.AzureSphere"), - // Resource: to.Ptr("catalog"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/options.go b/sdk/resourcemanager/sphere/armsphere/options.go new file mode 100644 index 000000000000..ddf076e680a7 --- /dev/null +++ b/sdk/resourcemanager/sphere/armsphere/options.go @@ -0,0 +1,341 @@ +//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 armsphere + +// CatalogsClientBeginCreateOrUpdateOptions contains the optional parameters for the CatalogsClient.BeginCreateOrUpdate method. +type CatalogsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CatalogsClientBeginDeleteOptions contains the optional parameters for the CatalogsClient.BeginDelete method. +type CatalogsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CatalogsClientCountDevicesOptions contains the optional parameters for the CatalogsClient.CountDevices method. +type CatalogsClientCountDevicesOptions struct { + // placeholder for future optional parameters +} + +// CatalogsClientGetOptions contains the optional parameters for the CatalogsClient.Get method. +type CatalogsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CatalogsClientListByResourceGroupOptions contains the optional parameters for the CatalogsClient.NewListByResourceGroupPager +// method. +type CatalogsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CatalogsClientListBySubscriptionOptions contains the optional parameters for the CatalogsClient.NewListBySubscriptionPager +// method. +type CatalogsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CatalogsClientListDeploymentsOptions contains the optional parameters for the CatalogsClient.NewListDeploymentsPager method. +type CatalogsClientListDeploymentsOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// CatalogsClientListDeviceGroupsOptions contains the optional parameters for the CatalogsClient.NewListDeviceGroupsPager +// method. +type CatalogsClientListDeviceGroupsOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// CatalogsClientListDeviceInsightsOptions contains the optional parameters for the CatalogsClient.NewListDeviceInsightsPager +// method. +type CatalogsClientListDeviceInsightsOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// CatalogsClientListDevicesOptions contains the optional parameters for the CatalogsClient.NewListDevicesPager method. +type CatalogsClientListDevicesOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// CatalogsClientUpdateOptions contains the optional parameters for the CatalogsClient.Update method. +type CatalogsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. +type CertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientListByCatalogOptions contains the optional parameters for the CertificatesClient.NewListByCatalogPager +// method. +type CertificatesClientListByCatalogOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// CertificatesClientRetrieveCertChainOptions contains the optional parameters for the CertificatesClient.RetrieveCertChain +// method. +type CertificatesClientRetrieveCertChainOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientRetrieveProofOfPossessionNonceOptions contains the optional parameters for the CertificatesClient.RetrieveProofOfPossessionNonce +// method. +type CertificatesClientRetrieveProofOfPossessionNonceOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate +// method. +type DeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. +type DeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. +type DeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientListByDeviceGroupOptions contains the optional parameters for the DeploymentsClient.NewListByDeviceGroupPager +// method. +type DeploymentsClientListByDeviceGroupOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// DeviceGroupsClientBeginClaimDevicesOptions contains the optional parameters for the DeviceGroupsClient.BeginClaimDevices +// method. +type DeviceGroupsClientBeginClaimDevicesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeviceGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeviceGroupsClient.BeginCreateOrUpdate +// method. +type DeviceGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeviceGroupsClientBeginDeleteOptions contains the optional parameters for the DeviceGroupsClient.BeginDelete method. +type DeviceGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeviceGroupsClientBeginUpdateOptions contains the optional parameters for the DeviceGroupsClient.BeginUpdate method. +type DeviceGroupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeviceGroupsClientCountDevicesOptions contains the optional parameters for the DeviceGroupsClient.CountDevices method. +type DeviceGroupsClientCountDevicesOptions struct { + // placeholder for future optional parameters +} + +// DeviceGroupsClientGetOptions contains the optional parameters for the DeviceGroupsClient.Get method. +type DeviceGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeviceGroupsClientListByProductOptions contains the optional parameters for the DeviceGroupsClient.NewListByProductPager +// method. +type DeviceGroupsClientListByProductOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// DevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdate method. +type DevicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginDeleteOptions contains the optional parameters for the DevicesClient.BeginDelete method. +type DevicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginGenerateCapabilityImageOptions contains the optional parameters for the DevicesClient.BeginGenerateCapabilityImage +// method. +type DevicesClientBeginGenerateCapabilityImageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientBeginUpdateOptions contains the optional parameters for the DevicesClient.BeginUpdate method. +type DevicesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. +type DevicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DevicesClientListByDeviceGroupOptions contains the optional parameters for the DevicesClient.NewListByDeviceGroupPager +// method. +type DevicesClientListByDeviceGroupOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate method. +type ImagesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. +type ImagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. +type ImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientListByCatalogOptions contains the optional parameters for the ImagesClient.NewListByCatalogPager method. +type ImagesClientListByCatalogOptions struct { + // Filter the result list using the given expression + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProductsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProductsClient.BeginCreateOrUpdate method. +type ProductsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProductsClientBeginDeleteOptions contains the optional parameters for the ProductsClient.BeginDelete method. +type ProductsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProductsClientBeginUpdateOptions contains the optional parameters for the ProductsClient.BeginUpdate method. +type ProductsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProductsClientCountDevicesOptions contains the optional parameters for the ProductsClient.CountDevices method. +type ProductsClientCountDevicesOptions struct { + // placeholder for future optional parameters +} + +// ProductsClientGenerateDefaultDeviceGroupsOptions contains the optional parameters for the ProductsClient.NewGenerateDefaultDeviceGroupsPager +// method. +type ProductsClientGenerateDefaultDeviceGroupsOptions struct { + // placeholder for future optional parameters +} + +// ProductsClientGetOptions contains the optional parameters for the ProductsClient.Get method. +type ProductsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProductsClientListByCatalogOptions contains the optional parameters for the ProductsClient.NewListByCatalogPager method. +type ProductsClientListByCatalogOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/sphere/armsphere/products_client.go b/sdk/resourcemanager/sphere/armsphere/products_client.go index 6cf1620000bb..25bf2cdad06e 100644 --- a/sdk/resourcemanager/sphere/armsphere/products_client.go +++ b/sdk/resourcemanager/sphere/armsphere/products_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 armsphere @@ -54,18 +53,21 @@ func NewProductsClient(subscriptionID string, credential azcore.TokenCredential, // - productName - Name of product. // - options - ProductsClientCountDevicesOptions contains the optional parameters for the ProductsClient.CountDevices method. func (client *ProductsClient) CountDevices(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientCountDevicesOptions) (ProductsClientCountDevicesResponse, error) { + var err error req, err := client.countDevicesCreateRequest(ctx, resourceGroupName, catalogName, productName, options) if err != nil { return ProductsClientCountDevicesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProductsClientCountDevicesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProductsClientCountDevicesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProductsClientCountDevicesResponse{}, err } - return client.countDevicesHandleResponse(resp) + resp, err := client.countDevicesHandleResponse(httpResp) + return resp, err } // countDevicesCreateRequest creates the CountDevices request. @@ -124,9 +126,10 @@ func (client *ProductsClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProductsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProductsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ProductsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,18 +141,20 @@ func (client *ProductsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // // Generated from API version 2022-09-01-preview func (client *ProductsClient) createOrUpdate(ctx context.Context, resourceGroupName string, catalogName string, productName string, resource Product, options *ProductsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, catalogName, productName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -179,7 +184,10 @@ func (client *ProductsClient) createOrUpdateCreateRequest(ctx context.Context, r reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' @@ -196,9 +204,10 @@ func (client *ProductsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProductsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProductsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ProductsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -209,18 +218,20 @@ func (client *ProductsClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2022-09-01-preview func (client *ProductsClient) deleteOperation(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, catalogName, productName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -338,18 +349,21 @@ func (client *ProductsClient) generateDefaultDeviceGroupsHandleResponse(resp *ht // - productName - Name of product. // - options - ProductsClientGetOptions contains the optional parameters for the ProductsClient.Get method. func (client *ProductsClient) Get(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientGetOptions) (ProductsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, catalogName, productName, options) if err != nil { return ProductsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProductsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProductsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProductsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -476,9 +490,10 @@ func (client *ProductsClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProductsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProductsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ProductsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -489,18 +504,20 @@ func (client *ProductsClient) BeginUpdate(ctx context.Context, resourceGroupName // // Generated from API version 2022-09-01-preview func (client *ProductsClient) update(ctx context.Context, resourceGroupName string, catalogName string, productName string, properties ProductUpdate, options *ProductsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, catalogName, productName, properties, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -530,5 +547,8 @@ func (client *ProductsClient) updateCreateRequest(ctx context.Context, resourceG reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sphere/armsphere/products_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/products_client_example_test.go deleted file mode 100644 index f9ae7675a85c..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/products_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProducts.json -func ExampleProductsClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewListByCatalogPager("MyResourceGroup1", "MyCatalog1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductListResult = armsphere.ProductListResult{ - // Value: []*armsphere.Product{ - // { - // Name: to.Ptr("MyProduct1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // }, - // { - // Name: to.Ptr("MyProduct2"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProduct.json -func ExampleProductsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Product = armsphere.Product{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // Properties: &armsphere.ProductProperties{ - // Description: to.Ptr("product description."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutProduct.json -func ExampleProductsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", armsphere.Product{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Product = armsphere.Product{ - // Name: to.Ptr("MyProduct1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchProduct.json -func ExampleProductsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", armsphere.ProductUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Product = armsphere.Product{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // Properties: &armsphere.ProductProperties{ - // Description: to.Ptr("Product description."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteProduct.json -func ExampleProductsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProductName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesProduct.json -func ExampleProductsClient_CountDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().CountDevices(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CountDeviceResponse = armsphere.CountDeviceResponse{ - // Value: to.Ptr[int32](3), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDefaultDeviceGroups.json -func ExampleProductsClient_NewGenerateDefaultDeviceGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewGenerateDefaultDeviceGroupsPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeviceGroupListResult = armsphere.DeviceGroupListResult{ - // Value: []*armsphere.DeviceGroup{ - // { - // Name: to.Ptr("MyDeviceGroup1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("Device group description 1"), - // AllowCrashDumpsCollection: to.Ptr(armsphere.AllowCrashDumpCollectionEnabled), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // }, - // { - // Name: to.Ptr("MyDeviceGroup2"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup2"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("Device group description 2"), - // AllowCrashDumpsCollection: to.Ptr(armsphere.AllowCrashDumpCollectionEnabled), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/response_types.go b/sdk/resourcemanager/sphere/armsphere/response_types.go index 2ed6f18efe52..1caf996df4fb 100644 --- a/sdk/resourcemanager/sphere/armsphere/response_types.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere // CatalogsClientCountDevicesResponse contains the response from method CatalogsClient.CountDevices. type CatalogsClientCountDevicesResponse struct { + // Response to the action call for count devices in a catalog. CountDeviceResponse } // CatalogsClientCreateOrUpdateResponse contains the response from method CatalogsClient.BeginCreateOrUpdate. type CatalogsClientCreateOrUpdateResponse struct { + // An Azure Sphere catalog Catalog } @@ -26,66 +27,79 @@ type CatalogsClientDeleteResponse struct { // CatalogsClientGetResponse contains the response from method CatalogsClient.Get. type CatalogsClientGetResponse struct { + // An Azure Sphere catalog Catalog } // CatalogsClientListByResourceGroupResponse contains the response from method CatalogsClient.NewListByResourceGroupPager. type CatalogsClientListByResourceGroupResponse struct { + // The response of a Catalog list operation. CatalogListResult } // CatalogsClientListBySubscriptionResponse contains the response from method CatalogsClient.NewListBySubscriptionPager. type CatalogsClientListBySubscriptionResponse struct { + // The response of a Catalog list operation. CatalogListResult } // CatalogsClientListDeploymentsResponse contains the response from method CatalogsClient.NewListDeploymentsPager. type CatalogsClientListDeploymentsResponse struct { + // The response of a Deployment list operation. DeploymentListResult } // CatalogsClientListDeviceGroupsResponse contains the response from method CatalogsClient.NewListDeviceGroupsPager. type CatalogsClientListDeviceGroupsResponse struct { + // The response of a DeviceGroup list operation. DeviceGroupListResult } // CatalogsClientListDeviceInsightsResponse contains the response from method CatalogsClient.NewListDeviceInsightsPager. type CatalogsClientListDeviceInsightsResponse struct { + // Paged collection of DeviceInsight items PagedDeviceInsight } // CatalogsClientListDevicesResponse contains the response from method CatalogsClient.NewListDevicesPager. type CatalogsClientListDevicesResponse struct { + // The response of a Device list operation. DeviceListResult } // CatalogsClientUpdateResponse contains the response from method CatalogsClient.Update. type CatalogsClientUpdateResponse struct { + // An Azure Sphere catalog Catalog } // CertificatesClientGetResponse contains the response from method CertificatesClient.Get. type CertificatesClientGetResponse struct { + // An certificate resource belonging to a catalog resource. Certificate } // CertificatesClientListByCatalogResponse contains the response from method CertificatesClient.NewListByCatalogPager. type CertificatesClientListByCatalogResponse struct { + // The response of a Certificate list operation. CertificateListResult } // CertificatesClientRetrieveCertChainResponse contains the response from method CertificatesClient.RetrieveCertChain. type CertificatesClientRetrieveCertChainResponse struct { + // The certificate chain response. CertificateChainResponse } // CertificatesClientRetrieveProofOfPossessionNonceResponse contains the response from method CertificatesClient.RetrieveProofOfPossessionNonce. type CertificatesClientRetrieveProofOfPossessionNonceResponse struct { + // Result of the action to generate a proof of possession nonce ProofOfPossessionNonceResponse } // DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.BeginCreateOrUpdate. type DeploymentsClientCreateOrUpdateResponse struct { + // An deployment resource belonging to a device group resource. Deployment } @@ -96,11 +110,13 @@ type DeploymentsClientDeleteResponse struct { // DeploymentsClientGetResponse contains the response from method DeploymentsClient.Get. type DeploymentsClientGetResponse struct { + // An deployment resource belonging to a device group resource. Deployment } // DeploymentsClientListByDeviceGroupResponse contains the response from method DeploymentsClient.NewListByDeviceGroupPager. type DeploymentsClientListByDeviceGroupResponse struct { + // The response of a Deployment list operation. DeploymentListResult } @@ -111,11 +127,13 @@ type DeviceGroupsClientClaimDevicesResponse struct { // DeviceGroupsClientCountDevicesResponse contains the response from method DeviceGroupsClient.CountDevices. type DeviceGroupsClientCountDevicesResponse struct { + // Response to the action call for count devices in a catalog. CountDeviceResponse } // DeviceGroupsClientCreateOrUpdateResponse contains the response from method DeviceGroupsClient.BeginCreateOrUpdate. type DeviceGroupsClientCreateOrUpdateResponse struct { + // An device group resource belonging to a product resource. DeviceGroup } @@ -126,21 +144,25 @@ type DeviceGroupsClientDeleteResponse struct { // DeviceGroupsClientGetResponse contains the response from method DeviceGroupsClient.Get. type DeviceGroupsClientGetResponse struct { + // An device group resource belonging to a product resource. DeviceGroup } // DeviceGroupsClientListByProductResponse contains the response from method DeviceGroupsClient.NewListByProductPager. type DeviceGroupsClientListByProductResponse struct { + // The response of a DeviceGroup list operation. DeviceGroupListResult } // DeviceGroupsClientUpdateResponse contains the response from method DeviceGroupsClient.BeginUpdate. type DeviceGroupsClientUpdateResponse struct { + // An device group resource belonging to a product resource. DeviceGroup } // DevicesClientCreateOrUpdateResponse contains the response from method DevicesClient.BeginCreateOrUpdate. type DevicesClientCreateOrUpdateResponse struct { + // An device resource belonging to a device group resource. Device } @@ -151,26 +173,31 @@ type DevicesClientDeleteResponse struct { // DevicesClientGenerateCapabilityImageResponse contains the response from method DevicesClient.BeginGenerateCapabilityImage. type DevicesClientGenerateCapabilityImageResponse struct { + // Signed device capability image response SignedCapabilityImageResponse } // DevicesClientGetResponse contains the response from method DevicesClient.Get. type DevicesClientGetResponse struct { + // An device resource belonging to a device group resource. Device } // DevicesClientListByDeviceGroupResponse contains the response from method DevicesClient.NewListByDeviceGroupPager. type DevicesClientListByDeviceGroupResponse struct { + // The response of a Device list operation. DeviceListResult } // DevicesClientUpdateResponse contains the response from method DevicesClient.BeginUpdate. type DevicesClientUpdateResponse struct { + // An device resource belonging to a device group resource. Device } // ImagesClientCreateOrUpdateResponse contains the response from method ImagesClient.BeginCreateOrUpdate. type ImagesClientCreateOrUpdateResponse struct { + // An image resource belonging to a catalog resource. Image } @@ -181,26 +208,31 @@ type ImagesClientDeleteResponse struct { // ImagesClientGetResponse contains the response from method ImagesClient.Get. type ImagesClientGetResponse struct { + // An image resource belonging to a catalog resource. Image } // ImagesClientListByCatalogResponse contains the response from method ImagesClient.NewListByCatalogPager. type ImagesClientListByCatalogResponse struct { + // The response of a Image list operation. ImageListResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // ProductsClientCountDevicesResponse contains the response from method ProductsClient.CountDevices. type ProductsClientCountDevicesResponse struct { + // Response to the action call for count devices in a catalog. CountDeviceResponse } // ProductsClientCreateOrUpdateResponse contains the response from method ProductsClient.BeginCreateOrUpdate. type ProductsClientCreateOrUpdateResponse struct { + // An product resource belonging to a catalog resource. Product } @@ -211,20 +243,24 @@ type ProductsClientDeleteResponse struct { // ProductsClientGenerateDefaultDeviceGroupsResponse contains the response from method ProductsClient.NewGenerateDefaultDeviceGroupsPager. type ProductsClientGenerateDefaultDeviceGroupsResponse struct { + // The response of a DeviceGroup list operation. DeviceGroupListResult } // ProductsClientGetResponse contains the response from method ProductsClient.Get. type ProductsClientGetResponse struct { + // An product resource belonging to a catalog resource. Product } // ProductsClientListByCatalogResponse contains the response from method ProductsClient.NewListByCatalogPager. type ProductsClientListByCatalogResponse struct { + // The response of a Product list operation. ProductListResult } // ProductsClientUpdateResponse contains the response from method ProductsClient.BeginUpdate. type ProductsClientUpdateResponse struct { + // An product resource belonging to a catalog resource. Product } diff --git a/sdk/resourcemanager/sphere/armsphere/time_rfc3339.go b/sdk/resourcemanager/sphere/armsphere/time_rfc3339.go index bc5392a6aa76..926b14017a34 100644 --- a/sdk/resourcemanager/sphere/armsphere/time_rfc3339.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere