From 0fcff99fa0e20406a6e64fb7308b9efc2360ad82 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 14 Aug 2023 23:27:24 +0000 Subject: [PATCH] CodeGen from PR 23758 in Azure/azure-rest-api-specs Merge 97e52dfdd8c79bc2a521221749a126f292439776 into baac183ffa684d94f697f0fc6f480e02cfb00f3d --- .../iothub/armiothub/CHANGELOG.md | 12 + .../iothub/armiothub/autorest.md | 7 +- .../iothub/armiothub/certificates_client.go | 100 +- .../certificates_client_example_test.go | 216 --- .../iothub/armiothub/client.go | 27 +- .../iothub/armiothub/client_example_test.go | 42 - .../iothub/armiothub/client_factory.go | 31 +- .../iothub/armiothub/constants.go | 77 +- sdk/resourcemanager/iothub/armiothub/go.mod | 12 +- sdk/resourcemanager/iothub/armiothub/go.sum | 20 +- .../iothub/armiothub/models.go | 242 +-- .../iothub/armiothub/models_serde.go | 15 +- .../iothub/armiothub/operations_client.go | 7 +- .../operations_client_example_test.go | 361 ---- .../iothub/armiothub/options.go | 223 +++ .../privateendpointconnections_client.go | 76 +- ...endpointconnections_client_example_test.go | 175 -- .../armiothub/privatelinkresources_client.go | 33 +- ...rivatelinkresources_client_example_test.go | 85 - .../iothub/armiothub/resource_client.go | 309 ++-- .../armiothub/resource_client_example_test.go | 1535 ----------------- .../resourceprovidercommon_client.go | 18 +- ...ourceprovidercommon_client_example_test.go | 52 - .../iothub/armiothub/response_types.go | 38 +- .../iothub/armiothub/time_rfc1123.go | 3 +- .../iothub/armiothub/time_rfc3339.go | 3 +- 26 files changed, 708 insertions(+), 3011 deletions(-) delete mode 100644 sdk/resourcemanager/iothub/armiothub/certificates_client_example_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/client_example_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/operations_client_example_test.go create mode 100644 sdk/resourcemanager/iothub/armiothub/options.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/resource_client_example_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client_example_test.go diff --git a/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md b/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md index b6aeb98edd68..ca2e36d1814c 100644 --- a/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md +++ b/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 1.2.0-beta.2 (2023-08-14) +### Breaking Changes + +- Field `CollectionName` of struct `RoutingCosmosDBSQLAPIProperties` has been removed +- Field `CosmosDBSQLCollections` of struct `RoutingEndpoints` has been removed + +### Features Added + +- New field `ContainerName` in struct `RoutingCosmosDBSQLAPIProperties` +- New field `CosmosDBSQLContainers` in struct `RoutingEndpoints` + + ## 1.2.0-beta.1 (2023-04-28) ### Features Added diff --git a/sdk/resourcemanager/iothub/armiothub/autorest.md b/sdk/resourcemanager/iothub/armiothub/autorest.md index 33277badb6c6..756c992db1d7 100644 --- a/sdk/resourcemanager/iothub/armiothub/autorest.md +++ b/sdk/resourcemanager/iothub/armiothub/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/iothub/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/iothub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0-beta.1 -tag: package-preview-2022-11 +module-version: 1.2.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/iothub/armiothub/certificates_client.go b/sdk/resourcemanager/iothub/armiothub/certificates_client.go index a94873cc1c82..5d3352cacabb 100644 --- a/sdk/resourcemanager/iothub/armiothub/certificates_client.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -47,7 +46,7 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Adds new or replaces existing certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - certificateName - The name of the certificate @@ -55,18 +54,21 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // - options - CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate // method. func (client *CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateDescription CertificateDescription, options *CertificatesClientCreateOrUpdateOptions) (CertificatesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, certificateName, certificateDescription, options) if err != nil { return CertificatesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return CertificatesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -93,13 +95,16 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, certificateDescription) + if err := runtime.MarshalAsJSON(req, certificateDescription); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -114,23 +119,25 @@ func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes an existing X509 certificate or does nothing if it does not exist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - certificateName - The name of the certificate // - ifMatch - ETag of the Certificate. // - options - CertificatesClientDeleteOptions contains the optional parameters for the CertificatesClient.Delete method. func (client *CertificatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, options *CertificatesClientDeleteOptions) (CertificatesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, certificateName, ifMatch, options) if err != nil { return CertificatesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return CertificatesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientDeleteResponse{}, err } return CertificatesClientDeleteResponse{}, nil } @@ -159,7 +166,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -170,7 +177,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou // to generate a leaf certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - certificateName - The name of the certificate @@ -178,18 +185,21 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou // - options - CertificatesClientGenerateVerificationCodeOptions contains the optional parameters for the CertificatesClient.GenerateVerificationCode // method. func (client *CertificatesClient) GenerateVerificationCode(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, options *CertificatesClientGenerateVerificationCodeOptions) (CertificatesClientGenerateVerificationCodeResponse, error) { + var err error req, err := client.generateVerificationCodeCreateRequest(ctx, resourceGroupName, resourceName, certificateName, ifMatch, options) if err != nil { return CertificatesClientGenerateVerificationCodeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientGenerateVerificationCodeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CertificatesClientGenerateVerificationCodeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientGenerateVerificationCodeResponse{}, err } - return client.generateVerificationCodeHandleResponse(resp) + resp, err := client.generateVerificationCodeHandleResponse(httpResp) + return resp, err } // generateVerificationCodeCreateRequest creates the GenerateVerificationCode request. @@ -216,7 +226,7 @@ func (client *CertificatesClient) generateVerificationCodeCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -235,24 +245,27 @@ func (client *CertificatesClient) generateVerificationCodeHandleResponse(resp *h // Get - Returns the certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - certificateName - The name of the certificate // - options - CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. func (client *CertificatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CertificatesClientGetOptions) (CertificatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, certificateName, 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. @@ -279,7 +292,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,24 +310,27 @@ func (client *CertificatesClient) getHandleResponse(resp *http.Response) (Certif // ListByIotHub - Returns the list of certificates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - CertificatesClientListByIotHubOptions contains the optional parameters for the CertificatesClient.ListByIotHub // method. func (client *CertificatesClient) ListByIotHub(ctx context.Context, resourceGroupName string, resourceName string, options *CertificatesClientListByIotHubOptions) (CertificatesClientListByIotHubResponse, error) { + var err error req, err := client.listByIotHubCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return CertificatesClientListByIotHubResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientListByIotHubResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CertificatesClientListByIotHubResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientListByIotHubResponse{}, err } - return client.listByIotHubHandleResponse(resp) + resp, err := client.listByIotHubHandleResponse(httpResp) + return resp, err } // listByIotHubCreateRequest creates the ListByIotHub request. @@ -337,7 +353,7 @@ func (client *CertificatesClient) listByIotHubCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -356,7 +372,7 @@ func (client *CertificatesClient) listByIotHubHandleResponse(resp *http.Response // certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - certificateName - The name of the certificate @@ -364,18 +380,21 @@ func (client *CertificatesClient) listByIotHubHandleResponse(resp *http.Response // - certificateVerificationBody - The name of the certificate // - options - CertificatesClientVerifyOptions contains the optional parameters for the CertificatesClient.Verify method. func (client *CertificatesClient) Verify(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, certificateVerificationBody CertificateVerificationDescription, options *CertificatesClientVerifyOptions) (CertificatesClientVerifyResponse, error) { + var err error req, err := client.verifyCreateRequest(ctx, resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody, options) if err != nil { return CertificatesClientVerifyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CertificatesClientVerifyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CertificatesClientVerifyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificatesClientVerifyResponse{}, err } - return client.verifyHandleResponse(resp) + resp, err := client.verifyHandleResponse(httpResp) + return resp, err } // verifyCreateRequest creates the Verify request. @@ -402,11 +421,14 @@ func (client *CertificatesClient) verifyCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, certificateVerificationBody) + if err := runtime.MarshalAsJSON(req, certificateVerificationBody); err != nil { + return nil, err + } + return req, nil } // verifyHandleResponse handles the Verify response. diff --git a/sdk/resourcemanager/iothub/armiothub/certificates_client_example_test.go b/sdk/resourcemanager/iothub/armiothub/certificates_client_example_test.go deleted file mode 100644 index 33300119cff6..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/certificates_client_example_test.go +++ /dev/null @@ -1,216 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listcertificates.json -func ExampleCertificatesClient_ListByIotHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().ListByIotHub(ctx, "myResourceGroup", "testhub", 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.CertificateListDescription = armiothub.CertificateListDescription{ - // Value: []*armiothub.CertificateDescription{ - // { - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/Certificates"), - // Etag: to.Ptr("AAAAAAExpNs="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/andbuc-hub/certificates/cert"), - // Properties: &armiothub.CertificateProperties{ - // Certificate: to.Ptr("############################################"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Sat, 31 Dec 2039 23:59:59 GMT"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=testdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_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 := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().Get(ctx, "myResourceGroup", "testhub", "cert", 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.CertificateDescription = armiothub.CertificateDescription{ - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/Certificates"), - // Etag: to.Ptr("AAAAAAExpNs="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/andbuc-hub/certificates/cert"), - // Properties: &armiothub.CertificateProperties{ - // Certificate: to.Ptr("############################################"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Sat, 31 Dec 2039 23:59:59 GMT"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=testdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certificatescreateorupdate.json -func ExampleCertificatesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().CreateOrUpdate(ctx, "myResourceGroup", "iothub", "cert", armiothub.CertificateDescription{ - Properties: &armiothub.CertificateProperties{ - Certificate: to.Ptr("############################################"), - }, - }, &armiothub.CertificatesClientCreateOrUpdateOptions{IfMatch: 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.CertificateDescription = armiothub.CertificateDescription{ - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/Certificates"), - // Etag: to.Ptr("AAAAAAExpNs="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServives/myFirstProvisioningService/certificates/cert"), - // Properties: &armiothub.CertificateProperties{ - // Certificate: to.Ptr("############################################"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Sat, 31 Dec 2039 23:59:59 GMT"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=testdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certificatesdelete.json -func ExampleCertificatesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCertificatesClient().Delete(ctx, "myResourceGroup", "myhub", "cert", "AAAAAAAADGk=", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_generateverificationcode.json -func ExampleCertificatesClient_GenerateVerificationCode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().GenerateVerificationCode(ctx, "myResourceGroup", "testHub", "cert", "AAAAAAAADGk=", 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.CertificateWithNonceDescription = armiothub.CertificateWithNonceDescription{ - // Name: to.Ptr("cert"), - // Properties: &armiothub.CertificatePropertiesWithNonce{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Sat, 31 Dec 2039 23:59:59 GMT"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=andbucdevice1"), - // Thumbprint: to.Ptr("##############################"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:26:56 GMT"); return t}()), - // VerificationCode: to.Ptr("##################################"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certverify.json -func ExampleCertificatesClient_Verify() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().Verify(ctx, "myResourceGroup", "myFirstProvisioningService", "cert", "AAAAAAAADGk=", armiothub.CertificateVerificationDescription{ - Certificate: to.Ptr("#####################################"), - }, 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.CertificateDescription = armiothub.CertificateDescription{ - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/Certificates"), - // Etag: to.Ptr("AAAAAAExpTQ="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/certificates/cert"), - // Properties: &armiothub.CertificateProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:23:50 GMT"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Sat, 31 Dec 2039 23:59:59 GMT"); return t}()), - // IsVerified: to.Ptr(true), - // Subject: to.Ptr("CN=andbucdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 12 Oct 2017 19:26:56 GMT"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/iothub/armiothub/client.go b/sdk/resourcemanager/iothub/armiothub/client.go index 3b69a383173c..fa463ad90bf9 100644 --- a/sdk/resourcemanager/iothub/armiothub/client.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -47,7 +46,7 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // BeginManualFailover - Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - iotHubName - Name of the IoT hub to failover // - resourceGroupName - Name of the resource group containing the IoT hub resource // - failoverInput - Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the @@ -59,7 +58,8 @@ func (client *Client) BeginManualFailover(ctx context.Context, iotHubName string if err != nil { return nil, err } - return runtime.NewPoller[ClientManualFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ClientManualFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientManualFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *Client) BeginManualFailover(ctx context.Context, iotHubName string // ManualFailover - Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview func (client *Client) manualFailover(ctx context.Context, iotHubName string, resourceGroupName string, failoverInput FailoverInput, options *ClientBeginManualFailoverOptions) (*http.Response, error) { + var err error req, err := client.manualFailoverCreateRequest(ctx, iotHubName, resourceGroupName, failoverInput, 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 } // manualFailoverCreateRequest creates the ManualFailover request. @@ -104,8 +106,11 @@ func (client *Client) manualFailoverCreateRequest(ctx context.Context, iotHubNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, failoverInput) + if err := runtime.MarshalAsJSON(req, failoverInput); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/client_example_test.go b/sdk/resourcemanager/iothub/armiothub/client_example_test.go deleted file mode 100644 index d60ec110115b..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/client_example_test.go +++ /dev/null @@ -1,42 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/IotHub_ManualFailover.json -func ExampleClient_BeginManualFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginManualFailover(ctx, "testHub", "myResourceGroup", armiothub.FailoverInput{ - FailoverRegion: to.Ptr("testHub"), - }, 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/iothub/armiothub/client_factory.go b/sdk/resourcemanager/iothub/armiothub/client_factory.go index 93ee51970459..37aba63f64b6 100644 --- a/sdk/resourcemanager/iothub/armiothub/client_factory.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -38,37 +37,37 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { + subClient, _ := NewCertificatesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewResourceClient() *ResourceClient { - subClient, _ := NewResourceClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewResourceProviderCommonClient() *ResourceProviderCommonClient { - subClient, _ := NewResourceProviderCommonClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { - subClient, _ := NewCertificatesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewResourceClient() *ResourceClient { + subClient, _ := NewResourceClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewResourceProviderCommonClient() *ResourceProviderCommonClient { + subClient, _ := NewResourceProviderCommonClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/iothub/armiothub/constants.go b/sdk/resourcemanager/iothub/armiothub/constants.go index 516ac605b87c..0dd5ef43f7cd 100644 --- a/sdk/resourcemanager/iothub/armiothub/constants.go +++ b/sdk/resourcemanager/iothub/armiothub/constants.go @@ -3,56 +3,55 @@ // 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 armiothub const ( moduleName = "armiothub" - moduleVersion = "v1.2.0-beta.1" + moduleVersion = "v1.2.0-beta.2" ) // AccessRights - The permissions assigned to the shared access policy. type AccessRights string const ( - AccessRightsRegistryRead AccessRights = "RegistryRead" - AccessRightsRegistryWrite AccessRights = "RegistryWrite" - AccessRightsServiceConnect AccessRights = "ServiceConnect" AccessRightsDeviceConnect AccessRights = "DeviceConnect" - AccessRightsRegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" - AccessRightsRegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" + AccessRightsRegistryRead AccessRights = "RegistryRead" AccessRightsRegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" - AccessRightsRegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" - AccessRightsRegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" - AccessRightsServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" - AccessRightsRegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" + AccessRightsRegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" AccessRightsRegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" + AccessRightsRegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" + AccessRightsRegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + AccessRightsRegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" AccessRightsRegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" + AccessRightsRegistryWrite AccessRights = "RegistryWrite" + AccessRightsRegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" + AccessRightsRegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" AccessRightsRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" - AccessRightsRegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + AccessRightsServiceConnect AccessRights = "ServiceConnect" + AccessRightsServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" ) // PossibleAccessRightsValues returns the possible values for the AccessRights const type. func PossibleAccessRightsValues() []AccessRights { return []AccessRights{ - AccessRightsRegistryRead, - AccessRightsRegistryWrite, - AccessRightsServiceConnect, AccessRightsDeviceConnect, - AccessRightsRegistryReadRegistryWrite, - AccessRightsRegistryReadServiceConnect, + AccessRightsRegistryRead, AccessRightsRegistryReadDeviceConnect, - AccessRightsRegistryWriteServiceConnect, - AccessRightsRegistryWriteDeviceConnect, - AccessRightsServiceConnectDeviceConnect, - AccessRightsRegistryReadRegistryWriteServiceConnect, + AccessRightsRegistryReadRegistryWrite, AccessRightsRegistryReadRegistryWriteDeviceConnect, + AccessRightsRegistryReadRegistryWriteServiceConnect, + AccessRightsRegistryReadRegistryWriteServiceConnectDeviceConnect, + AccessRightsRegistryReadServiceConnect, AccessRightsRegistryReadServiceConnectDeviceConnect, + AccessRightsRegistryWrite, + AccessRightsRegistryWriteDeviceConnect, + AccessRightsRegistryWriteServiceConnect, AccessRightsRegistryWriteServiceConnectDeviceConnect, - AccessRightsRegistryReadRegistryWriteServiceConnectDeviceConnect, + AccessRightsServiceConnect, + AccessRightsServiceConnectDeviceConnect, } } @@ -191,15 +190,15 @@ func PossibleIPVersionValues() []IPVersion { type IotHubNameUnavailabilityReason string const ( - IotHubNameUnavailabilityReasonInvalid IotHubNameUnavailabilityReason = "Invalid" IotHubNameUnavailabilityReasonAlreadyExists IotHubNameUnavailabilityReason = "AlreadyExists" + IotHubNameUnavailabilityReasonInvalid IotHubNameUnavailabilityReason = "Invalid" ) // PossibleIotHubNameUnavailabilityReasonValues returns the possible values for the IotHubNameUnavailabilityReason const type. func PossibleIotHubNameUnavailabilityReasonValues() []IotHubNameUnavailabilityReason { return []IotHubNameUnavailabilityReason{ - IotHubNameUnavailabilityReasonInvalid, IotHubNameUnavailabilityReasonAlreadyExists, + IotHubNameUnavailabilityReasonInvalid, } } @@ -251,17 +250,17 @@ func PossibleIotHubSKUValues() []IotHubSKU { type IotHubSKUTier string const ( + IotHubSKUTierBasic IotHubSKUTier = "Basic" IotHubSKUTierFree IotHubSKUTier = "Free" IotHubSKUTierStandard IotHubSKUTier = "Standard" - IotHubSKUTierBasic IotHubSKUTier = "Basic" ) // PossibleIotHubSKUTierValues returns the possible values for the IotHubSKUTier const type. func PossibleIotHubSKUTierValues() []IotHubSKUTier { return []IotHubSKUTier{ + IotHubSKUTierBasic, IotHubSKUTierFree, IotHubSKUTierStandard, - IotHubSKUTierBasic, } } @@ -287,23 +286,23 @@ func PossibleIotHubScaleTypeValues() []IotHubScaleType { type JobStatus string const ( - JobStatusUnknown JobStatus = "unknown" - JobStatusEnqueued JobStatus = "enqueued" - JobStatusRunning JobStatus = "running" + JobStatusCancelled JobStatus = "cancelled" JobStatusCompleted JobStatus = "completed" + JobStatusEnqueued JobStatus = "enqueued" JobStatusFailed JobStatus = "failed" - JobStatusCancelled JobStatus = "cancelled" + JobStatusRunning JobStatus = "running" + JobStatusUnknown JobStatus = "unknown" ) // PossibleJobStatusValues returns the possible values for the JobStatus const type. func PossibleJobStatusValues() []JobStatus { return []JobStatus{ - JobStatusUnknown, - JobStatusEnqueued, - JobStatusRunning, + JobStatusCancelled, JobStatusCompleted, + JobStatusEnqueued, JobStatusFailed, - JobStatusCancelled, + JobStatusRunning, + JobStatusUnknown, } } @@ -395,19 +394,19 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { type ResourceIdentityType string const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ) // PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. func PossibleResourceIdentityTypeValues() []ResourceIdentityType { return []ResourceIdentityType{ + ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, - ResourceIdentityTypeNone, + ResourceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/iothub/armiothub/go.mod b/sdk/resourcemanager/iothub/armiothub/go.mod index 78465280f0bd..6659f0a499f8 100644 --- a/sdk/resourcemanager/iothub/armiothub/go.mod +++ b/sdk/resourcemanager/iothub/armiothub/go.mod @@ -3,14 +3,14 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -21,9 +21,9 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + 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.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/iothub/armiothub/go.sum b/sdk/resourcemanager/iothub/armiothub/go.sum index 6e2c77825a2c..93fdfc2850cd 100644 --- a/sdk/resourcemanager/iothub/armiothub/go.sum +++ b/sdk/resourcemanager/iothub/armiothub/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/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/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/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/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= @@ -31,13 +31,13 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/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.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +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/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/iothub/armiothub/models.go b/sdk/resourcemanager/iothub/armiothub/models.go index 0bae03fd62e3..5e968152435b 100644 --- a/sdk/resourcemanager/iothub/armiothub/models.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -159,44 +158,6 @@ type CertificateWithNonceDescription struct { Type *string } -// CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate method. -type CertificatesClientCreateOrUpdateOptions struct { - // ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. - IfMatch *string -} - -// CertificatesClientDeleteOptions contains the optional parameters for the CertificatesClient.Delete method. -type CertificatesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// CertificatesClientGenerateVerificationCodeOptions contains the optional parameters for the CertificatesClient.GenerateVerificationCode -// method. -type CertificatesClientGenerateVerificationCodeOptions struct { - // placeholder for future optional parameters -} - -// CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. -type CertificatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// CertificatesClientListByIotHubOptions contains the optional parameters for the CertificatesClient.ListByIotHub method. -type CertificatesClientListByIotHubOptions struct { - // placeholder for future optional parameters -} - -// CertificatesClientVerifyOptions contains the optional parameters for the CertificatesClient.Verify method. -type CertificatesClientVerifyOptions struct { - // placeholder for future optional parameters -} - -// ClientBeginManualFailoverOptions contains the optional parameters for the Client.BeginManualFailover method. -type ClientBeginManualFailoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // CloudToDeviceProperties - The IoT hub cloud-to-device messaging properties. type CloudToDeviceProperties struct { // The default time to live for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. @@ -680,11 +641,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpoint - The private endpoint property of a private endpoint connection type PrivateEndpoint struct { // READ-ONLY; The resource identifier. @@ -715,48 +671,12 @@ type PrivateEndpointConnectionProperties struct { PrivateEndpoint *PrivateEndpoint } -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdate -// method. -type PrivateEndpointConnectionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List -// method. -type PrivateEndpointConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkResources - The available private link resources for an IotHub type PrivateLinkResources struct { // The list of available private link resources for an IotHub Value []*GroupIDInformation } -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. -type PrivateLinkResourcesClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionState - The current state of a private endpoint connection type PrivateLinkServiceConnectionState struct { // REQUIRED; The description for the current state of a private endpoint connection @@ -918,140 +838,6 @@ type Resource struct { Type *string } -// ResourceClientBeginCreateOrUpdateOptions contains the optional parameters for the ResourceClient.BeginCreateOrUpdate method. -type ResourceClientBeginCreateOrUpdateOptions struct { - // ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. - IfMatch *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourceClientBeginDeleteOptions contains the optional parameters for the ResourceClient.BeginDelete method. -type ResourceClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourceClientBeginUpdateOptions contains the optional parameters for the ResourceClient.BeginUpdate method. -type ResourceClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourceClientCheckNameAvailabilityOptions contains the optional parameters for the ResourceClient.CheckNameAvailability -// method. -type ResourceClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientCreateEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.CreateEventHubConsumerGroup -// method. -type ResourceClientCreateEventHubConsumerGroupOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientDeleteEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.DeleteEventHubConsumerGroup -// method. -type ResourceClientDeleteEventHubConsumerGroupOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientExportDevicesOptions contains the optional parameters for the ResourceClient.ExportDevices method. -type ResourceClientExportDevicesOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetEndpointHealthOptions contains the optional parameters for the ResourceClient.NewGetEndpointHealthPager -// method. -type ResourceClientGetEndpointHealthOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.GetEventHubConsumerGroup -// method. -type ResourceClientGetEventHubConsumerGroupOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetJobOptions contains the optional parameters for the ResourceClient.GetJob method. -type ResourceClientGetJobOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetKeysForKeyNameOptions contains the optional parameters for the ResourceClient.GetKeysForKeyName method. -type ResourceClientGetKeysForKeyNameOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetOptions contains the optional parameters for the ResourceClient.Get method. -type ResourceClientGetOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetQuotaMetricsOptions contains the optional parameters for the ResourceClient.NewGetQuotaMetricsPager method. -type ResourceClientGetQuotaMetricsOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetStatsOptions contains the optional parameters for the ResourceClient.GetStats method. -type ResourceClientGetStatsOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientGetValidSKUsOptions contains the optional parameters for the ResourceClient.NewGetValidSKUsPager method. -type ResourceClientGetValidSKUsOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientImportDevicesOptions contains the optional parameters for the ResourceClient.ImportDevices method. -type ResourceClientImportDevicesOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientListByResourceGroupOptions contains the optional parameters for the ResourceClient.NewListByResourceGroupPager -// method. -type ResourceClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientListBySubscriptionOptions contains the optional parameters for the ResourceClient.NewListBySubscriptionPager -// method. -type ResourceClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientListEventHubConsumerGroupsOptions contains the optional parameters for the ResourceClient.NewListEventHubConsumerGroupsPager -// method. -type ResourceClientListEventHubConsumerGroupsOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientListJobsOptions contains the optional parameters for the ResourceClient.NewListJobsPager method. -type ResourceClientListJobsOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientListKeysOptions contains the optional parameters for the ResourceClient.NewListKeysPager method. -type ResourceClientListKeysOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientTestAllRoutesOptions contains the optional parameters for the ResourceClient.TestAllRoutes method. -type ResourceClientTestAllRoutesOptions struct { - // placeholder for future optional parameters -} - -// ResourceClientTestRouteOptions contains the optional parameters for the ResourceClient.TestRoute method. -type ResourceClientTestRouteOptions struct { - // placeholder for future optional parameters -} - -// ResourceProviderCommonClientGetSubscriptionQuotaOptions contains the optional parameters for the ResourceProviderCommonClient.GetSubscriptionQuota -// method. -type ResourceProviderCommonClientGetSubscriptionQuotaOptions struct { - // placeholder for future optional parameters -} - // RootCertificateProperties - This property store root certificate related information type RootCertificateProperties struct { // This property when set to true, hub will use G2 cert; while it's set to false, hub uses Baltimore Cert. @@ -1113,10 +899,10 @@ type RouteProperties struct { Condition *string } -// RoutingCosmosDBSQLAPIProperties - The properties related to a cosmos DB sql collection endpoint. +// RoutingCosmosDBSQLAPIProperties - The properties related to a cosmos DB sql container endpoint. type RoutingCosmosDBSQLAPIProperties struct { - // REQUIRED; The name of the cosmos DB sql collection in the cosmos DB database. - CollectionName *string + // REQUIRED; The name of the cosmos DB sql container in the cosmos DB database. + ContainerName *string // REQUIRED; The name of the cosmos DB database in the cosmos DB account. DatabaseName *string @@ -1129,22 +915,22 @@ type RoutingCosmosDBSQLAPIProperties struct { // events, fileNotifications, $default. Endpoint names must be unique across endpoint types. Name *string - // Method used to authenticate against the cosmos DB sql collection endpoint + // Method used to authenticate against the cosmos DB sql container endpoint AuthenticationType *AuthenticationType - // Id of the cosmos DB sql collection endpoint + // Id of the cosmos DB sql container endpoint ID *string - // Managed identity properties of routing cosmos DB collection endpoint. + // Managed identity properties of routing cosmos DB container endpoint. Identity *ManagedIdentity - // The name of the partition key associated with this cosmos DB sql collection if one exists. This is an optional parameter. + // The name of the partition key associated with this cosmos DB sql container if one exists. This is an optional parameter. PartitionKeyName *string - // The template for generating a synthetic partition key value for use with this cosmos DB sql collection. The template must - // include at least one of the following placeholders: {iothub}, {deviceid}, - // {DD}, {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and non-placeholder components are - // arbitrary. This parameter is only required if PartitionKeyName is specified. + // The template for generating a synthetic partition key value for use with this cosmos DB sql container. The template must + // include at least one of the following placeholders: {iothub}, {deviceid}, {DD}, + // {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and non-placeholder components are arbitrary. + // This parameter is only required if PartitionKeyName is specified. PartitionKeyTemplate *string // The primary key of the cosmos DB account. @@ -1164,8 +950,8 @@ type RoutingCosmosDBSQLAPIProperties struct { // rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs // and only 1 custom endpoint is allowed across all endpoint types for free hubs. type RoutingEndpoints struct { - // The list of Cosmos DB collection endpoints that IoT hub routes messages to, based on the routing rules. - CosmosDBSQLCollections []*RoutingCosmosDBSQLAPIProperties + // The list of Cosmos DB container endpoints that IoT hub routes messages to, based on the routing rules. + CosmosDBSQLContainers []*RoutingCosmosDBSQLAPIProperties // The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include // the built-in Event Hubs endpoint. diff --git a/sdk/resourcemanager/iothub/armiothub/models_serde.go b/sdk/resourcemanager/iothub/armiothub/models_serde.go index 349b538e0e49..7cd68a73c5b6 100644 --- a/sdk/resourcemanager/iothub/armiothub/models_serde.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -2346,7 +2345,7 @@ func (r *RouteProperties) UnmarshalJSON(data []byte) error { func (r RoutingCosmosDBSQLAPIProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "authenticationType", r.AuthenticationType) - populate(objectMap, "collectionName", r.CollectionName) + populate(objectMap, "containerName", r.ContainerName) populate(objectMap, "databaseName", r.DatabaseName) populate(objectMap, "endpointUri", r.EndpointURI) populate(objectMap, "id", r.ID) @@ -2373,8 +2372,8 @@ func (r *RoutingCosmosDBSQLAPIProperties) UnmarshalJSON(data []byte) error { case "authenticationType": err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) delete(rawMsg, key) - case "collectionName": - err = unpopulate(val, "CollectionName", &r.CollectionName) + case "containerName": + err = unpopulate(val, "ContainerName", &r.ContainerName) delete(rawMsg, key) case "databaseName": err = unpopulate(val, "DatabaseName", &r.DatabaseName) @@ -2420,7 +2419,7 @@ func (r *RoutingCosmosDBSQLAPIProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RoutingEndpoints. func (r RoutingEndpoints) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cosmosDBSqlCollections", r.CosmosDBSQLCollections) + populate(objectMap, "cosmosDBSqlContainers", r.CosmosDBSQLContainers) populate(objectMap, "eventHubs", r.EventHubs) populate(objectMap, "serviceBusQueues", r.ServiceBusQueues) populate(objectMap, "serviceBusTopics", r.ServiceBusTopics) @@ -2437,8 +2436,8 @@ func (r *RoutingEndpoints) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "cosmosDBSqlCollections": - err = unpopulate(val, "CosmosDBSQLCollections", &r.CosmosDBSQLCollections) + case "cosmosDBSqlContainers": + err = unpopulate(val, "CosmosDBSQLContainers", &r.CosmosDBSQLContainers) delete(rawMsg, key) case "eventHubs": err = unpopulate(val, "EventHubs", &r.EventHubs) diff --git a/sdk/resourcemanager/iothub/armiothub/operations_client.go b/sdk/resourcemanager/iothub/armiothub/operations_client.go index 6039a35b13ba..62501391692d 100644 --- a/sdk/resourcemanager/iothub/armiothub/operations_client.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available IoT Hub REST API operations. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iothub/armiothub/operations_client_example_test.go b/sdk/resourcemanager/iothub/armiothub/operations_client_example_test.go deleted file mode 100644 index 7fc8008cda24..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/operations_client_example_test.go +++ /dev/null @@ -1,361 +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 armiothub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_operations.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 := armiothub.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 = armiothub.OperationListResult{ - // Value: []*armiothub.Operation{ - // { - // Name: to.Ptr("Microsoft.Devices/register/action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Register the subscription for the IotHub resource provider and enables the creation of IotHub resources"), - // Operation: to.Ptr("Register Resource Provider"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/diagnosticSettings/read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the diagnostic setting for the resource"), - // Operation: to.Ptr("Get Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/diagnosticSettings/write"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diagnostic setting for the resource"), - // Operation: to.Ptr("Set Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/metricDefinitions/read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the available metrics for the IotHub service"), - // Operation: to.Ptr("Read IotHub service metric definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/logDefinitions/read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the available log definitions for the IotHub Service"), - // Operation: to.Ptr("Read IotHub service log definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/operations/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get All ResourceProvider Operations"), - // Operation: to.Ptr("Get All ResourceProvider Operations"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/checkNameAvailability/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Check If IotHub name is available"), - // Operation: to.Ptr("Check If IotHub name is available"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/usages/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get subscription usage details for this provider."), - // Operation: to.Ptr("Get Subscription Usages"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the IotHub resource(s)"), - // Operation: to.Ptr("Get IotHub(s)"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/Write"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Create or update IotHub Resource"), - // Operation: to.Ptr("Create or update IotHub Resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/Delete"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Delete IotHub Resource"), - // Operation: to.Ptr("Delete IotHub Resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/iotHubStats/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get IotHub Statistics"), - // Operation: to.Ptr("Get IotHub Statistics"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/skus/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get valid IotHub Skus"), - // Operation: to.Ptr("Get valid IotHub Skus"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/listkeys/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get all IotHub Keys"), - // Operation: to.Ptr("Get all IotHub Keys"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/iotHubKeys/listkeys/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get IotHub Key for the given name"), - // Operation: to.Ptr("Get IotHub Key for the given name"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/eventHubEndpoints/consumerGroups/Write"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Create EventHub Consumer Group"), - // Operation: to.Ptr("Create EventHub Consumer Group"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/eventHubEndpoints/consumerGroups/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get EventHub Consumer Group(s)"), - // Operation: to.Ptr("Get EventHub Consumer Group(s)"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/eventHubEndpoints/consumerGroups/Delete"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Delete EventHub Consumer Group"), - // Operation: to.Ptr("Delete EventHub Consumer Group"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/exportDevices/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Export Devices"), - // Operation: to.Ptr("Export Devices"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/importDevices/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Import Devices"), - // Operation: to.Ptr("Import Devices"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/jobs/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get Job(s) details submitted on given IotHub"), - // Operation: to.Ptr("Get the Job(s) on IotHub"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/quotaMetrics/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get Quota Metrics"), - // Operation: to.Ptr("Get Quota Metrics"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/routing/routes/$testall/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Test a message against all existing Routes"), - // Operation: to.Ptr("Routing Rule Test All"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/routing/routes/$testnew/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Test a message against a provided test Route"), - // Operation: to.Ptr("Routing Rule Test Route"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/routingEndpointsHealth/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the health of all routing Endpoints for an IotHub"), - // Operation: to.Ptr("Get Endpoint Health"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/diagnosticSettings/read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the diagnostic setting for the resource"), - // Operation: to.Ptr("Get Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/diagnosticSettings/write"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diagnostic setting for the resource"), - // Operation: to.Ptr("Set Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/metricDefinitions/read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the available metrics for the DPS service"), - // Operation: to.Ptr("Read DPS service metric definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/logDefinitions/read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Gets the available log definitions for the DPS Service"), - // Operation: to.Ptr("Read DPS service log definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/checkProvisioningServiceNameAvailability/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Check If Provisioning Service name is available"), - // Operation: to.Ptr("Check If Provisioning Service name is available"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServives"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Get Provisioning Service resource"), - // Operation: to.Ptr("Get Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/Write"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Create Provisioning Service resource"), - // Operation: to.Ptr("Create Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/Delete"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Delete Provisioning Service resource"), - // Operation: to.Ptr("Delete Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/skus/Read"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("Delete Provisioning Service resource"), - // Operation: to.Ptr("Delete Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/listkeys/Action"), - // Display: &armiothub.OperationDisplay{ - // Description: to.Ptr("get security related metadata"), - // Operation: to.Ptr("get security related metadata"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/iothub/armiothub/options.go b/sdk/resourcemanager/iothub/armiothub/options.go new file mode 100644 index 000000000000..79a2d9776180 --- /dev/null +++ b/sdk/resourcemanager/iothub/armiothub/options.go @@ -0,0 +1,223 @@ +//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 armiothub + +// CertificatesClientCreateOrUpdateOptions contains the optional parameters for the CertificatesClient.CreateOrUpdate method. +type CertificatesClientCreateOrUpdateOptions struct { + // ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. + IfMatch *string +} + +// CertificatesClientDeleteOptions contains the optional parameters for the CertificatesClient.Delete method. +type CertificatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientGenerateVerificationCodeOptions contains the optional parameters for the CertificatesClient.GenerateVerificationCode +// method. +type CertificatesClientGenerateVerificationCodeOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientGetOptions contains the optional parameters for the CertificatesClient.Get method. +type CertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientListByIotHubOptions contains the optional parameters for the CertificatesClient.ListByIotHub method. +type CertificatesClientListByIotHubOptions struct { + // placeholder for future optional parameters +} + +// CertificatesClientVerifyOptions contains the optional parameters for the CertificatesClient.Verify method. +type CertificatesClientVerifyOptions struct { + // placeholder for future optional parameters +} + +// ClientBeginManualFailoverOptions contains the optional parameters for the Client.BeginManualFailover method. +type ClientBeginManualFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdate +// method. +type PrivateEndpointConnectionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. +type PrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientBeginCreateOrUpdateOptions contains the optional parameters for the ResourceClient.BeginCreateOrUpdate method. +type ResourceClientBeginCreateOrUpdateOptions struct { + // ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + IfMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceClientBeginDeleteOptions contains the optional parameters for the ResourceClient.BeginDelete method. +type ResourceClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceClientBeginUpdateOptions contains the optional parameters for the ResourceClient.BeginUpdate method. +type ResourceClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceClientCheckNameAvailabilityOptions contains the optional parameters for the ResourceClient.CheckNameAvailability +// method. +type ResourceClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientCreateEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.CreateEventHubConsumerGroup +// method. +type ResourceClientCreateEventHubConsumerGroupOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientDeleteEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.DeleteEventHubConsumerGroup +// method. +type ResourceClientDeleteEventHubConsumerGroupOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientExportDevicesOptions contains the optional parameters for the ResourceClient.ExportDevices method. +type ResourceClientExportDevicesOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetEndpointHealthOptions contains the optional parameters for the ResourceClient.NewGetEndpointHealthPager +// method. +type ResourceClientGetEndpointHealthOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.GetEventHubConsumerGroup +// method. +type ResourceClientGetEventHubConsumerGroupOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetJobOptions contains the optional parameters for the ResourceClient.GetJob method. +type ResourceClientGetJobOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetKeysForKeyNameOptions contains the optional parameters for the ResourceClient.GetKeysForKeyName method. +type ResourceClientGetKeysForKeyNameOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetOptions contains the optional parameters for the ResourceClient.Get method. +type ResourceClientGetOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetQuotaMetricsOptions contains the optional parameters for the ResourceClient.NewGetQuotaMetricsPager method. +type ResourceClientGetQuotaMetricsOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetStatsOptions contains the optional parameters for the ResourceClient.GetStats method. +type ResourceClientGetStatsOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientGetValidSKUsOptions contains the optional parameters for the ResourceClient.NewGetValidSKUsPager method. +type ResourceClientGetValidSKUsOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientImportDevicesOptions contains the optional parameters for the ResourceClient.ImportDevices method. +type ResourceClientImportDevicesOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientListByResourceGroupOptions contains the optional parameters for the ResourceClient.NewListByResourceGroupPager +// method. +type ResourceClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientListBySubscriptionOptions contains the optional parameters for the ResourceClient.NewListBySubscriptionPager +// method. +type ResourceClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientListEventHubConsumerGroupsOptions contains the optional parameters for the ResourceClient.NewListEventHubConsumerGroupsPager +// method. +type ResourceClientListEventHubConsumerGroupsOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientListJobsOptions contains the optional parameters for the ResourceClient.NewListJobsPager method. +type ResourceClientListJobsOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientListKeysOptions contains the optional parameters for the ResourceClient.NewListKeysPager method. +type ResourceClientListKeysOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientTestAllRoutesOptions contains the optional parameters for the ResourceClient.TestAllRoutes method. +type ResourceClientTestAllRoutesOptions struct { + // placeholder for future optional parameters +} + +// ResourceClientTestRouteOptions contains the optional parameters for the ResourceClient.TestRoute method. +type ResourceClientTestRouteOptions struct { + // placeholder for future optional parameters +} + +// ResourceProviderCommonClientGetSubscriptionQuotaOptions contains the optional parameters for the ResourceProviderCommonClient.GetSubscriptionQuota +// method. +type ResourceProviderCommonClientGetSubscriptionQuotaOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go b/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go index efcd3c6e8385..7e886e0a02e1 100644 --- a/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_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 armiothub @@ -47,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Delete private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - privateEndpointConnectionName - The name of the private endpoint connection @@ -59,7 +58,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, 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. @@ -108,7 +110,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,25 +119,28 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get private endpoint connection properties // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - privateEndpointConnectionName - The name of the private endpoint connection // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -162,7 +167,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,24 +185,27 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // List - List private endpoint connection properties // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List // method. func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) (PrivateEndpointConnectionsClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -220,7 +228,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,7 +246,7 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // BeginUpdate - Update the status of a private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - privateEndpointConnectionName - The name of the private endpoint connection @@ -251,7 +259,8 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -260,20 +269,22 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, // Update - Update the status of a private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, 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 } // updateCreateRequest creates the Update request. @@ -300,8 +311,11 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, privateEndpointConnection) + if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client_example_test.go deleted file mode 100644 index 702faa368ba2..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,175 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listprivateendpointconnections.json -func ExamplePrivateEndpointConnectionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().List(ctx, "myResourceGroup", "testHub", 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.PrivateEndpointConnectionArray = []*armiothub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armiothub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armiothub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armiothub.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request!"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armiothub.PrivateLinkServiceConnectionStatusPending), - // }, - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getprivateendpointconnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "testHub", "myPrivateEndpointConnection", 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.PrivateEndpointConnection = armiothub.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armiothub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armiothub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armiothub.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request!"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armiothub.PrivateLinkServiceConnectionStatusPending), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_updateprivateendpointconnection.json -func ExamplePrivateEndpointConnectionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginUpdate(ctx, "myResourceGroup", "testHub", "myPrivateEndpointConnection", armiothub.PrivateEndpointConnection{ - Properties: &armiothub.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armiothub.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armiothub.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, 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.PrivateEndpointConnection = armiothub.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armiothub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armiothub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armiothub.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armiothub.PrivateLinkServiceConnectionStatusApproved), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_deleteprivateendpointconnection.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "myResourceGroup", "testHub", "myPrivateEndpointConnection", 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.PrivateEndpointConnection = armiothub.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armiothub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armiothub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armiothub.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Deleted"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armiothub.PrivateLinkServiceConnectionStatusDisconnected), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go b/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go index 85400964155a..0484f632177b 100644 --- a/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go +++ b/sdk/resourcemanager/iothub/armiothub/privatelinkresources_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 armiothub @@ -47,25 +46,28 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Get the specified private link resource for the given IotHub // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - groupID - The name of the private link resource // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupID string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupID, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,24 +112,27 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // List - List private link resources for the given IotHub // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List // method. func (client *PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) (PrivateLinkResourcesClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return PrivateLinkResourcesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -150,7 +155,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client_example_test.go b/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client_example_test.go deleted file mode 100644 index af89a22e54a1..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,85 +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 armiothub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listprivatelinkresources.json -func ExamplePrivateLinkResourcesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().List(ctx, "myResourceGroup", "testHub", 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.PrivateLinkResources = armiothub.PrivateLinkResources{ - // Value: []*armiothub.GroupIDInformation{ - // { - // Name: to.Ptr("iotHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/PrivateLinkResources/iotHub"), - // Properties: &armiothub.GroupIDInformationProperties{ - // GroupID: to.Ptr("iotHub"), - // RequiredMembers: []*string{ - // to.Ptr("iotHub")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azure-devices.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getprivatelinkresources.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "myResourceGroup", "testHub", "iotHub", 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.GroupIDInformation = armiothub.GroupIDInformation{ - // Name: to.Ptr("iotHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/PrivateLinkResources/iotHub"), - // Properties: &armiothub.GroupIDInformationProperties{ - // GroupID: to.Ptr("iotHub"), - // RequiredMembers: []*string{ - // to.Ptr("iotHub")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azure-devices.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/iothub/armiothub/resource_client.go b/sdk/resourcemanager/iothub/armiothub/resource_client.go index d220839a267c..857ed4ed56ba 100644 --- a/sdk/resourcemanager/iothub/armiothub/resource_client.go +++ b/sdk/resourcemanager/iothub/armiothub/resource_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 armiothub @@ -47,23 +46,26 @@ func NewResourceClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Check if an IoT hub name is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - operationInputs - Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. // - options - ResourceClientCheckNameAvailabilityOptions contains the optional parameters for the ResourceClient.CheckNameAvailability // method. func (client *ResourceClient) CheckNameAvailability(ctx context.Context, operationInputs OperationInputs, options *ResourceClientCheckNameAvailabilityOptions) (ResourceClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, operationInputs, options) if err != nil { return ResourceClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -78,10 +80,13 @@ func (client *ResourceClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, operationInputs) + if err := runtime.MarshalAsJSON(req, operationInputs); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -96,7 +101,7 @@ func (client *ResourceClient) checkNameAvailabilityHandleResponse(resp *http.Res // CreateEventHubConsumerGroup - Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - eventHubEndpointName - The name of the Event Hub-compatible endpoint in the IoT hub. @@ -105,18 +110,21 @@ func (client *ResourceClient) checkNameAvailabilityHandleResponse(resp *http.Res // - options - ResourceClientCreateEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.CreateEventHubConsumerGroup // method. func (client *ResourceClient) CreateEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, consumerGroupBody EventHubConsumerGroupBodyDescription, options *ResourceClientCreateEventHubConsumerGroupOptions) (ResourceClientCreateEventHubConsumerGroupResponse, error) { + var err error req, err := client.createEventHubConsumerGroupCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody, options) if err != nil { return ResourceClientCreateEventHubConsumerGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientCreateEventHubConsumerGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientCreateEventHubConsumerGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientCreateEventHubConsumerGroupResponse{}, err } - return client.createEventHubConsumerGroupHandleResponse(resp) + resp, err := client.createEventHubConsumerGroupHandleResponse(httpResp) + return resp, err } // createEventHubConsumerGroupCreateRequest creates the CreateEventHubConsumerGroup request. @@ -147,10 +155,13 @@ func (client *ResourceClient) createEventHubConsumerGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, consumerGroupBody) + if err := runtime.MarshalAsJSON(req, consumerGroupBody); err != nil { + return nil, err + } + return req, nil } // createEventHubConsumerGroupHandleResponse handles the CreateEventHubConsumerGroup response. @@ -167,7 +178,7 @@ func (client *ResourceClient) createEventHubConsumerGroupHandleResponse(resp *ht // body to update the IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - iotHubDescription - The IoT hub metadata and security metadata. @@ -179,7 +190,8 @@ func (client *ResourceClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ResourceClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ResourceClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ResourceClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -190,20 +202,22 @@ func (client *ResourceClient) BeginCreateOrUpdate(ctx context.Context, resourceG // body to update the IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview func (client *ResourceClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription Description, options *ResourceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, iotHubDescription, 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. @@ -226,19 +240,22 @@ func (client *ResourceClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, iotHubDescription) + if err := runtime.MarshalAsJSON(req, iotHubDescription); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientBeginDeleteOptions contains the optional parameters for the ResourceClient.BeginDelete method. @@ -248,7 +265,8 @@ func (client *ResourceClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ResourceClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ResourceClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ResourceClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -257,20 +275,22 @@ func (client *ResourceClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview func (client *ResourceClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, 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, http.StatusNotFound) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -293,7 +313,7 @@ func (client *ResourceClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +322,7 @@ func (client *ResourceClient) deleteCreateRequest(ctx context.Context, resourceG // DeleteEventHubConsumerGroup - Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - eventHubEndpointName - The name of the Event Hub-compatible endpoint in the IoT hub. @@ -310,16 +330,18 @@ func (client *ResourceClient) deleteCreateRequest(ctx context.Context, resourceG // - options - ResourceClientDeleteEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.DeleteEventHubConsumerGroup // method. func (client *ResourceClient) DeleteEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, options *ResourceClientDeleteEventHubConsumerGroupOptions) (ResourceClientDeleteEventHubConsumerGroupResponse, error) { + var err error req, err := client.deleteEventHubConsumerGroupCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, options) if err != nil { return ResourceClientDeleteEventHubConsumerGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientDeleteEventHubConsumerGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientDeleteEventHubConsumerGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientDeleteEventHubConsumerGroupResponse{}, err } return ResourceClientDeleteEventHubConsumerGroupResponse{}, nil } @@ -352,7 +374,7 @@ func (client *ResourceClient) deleteEventHubConsumerGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -363,24 +385,27 @@ func (client *ResourceClient) deleteEventHubConsumerGroupCreateRequest(ctx conte // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - exportDevicesParameters - The parameters that specify the export devices operation. // - options - ResourceClientExportDevicesOptions contains the optional parameters for the ResourceClient.ExportDevices method. func (client *ResourceClient) ExportDevices(ctx context.Context, resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest, options *ResourceClientExportDevicesOptions) (ResourceClientExportDevicesResponse, error) { + var err error req, err := client.exportDevicesCreateRequest(ctx, resourceGroupName, resourceName, exportDevicesParameters, options) if err != nil { return ResourceClientExportDevicesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientExportDevicesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientExportDevicesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientExportDevicesResponse{}, err } - return client.exportDevicesHandleResponse(resp) + resp, err := client.exportDevicesHandleResponse(httpResp) + return resp, err } // exportDevicesCreateRequest creates the ExportDevices request. @@ -403,10 +428,13 @@ func (client *ResourceClient) exportDevicesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, exportDevicesParameters) + if err := runtime.MarshalAsJSON(req, exportDevicesParameters); err != nil { + return nil, err + } + return req, nil } // exportDevicesHandleResponse handles the ExportDevices response. @@ -421,23 +449,26 @@ func (client *ResourceClient) exportDevicesHandleResponse(resp *http.Response) ( // Get - Get the non-security related metadata of an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientGetOptions contains the optional parameters for the ResourceClient.Get method. func (client *ResourceClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientGetOptions) (ResourceClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ResourceClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -460,7 +491,7 @@ func (client *ResourceClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +508,7 @@ func (client *ResourceClient) getHandleResponse(resp *http.Response) (ResourceCl // NewGetEndpointHealthPager - Get the health for routing endpoints. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - options - ResourceClientGetEndpointHealthOptions contains the optional parameters for the ResourceClient.NewGetEndpointHealthPager // method. func (client *ResourceClient) NewGetEndpointHealthPager(resourceGroupName string, iotHubName string, options *ResourceClientGetEndpointHealthOptions) *runtime.Pager[ResourceClientGetEndpointHealthResponse] { @@ -528,7 +559,7 @@ func (client *ResourceClient) getEndpointHealthCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -546,7 +577,7 @@ func (client *ResourceClient) getEndpointHealthHandleResponse(resp *http.Respons // GetEventHubConsumerGroup - Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - eventHubEndpointName - The name of the Event Hub-compatible endpoint in the IoT hub. @@ -554,18 +585,21 @@ func (client *ResourceClient) getEndpointHealthHandleResponse(resp *http.Respons // - options - ResourceClientGetEventHubConsumerGroupOptions contains the optional parameters for the ResourceClient.GetEventHubConsumerGroup // method. func (client *ResourceClient) GetEventHubConsumerGroup(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, options *ResourceClientGetEventHubConsumerGroupOptions) (ResourceClientGetEventHubConsumerGroupResponse, error) { + var err error req, err := client.getEventHubConsumerGroupCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, options) if err != nil { return ResourceClientGetEventHubConsumerGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientGetEventHubConsumerGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientGetEventHubConsumerGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientGetEventHubConsumerGroupResponse{}, err } - return client.getEventHubConsumerGroupHandleResponse(resp) + resp, err := client.getEventHubConsumerGroupHandleResponse(httpResp) + return resp, err } // getEventHubConsumerGroupCreateRequest creates the GetEventHubConsumerGroup request. @@ -596,7 +630,7 @@ func (client *ResourceClient) getEventHubConsumerGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -614,24 +648,27 @@ func (client *ResourceClient) getEventHubConsumerGroupHandleResponse(resp *http. // GetJob - Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - jobID - The job identifier. // - options - ResourceClientGetJobOptions contains the optional parameters for the ResourceClient.GetJob method. func (client *ResourceClient) GetJob(ctx context.Context, resourceGroupName string, resourceName string, jobID string, options *ResourceClientGetJobOptions) (ResourceClientGetJobResponse, error) { + var err error req, err := client.getJobCreateRequest(ctx, resourceGroupName, resourceName, jobID, options) if err != nil { return ResourceClientGetJobResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientGetJobResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientGetJobResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientGetJobResponse{}, err } - return client.getJobHandleResponse(resp) + resp, err := client.getJobHandleResponse(httpResp) + return resp, err } // getJobCreateRequest creates the GetJob request. @@ -658,7 +695,7 @@ func (client *ResourceClient) getJobCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -676,25 +713,28 @@ func (client *ResourceClient) getJobHandleResponse(resp *http.Response) (Resourc // GetKeysForKeyName - Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - keyName - The name of the shared access policy. // - options - ResourceClientGetKeysForKeyNameOptions contains the optional parameters for the ResourceClient.GetKeysForKeyName // method. func (client *ResourceClient) GetKeysForKeyName(ctx context.Context, resourceGroupName string, resourceName string, keyName string, options *ResourceClientGetKeysForKeyNameOptions) (ResourceClientGetKeysForKeyNameResponse, error) { + var err error req, err := client.getKeysForKeyNameCreateRequest(ctx, resourceGroupName, resourceName, keyName, options) if err != nil { return ResourceClientGetKeysForKeyNameResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientGetKeysForKeyNameResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientGetKeysForKeyNameResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientGetKeysForKeyNameResponse{}, err } - return client.getKeysForKeyNameHandleResponse(resp) + resp, err := client.getKeysForKeyNameHandleResponse(httpResp) + return resp, err } // getKeysForKeyNameCreateRequest creates the GetKeysForKeyName request. @@ -721,7 +761,7 @@ func (client *ResourceClient) getKeysForKeyNameCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -738,7 +778,7 @@ func (client *ResourceClient) getKeysForKeyNameHandleResponse(resp *http.Respons // NewGetQuotaMetricsPager - Get the quota metrics for an IoT hub. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientGetQuotaMetricsOptions contains the optional parameters for the ResourceClient.NewGetQuotaMetricsPager @@ -791,7 +831,7 @@ func (client *ResourceClient) getQuotaMetricsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -809,23 +849,26 @@ func (client *ResourceClient) getQuotaMetricsHandleResponse(resp *http.Response) // GetStats - Get the statistics from an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientGetStatsOptions contains the optional parameters for the ResourceClient.GetStats method. func (client *ResourceClient) GetStats(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientGetStatsOptions) (ResourceClientGetStatsResponse, error) { + var err error req, err := client.getStatsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ResourceClientGetStatsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientGetStatsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientGetStatsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientGetStatsResponse{}, err } - return client.getStatsHandleResponse(resp) + resp, err := client.getStatsHandleResponse(httpResp) + return resp, err } // getStatsCreateRequest creates the GetStats request. @@ -848,7 +891,7 @@ func (client *ResourceClient) getStatsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -865,7 +908,7 @@ func (client *ResourceClient) getStatsHandleResponse(resp *http.Response) (Resou // NewGetValidSKUsPager - Get the list of valid SKUs for an IoT hub. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientGetValidSKUsOptions contains the optional parameters for the ResourceClient.NewGetValidSKUsPager @@ -918,7 +961,7 @@ func (client *ResourceClient) getValidSKUsCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -938,24 +981,27 @@ func (client *ResourceClient) getValidSKUsHandleResponse(resp *http.Response) (R // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - importDevicesParameters - The parameters that specify the import devices operation. // - options - ResourceClientImportDevicesOptions contains the optional parameters for the ResourceClient.ImportDevices method. func (client *ResourceClient) ImportDevices(ctx context.Context, resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest, options *ResourceClientImportDevicesOptions) (ResourceClientImportDevicesResponse, error) { + var err error req, err := client.importDevicesCreateRequest(ctx, resourceGroupName, resourceName, importDevicesParameters, options) if err != nil { return ResourceClientImportDevicesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientImportDevicesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientImportDevicesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientImportDevicesResponse{}, err } - return client.importDevicesHandleResponse(resp) + resp, err := client.importDevicesHandleResponse(httpResp) + return resp, err } // importDevicesCreateRequest creates the ImportDevices request. @@ -978,10 +1024,13 @@ func (client *ResourceClient) importDevicesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, importDevicesParameters) + if err := runtime.MarshalAsJSON(req, importDevicesParameters); err != nil { + return nil, err + } + return req, nil } // importDevicesHandleResponse handles the ImportDevices response. @@ -995,7 +1044,7 @@ func (client *ResourceClient) importDevicesHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Get all the IoT hubs in a resource group. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - options - ResourceClientListByResourceGroupOptions contains the optional parameters for the ResourceClient.NewListByResourceGroupPager // method. @@ -1043,7 +1092,7 @@ func (client *ResourceClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1060,7 +1109,7 @@ func (client *ResourceClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Get all the IoT hubs in a subscription. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - options - ResourceClientListBySubscriptionOptions contains the optional parameters for the ResourceClient.NewListBySubscriptionPager // method. func (client *ResourceClient) NewListBySubscriptionPager(options *ResourceClientListBySubscriptionOptions) *runtime.Pager[ResourceClientListBySubscriptionResponse] { @@ -1103,7 +1152,7 @@ func (client *ResourceClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1121,7 +1170,7 @@ func (client *ResourceClient) listBySubscriptionHandleResponse(resp *http.Respon // NewListEventHubConsumerGroupsPager - Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint // in an IoT hub. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - eventHubEndpointName - The name of the Event Hub-compatible endpoint. @@ -1179,7 +1228,7 @@ func (client *ResourceClient) listEventHubConsumerGroupsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1196,7 +1245,7 @@ func (client *ResourceClient) listEventHubConsumerGroupsHandleResponse(resp *htt // NewListJobsPager - Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientListJobsOptions contains the optional parameters for the ResourceClient.NewListJobsPager method. @@ -1248,7 +1297,7 @@ func (client *ResourceClient) listJobsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1265,7 +1314,7 @@ func (client *ResourceClient) listJobsHandleResponse(resp *http.Response) (Resou // NewListKeysPager - Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - The name of the resource group that contains the IoT hub. // - resourceName - The name of the IoT hub. // - options - ResourceClientListKeysOptions contains the optional parameters for the ResourceClient.NewListKeysPager method. @@ -1317,7 +1366,7 @@ func (client *ResourceClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1335,24 +1384,27 @@ func (client *ResourceClient) listKeysHandleResponse(resp *http.Response) (Resou // TestAllRoutes - Test all routes configured in this Iot Hub // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - iotHubName - IotHub to be tested // - resourceGroupName - resource group which Iot Hub belongs to // - input - Input for testing all routes // - options - ResourceClientTestAllRoutesOptions contains the optional parameters for the ResourceClient.TestAllRoutes method. func (client *ResourceClient) TestAllRoutes(ctx context.Context, iotHubName string, resourceGroupName string, input TestAllRoutesInput, options *ResourceClientTestAllRoutesOptions) (ResourceClientTestAllRoutesResponse, error) { + var err error req, err := client.testAllRoutesCreateRequest(ctx, iotHubName, resourceGroupName, input, options) if err != nil { return ResourceClientTestAllRoutesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientTestAllRoutesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientTestAllRoutesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientTestAllRoutesResponse{}, err } - return client.testAllRoutesHandleResponse(resp) + resp, err := client.testAllRoutesHandleResponse(httpResp) + return resp, err } // testAllRoutesCreateRequest creates the TestAllRoutes request. @@ -1375,10 +1427,13 @@ func (client *ResourceClient) testAllRoutesCreateRequest(ctx context.Context, io return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, input) + if err := runtime.MarshalAsJSON(req, input); err != nil { + return nil, err + } + return req, nil } // testAllRoutesHandleResponse handles the TestAllRoutes response. @@ -1393,24 +1448,27 @@ func (client *ResourceClient) testAllRoutesHandleResponse(resp *http.Response) ( // TestRoute - Test the new route for this Iot Hub // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - iotHubName - IotHub to be tested // - resourceGroupName - resource group which Iot Hub belongs to // - input - Route that needs to be tested // - options - ResourceClientTestRouteOptions contains the optional parameters for the ResourceClient.TestRoute method. func (client *ResourceClient) TestRoute(ctx context.Context, iotHubName string, resourceGroupName string, input TestRouteInput, options *ResourceClientTestRouteOptions) (ResourceClientTestRouteResponse, error) { + var err error req, err := client.testRouteCreateRequest(ctx, iotHubName, resourceGroupName, input, options) if err != nil { return ResourceClientTestRouteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceClientTestRouteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceClientTestRouteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceClientTestRouteResponse{}, err } - return client.testRouteHandleResponse(resp) + resp, err := client.testRouteHandleResponse(httpResp) + return resp, err } // testRouteCreateRequest creates the TestRoute request. @@ -1433,10 +1491,13 @@ func (client *ResourceClient) testRouteCreateRequest(ctx context.Context, iotHub return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, input) + if err := runtime.MarshalAsJSON(req, input); err != nil { + return nil, err + } + return req, nil } // testRouteHandleResponse handles the TestRoute response. @@ -1451,7 +1512,7 @@ func (client *ResourceClient) testRouteHandleResponse(resp *http.Response) (Reso // BeginUpdate - Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - resourceGroupName - Resource group identifier. // - resourceName - Name of iot hub to update. // - iotHubTags - Updated tag information to set into the iot hub instance. @@ -1462,7 +1523,8 @@ func (client *ResourceClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ResourceClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ResourceClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ResourceClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1471,20 +1533,22 @@ func (client *ResourceClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview func (client *ResourceClient) update(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource, options *ResourceClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, iotHubTags, 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) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -1507,8 +1571,11 @@ func (client *ResourceClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, iotHubTags) + if err := runtime.MarshalAsJSON(req, iotHubTags); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/resource_client_example_test.go b/sdk/resourcemanager/iothub/armiothub/resource_client_example_test.go deleted file mode 100644 index 4f4585375150..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/resource_client_example_test.go +++ /dev/null @@ -1,1535 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_get.json -func ExampleResourceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().Get(ctx, "myResourceGroup", "testHub", 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.Description = armiothub.Description{ - // Name: to.Ptr("testHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAFD6M4="), - // Properties: &armiothub.Properties{ - // CloudToDevice: &armiothub.CloudToDeviceProperties{ - // DefaultTTLAsIso8601: to.Ptr("PT1H"), - // Feedback: &armiothub.FeedbackProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // MaxDeliveryCount: to.Ptr[int32](10), - // }, - // DeviceStreams: &armiothub.PropertiesDeviceStreams{ - // StreamingEndpoints: []*string{ - // to.Ptr("https://streams.azure-devices-int.net:9443")}, - // }, - // EnableFileUploadNotifications: to.Ptr(false), - // EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - // "events": &armiothub.EventHubProperties{ - // Path: to.Ptr("iot-dps-cit-hub-1"), - // Endpoint: to.Ptr("sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"), - // PartitionCount: to.Ptr[int32](2), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // RetentionTimeInDays: to.Ptr[int64](1), - // }, - // }, - // Features: to.Ptr(armiothub.CapabilitiesNone), - // HostName: to.Ptr("iot-dps-cit-hub-1.azure-devices.net"), - // IPFilterRules: []*armiothub.IPFilterRule{ - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // IPVersion: to.Ptr(armiothub.IPVersionIPv4IPv6), - // Locations: []*armiothub.LocationDescription{ - // { - // Location: to.Ptr("West US"), - // Role: to.Ptr(armiothub.IotHubReplicaRoleTypePrimary), - // }, - // { - // Location: to.Ptr("East US"), - // Role: to.Ptr(armiothub.IotHubReplicaRoleTypeSecondary), - // }}, - // MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - // "fileNotifications": &armiothub.MessagingEndpointProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // MinTLSVersion: to.Ptr("1.2"), - // NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - // ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - // DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - // IPRules: []*armiothub.NetworkRuleSetIPRule{ - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Routing: &armiothub.RoutingProperties{ - // Endpoints: &armiothub.RoutingEndpoints{ - // EventHubs: []*armiothub.RoutingEventHubProperties{ - // }, - // ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{ - // }, - // ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{ - // }, - // StorageContainers: []*armiothub.RoutingStorageContainerProperties{ - // }, - // }, - // FallbackRoute: &armiothub.FallbackRouteProperties{ - // Condition: to.Ptr("true"), - // EndpointNames: []*string{ - // to.Ptr("events")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // Routes: []*armiothub.RouteProperties{ - // }, - // }, - // State: to.Ptr("Active"), - // StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - // "$default": &armiothub.StorageEndpointProperties{ - // ConnectionString: to.Ptr(""), - // ContainerName: to.Ptr(""), - // SasTTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // }, - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // SystemData: &armiothub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_createOrUpdate.json -func ExampleResourceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewResourceClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "testHub", armiothub.Description{ - Location: to.Ptr("centraluseuap"), - Tags: map[string]*string{}, - Etag: to.Ptr("AAAAAAFD6M4="), - Properties: &armiothub.Properties{ - CloudToDevice: &armiothub.CloudToDeviceProperties{ - DefaultTTLAsIso8601: to.Ptr("PT1H"), - Feedback: &armiothub.FeedbackProperties{ - LockDurationAsIso8601: to.Ptr("PT1M"), - MaxDeliveryCount: to.Ptr[int32](10), - TTLAsIso8601: to.Ptr("PT1H"), - }, - MaxDeliveryCount: to.Ptr[int32](10), - }, - EnableDataResidency: to.Ptr(true), - EnableFileUploadNotifications: to.Ptr(false), - EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - "events": { - PartitionCount: to.Ptr[int32](2), - RetentionTimeInDays: to.Ptr[int64](1), - }, - }, - Features: to.Ptr(armiothub.CapabilitiesNone), - IPFilterRules: []*armiothub.IPFilterRule{}, - IPVersion: to.Ptr(armiothub.IPVersionIPv4IPv6), - MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - "fileNotifications": { - LockDurationAsIso8601: to.Ptr("PT1M"), - MaxDeliveryCount: to.Ptr[int32](10), - TTLAsIso8601: to.Ptr("PT1H"), - }, - }, - MinTLSVersion: to.Ptr("1.2"), - NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - IPRules: []*armiothub.NetworkRuleSetIPRule{ - { - Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - FilterName: to.Ptr("rule1"), - IPMask: to.Ptr("131.117.159.53"), - }, - { - Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - FilterName: to.Ptr("rule2"), - IPMask: to.Ptr("157.55.59.128/25"), - }}, - }, - RootCertificate: &armiothub.RootCertificateProperties{ - EnableRootCertificateV2: to.Ptr(true), - }, - Routing: &armiothub.RoutingProperties{ - Endpoints: &armiothub.RoutingEndpoints{ - EventHubs: []*armiothub.RoutingEventHubProperties{}, - ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{}, - ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{}, - StorageContainers: []*armiothub.RoutingStorageContainerProperties{}, - }, - FallbackRoute: &armiothub.FallbackRouteProperties{ - Name: to.Ptr("$fallback"), - Condition: to.Ptr("true"), - EndpointNames: []*string{ - to.Ptr("events")}, - IsEnabled: to.Ptr(true), - Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - }, - Routes: []*armiothub.RouteProperties{}, - }, - StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - "$default": { - ConnectionString: to.Ptr(""), - ContainerName: to.Ptr(""), - SasTTLAsIso8601: to.Ptr("PT1H"), - }, - }, - }, - SKU: &armiothub.SKUInfo{ - Name: to.Ptr(armiothub.IotHubSKUS1), - Capacity: to.Ptr[int64](1), - }, - }, &armiothub.ResourceClientBeginCreateOrUpdateOptions{IfMatch: 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.Description = armiothub.Description{ - // Name: to.Ptr("testHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs"), - // ID: to.Ptr("/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAFD6M4="), - // Properties: &armiothub.Properties{ - // CloudToDevice: &armiothub.CloudToDeviceProperties{ - // DefaultTTLAsIso8601: to.Ptr("PT1H"), - // Feedback: &armiothub.FeedbackProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // MaxDeliveryCount: to.Ptr[int32](10), - // }, - // EnableDataResidency: to.Ptr(true), - // EnableFileUploadNotifications: to.Ptr(false), - // EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - // "events": &armiothub.EventHubProperties{ - // Path: to.Ptr("iot-dps-cit-hub-1"), - // Endpoint: to.Ptr("sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"), - // PartitionCount: to.Ptr[int32](2), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // RetentionTimeInDays: to.Ptr[int64](1), - // }, - // }, - // Features: to.Ptr(armiothub.CapabilitiesNone), - // HostName: to.Ptr("iot-dps-cit-hub-1.azure-devices.net"), - // IPFilterRules: []*armiothub.IPFilterRule{ - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // IPVersion: to.Ptr(armiothub.IPVersionIPv4IPv6), - // MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - // "fileNotifications": &armiothub.MessagingEndpointProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // MinTLSVersion: to.Ptr("1.2"), - // NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - // ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - // DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - // IPRules: []*armiothub.NetworkRuleSetIPRule{ - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RootCertificate: &armiothub.RootCertificateProperties{ - // EnableRootCertificateV2: to.Ptr(true), - // LastUpdatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-08T11:16:49.0748958-07:00"); return t}()), - // }, - // Routing: &armiothub.RoutingProperties{ - // Endpoints: &armiothub.RoutingEndpoints{ - // EventHubs: []*armiothub.RoutingEventHubProperties{ - // }, - // ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{ - // }, - // ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{ - // }, - // StorageContainers: []*armiothub.RoutingStorageContainerProperties{ - // }, - // }, - // FallbackRoute: &armiothub.FallbackRouteProperties{ - // Name: to.Ptr("$fallback"), - // Condition: to.Ptr("true"), - // EndpointNames: []*string{ - // to.Ptr("events")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // Routes: []*armiothub.RouteProperties{ - // }, - // }, - // State: to.Ptr("Active"), - // StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - // "$default": &armiothub.StorageEndpointProperties{ - // ConnectionString: to.Ptr(""), - // ContainerName: to.Ptr(""), - // SasTTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // }, - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // SystemData: &armiothub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_patch.json -func ExampleResourceClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewResourceClient().BeginUpdate(ctx, "myResourceGroup", "myHub", armiothub.TagsResource{ - Tags: map[string]*string{ - "foo": to.Ptr("bar"), - }, - }, 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.Description = armiothub.Description{ - // Name: to.Ptr("testHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs"), - // ID: to.Ptr("/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // "foo": to.Ptr("bar"), - // }, - // Etag: to.Ptr("AAAAAAFD6M4="), - // Properties: &armiothub.Properties{ - // CloudToDevice: &armiothub.CloudToDeviceProperties{ - // DefaultTTLAsIso8601: to.Ptr("PT1H"), - // Feedback: &armiothub.FeedbackProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // MaxDeliveryCount: to.Ptr[int32](10), - // }, - // EnableFileUploadNotifications: to.Ptr(false), - // EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - // "events": &armiothub.EventHubProperties{ - // Path: to.Ptr("iot-dps-cit-hub-1"), - // Endpoint: to.Ptr("sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"), - // PartitionCount: to.Ptr[int32](2), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // RetentionTimeInDays: to.Ptr[int64](1), - // }, - // }, - // Features: to.Ptr(armiothub.CapabilitiesNone), - // HostName: to.Ptr("iot-dps-cit-hub-1.azure-devices.net"), - // IPFilterRules: []*armiothub.IPFilterRule{ - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - // "fileNotifications": &armiothub.MessagingEndpointProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - // ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - // DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - // IPRules: []*armiothub.NetworkRuleSetIPRule{ - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Routing: &armiothub.RoutingProperties{ - // Endpoints: &armiothub.RoutingEndpoints{ - // EventHubs: []*armiothub.RoutingEventHubProperties{ - // }, - // ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{ - // }, - // ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{ - // }, - // StorageContainers: []*armiothub.RoutingStorageContainerProperties{ - // }, - // }, - // FallbackRoute: &armiothub.FallbackRouteProperties{ - // Name: to.Ptr("$fallback"), - // Condition: to.Ptr("true"), - // EndpointNames: []*string{ - // to.Ptr("events")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // Routes: []*armiothub.RouteProperties{ - // }, - // }, - // State: to.Ptr("Active"), - // StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - // "$default": &armiothub.StorageEndpointProperties{ - // ConnectionString: to.Ptr(""), - // ContainerName: to.Ptr(""), - // SasTTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // }, - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // SystemData: &armiothub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_delete.json -func ExampleResourceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewResourceClient().BeginDelete(ctx, "myResourceGroup", "testHub", 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.Description = armiothub.Description{ - // Name: to.Ptr("testHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAFD6M4="), - // Properties: &armiothub.Properties{ - // CloudToDevice: &armiothub.CloudToDeviceProperties{ - // DefaultTTLAsIso8601: to.Ptr("PT1H"), - // Feedback: &armiothub.FeedbackProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // MaxDeliveryCount: to.Ptr[int32](10), - // }, - // EnableFileUploadNotifications: to.Ptr(false), - // EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - // "events": &armiothub.EventHubProperties{ - // Path: to.Ptr("iot-dps-cit-hub-1"), - // Endpoint: to.Ptr("sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"), - // PartitionCount: to.Ptr[int32](2), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // RetentionTimeInDays: to.Ptr[int64](1), - // }, - // }, - // Features: to.Ptr(armiothub.CapabilitiesNone), - // HostName: to.Ptr("iot-dps-cit-hub-1.azure-devices.net"), - // IPFilterRules: []*armiothub.IPFilterRule{ - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - // "fileNotifications": &armiothub.MessagingEndpointProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - // ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - // DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - // IPRules: []*armiothub.NetworkRuleSetIPRule{ - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Routing: &armiothub.RoutingProperties{ - // Endpoints: &armiothub.RoutingEndpoints{ - // EventHubs: []*armiothub.RoutingEventHubProperties{ - // }, - // ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{ - // }, - // ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{ - // }, - // StorageContainers: []*armiothub.RoutingStorageContainerProperties{ - // }, - // }, - // FallbackRoute: &armiothub.FallbackRouteProperties{ - // Condition: to.Ptr("true"), - // EndpointNames: []*string{ - // to.Ptr("events")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // Routes: []*armiothub.RouteProperties{ - // }, - // }, - // State: to.Ptr("Active"), - // StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - // "$default": &armiothub.StorageEndpointProperties{ - // ConnectionString: to.Ptr(""), - // ContainerName: to.Ptr(""), - // SasTTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // }, - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // SystemData: &armiothub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listbysubscription.json -func ExampleResourceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().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.DescriptionListResult = armiothub.DescriptionListResult{ - // Value: []*armiothub.Description{ - // { - // Name: to.Ptr("testHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAFD6M4="), - // Properties: &armiothub.Properties{ - // CloudToDevice: &armiothub.CloudToDeviceProperties{ - // DefaultTTLAsIso8601: to.Ptr("PT1H"), - // Feedback: &armiothub.FeedbackProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // MaxDeliveryCount: to.Ptr[int32](10), - // }, - // EnableFileUploadNotifications: to.Ptr(false), - // EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - // "events": &armiothub.EventHubProperties{ - // Path: to.Ptr("iot-dps-cit-hub-1"), - // Endpoint: to.Ptr("sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"), - // PartitionCount: to.Ptr[int32](2), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // RetentionTimeInDays: to.Ptr[int64](1), - // }, - // }, - // Features: to.Ptr(armiothub.CapabilitiesNone), - // HostName: to.Ptr("iot-dps-cit-hub-1.azure-devices.net"), - // IPFilterRules: []*armiothub.IPFilterRule{ - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - // "fileNotifications": &armiothub.MessagingEndpointProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - // ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - // DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - // IPRules: []*armiothub.NetworkRuleSetIPRule{ - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Routing: &armiothub.RoutingProperties{ - // Endpoints: &armiothub.RoutingEndpoints{ - // EventHubs: []*armiothub.RoutingEventHubProperties{ - // }, - // ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{ - // }, - // ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{ - // }, - // StorageContainers: []*armiothub.RoutingStorageContainerProperties{ - // }, - // }, - // FallbackRoute: &armiothub.FallbackRouteProperties{ - // Name: to.Ptr("$fallback"), - // Condition: to.Ptr("true"), - // EndpointNames: []*string{ - // to.Ptr("events")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // Routes: []*armiothub.RouteProperties{ - // }, - // }, - // State: to.Ptr("Active"), - // StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - // "$default": &armiothub.StorageEndpointProperties{ - // ConnectionString: to.Ptr(""), - // ContainerName: to.Ptr(""), - // SasTTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // }, - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // SystemData: &armiothub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listbyrg.json -func ExampleResourceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewListByResourceGroupPager("myResourceGroup", 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.DescriptionListResult = armiothub.DescriptionListResult{ - // Value: []*armiothub.Description{ - // { - // Name: to.Ptr("testHub"), - // Type: to.Ptr("Microsoft.Devices/IotHubs"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAFD6M4="), - // Properties: &armiothub.Properties{ - // CloudToDevice: &armiothub.CloudToDeviceProperties{ - // DefaultTTLAsIso8601: to.Ptr("PT1H"), - // Feedback: &armiothub.FeedbackProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // MaxDeliveryCount: to.Ptr[int32](10), - // }, - // EnableFileUploadNotifications: to.Ptr(false), - // EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - // "events": &armiothub.EventHubProperties{ - // Path: to.Ptr("iot-dps-cit-hub-1"), - // Endpoint: to.Ptr("sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"), - // PartitionCount: to.Ptr[int32](2), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // RetentionTimeInDays: to.Ptr[int64](1), - // }, - // }, - // Features: to.Ptr(armiothub.CapabilitiesNone), - // HostName: to.Ptr("iot-dps-cit-hub-1.azure-devices.net"), - // IPFilterRules: []*armiothub.IPFilterRule{ - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.IPFilterActionTypeAccept), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - // "fileNotifications": &armiothub.MessagingEndpointProperties{ - // LockDurationAsIso8601: to.Ptr("PT1M"), - // MaxDeliveryCount: to.Ptr[int32](10), - // TTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - // ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - // DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - // IPRules: []*armiothub.NetworkRuleSetIPRule{ - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule1"), - // IPMask: to.Ptr("131.117.159.53"), - // }, - // { - // Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - // FilterName: to.Ptr("rule2"), - // IPMask: to.Ptr("157.55.59.128/25"), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Routing: &armiothub.RoutingProperties{ - // Endpoints: &armiothub.RoutingEndpoints{ - // EventHubs: []*armiothub.RoutingEventHubProperties{ - // }, - // ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{ - // }, - // ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{ - // }, - // StorageContainers: []*armiothub.RoutingStorageContainerProperties{ - // }, - // }, - // FallbackRoute: &armiothub.FallbackRouteProperties{ - // Name: to.Ptr("$fallback"), - // Condition: to.Ptr("true"), - // EndpointNames: []*string{ - // to.Ptr("events")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // Routes: []*armiothub.RouteProperties{ - // }, - // }, - // State: to.Ptr("Active"), - // StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - // "$default": &armiothub.StorageEndpointProperties{ - // ConnectionString: to.Ptr(""), - // ContainerName: to.Ptr(""), - // SasTTLAsIso8601: to.Ptr("PT1H"), - // }, - // }, - // }, - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // SystemData: &armiothub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_stats.json -func ExampleResourceClient_GetStats() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().GetStats(ctx, "myResourceGroup", "testHub", 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.RegistryStatistics = armiothub.RegistryStatistics{ - // DisabledDeviceCount: to.Ptr[int64](0), - // EnabledDeviceCount: to.Ptr[int64](0), - // TotalDeviceCount: to.Ptr[int64](0), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getskus.json -func ExampleResourceClient_NewGetValidSKUsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewGetValidSKUsPager("myResourceGroup", "testHub", 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.SKUDescriptionListResult = armiothub.SKUDescriptionListResult{ - // Value: []*armiothub.SKUDescription{ - // { - // Capacity: &armiothub.Capacity{ - // Default: to.Ptr[int64](1), - // ScaleType: to.Ptr(armiothub.IotHubScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.Devices/IotHubs"), - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS1), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // }, - // { - // Capacity: &armiothub.Capacity{ - // Default: to.Ptr[int64](1), - // Maximum: to.Ptr[int64](200), - // Minimum: to.Ptr[int64](1), - // ScaleType: to.Ptr(armiothub.IotHubScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.Devices/IotHubs"), - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS2), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // }, - // { - // Capacity: &armiothub.Capacity{ - // Default: to.Ptr[int64](1), - // Maximum: to.Ptr[int64](10), - // Minimum: to.Ptr[int64](1), - // ScaleType: to.Ptr(armiothub.IotHubScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.Devices/IotHubs"), - // SKU: &armiothub.SKUInfo{ - // Name: to.Ptr(armiothub.IotHubSKUS3), - // Tier: to.Ptr(armiothub.IotHubSKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listehgroups.json -func ExampleResourceClient_NewListEventHubConsumerGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewListEventHubConsumerGroupsPager("myResourceGroup", "testHub", "events", 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.EventHubConsumerGroupsListResult = armiothub.EventHubConsumerGroupsListResult{ - // Value: []*armiothub.EventHubConsumerGroupInfo{ - // { - // Name: to.Ptr("$Default"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups"), - // Etag: to.Ptr("AAAAAAFD6M4="), - // ID: to.Ptr("/subscriptions/cmd-sub-1/resourceGroups/cmd-rg-1/providers/Microsoft.Devices/IotHubs/test-hub-2/eventHubEndpoints/events/ConsumerGroups/%24Default"), - // Properties: map[string]any{ - // "created": "Thu, 15 Jun 2017 19:20:58 GMT", - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getconsumergroup.json -func ExampleResourceClient_GetEventHubConsumerGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().GetEventHubConsumerGroup(ctx, "myResourceGroup", "testHub", "events", "test", 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.EventHubConsumerGroupInfo = armiothub.EventHubConsumerGroupInfo{ - // Name: to.Ptr("test"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups"), - // Etag: to.Ptr("AAAAAAFD6M4="), - // ID: to.Ptr("/subscriptions/cmd-sub-1/resourceGroups/cmd-rg-1/providers/Microsoft.Devices/IotHubs/test-hub-2/eventHubEndpoints/events/ConsumerGroups/%24Default"), - // Properties: map[string]any{ - // "created": "Thu, 15 Jun 2017 19:20:58 GMT", - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_createconsumergroup.json -func ExampleResourceClient_CreateEventHubConsumerGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().CreateEventHubConsumerGroup(ctx, "myResourceGroup", "testHub", "events", "test", armiothub.EventHubConsumerGroupBodyDescription{ - Properties: &armiothub.EventHubConsumerGroupName{ - Name: to.Ptr("test"), - }, - }, 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.EventHubConsumerGroupInfo = armiothub.EventHubConsumerGroupInfo{ - // Name: to.Ptr("test"), - // Type: to.Ptr("Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups"), - // Etag: to.Ptr("AAAAAAFD6M4="), - // ID: to.Ptr("/subscriptions/cmd-sub-1/resourceGroups/cmd-rg-1/providers/Microsoft.Devices/IotHubs/test-hub-2/eventHubEndpoints/events/ConsumerGroups/%24Default"), - // Properties: map[string]any{ - // "created": "Thu, 15 Jun 2017 19:20:58 GMT", - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_deleteconsumergroup.json -func ExampleResourceClient_DeleteEventHubConsumerGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewResourceClient().DeleteEventHubConsumerGroup(ctx, "myResourceGroup", "testHub", "events", "test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listjobs.json -func ExampleResourceClient_NewListJobsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewListJobsPager("myResourceGroup", "testHub", 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.JobResponseListResult = armiothub.JobResponseListResult{ - // Value: []*armiothub.JobResponse{ - // { - // Type: to.Ptr(armiothub.JobTypeUnknown), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // JobID: to.Ptr("test"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // Status: to.Ptr(armiothub.JobStatusUnknown), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getjob.json -func ExampleResourceClient_GetJob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().GetJob(ctx, "myResourceGroup", "testHub", "test", 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.JobResponse = armiothub.JobResponse{ - // Type: to.Ptr(armiothub.JobTypeUnknown), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // JobID: to.Ptr("test"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // Status: to.Ptr(armiothub.JobStatusUnknown), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_quotametrics.json -func ExampleResourceClient_NewGetQuotaMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewGetQuotaMetricsPager("myResourceGroup", "testHub", 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.QuotaMetricInfoListResult = armiothub.QuotaMetricInfoListResult{ - // Value: []*armiothub.QuotaMetricInfo{ - // { - // Name: to.Ptr("TotalMessages"), - // CurrentValue: to.Ptr[int64](0), - // MaxValue: to.Ptr[int64](400000), - // }, - // { - // Name: to.Ptr("TotalDeviceCount"), - // CurrentValue: to.Ptr[int64](0), - // MaxValue: to.Ptr[int64](500000), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_routingendpointhealth.json -func ExampleResourceClient_NewGetEndpointHealthPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewGetEndpointHealthPager("myResourceGroup", "testHub", 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.EndpointHealthDataListResult = armiothub.EndpointHealthDataListResult{ - // Value: []*armiothub.EndpointHealthData{ - // { - // EndpointID: to.Ptr("id1"), - // HealthStatus: to.Ptr(armiothub.EndpointHealthStatusHealthy), - // LastSendAttemptTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Wed, 13 Sep 2017 18:04:32 GMT"); return t}()), - // LastSuccessfulSendAttemptTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Wed, 13 Sep 2017 18:04:32 GMT"); return t}()), - // }, - // { - // EndpointID: to.Ptr("id2"), - // HealthStatus: to.Ptr(armiothub.EndpointHealthStatusUnknown), - // }, - // { - // EndpointID: to.Ptr("id3"), - // HealthStatus: to.Ptr(armiothub.EndpointHealthStatusUnhealthy), - // LastKnownError: to.Ptr("NotFound"), - // LastKnownErrorTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Wed, 13 Sep 2017 18:04:32 GMT"); return t}()), - // LastSendAttemptTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Wed, 13 Sep 2017 18:04:32 GMT"); return t}()), - // LastSuccessfulSendAttemptTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Wed, 13 Sep 2017 18:04:32 GMT"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/checkNameAvailability.json -func ExampleResourceClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().CheckNameAvailability(ctx, armiothub.OperationInputs{ - Name: to.Ptr("test-request"), - }, 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.NameAvailabilityInfo = armiothub.NameAvailabilityInfo{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(armiothub.IotHubNameUnavailabilityReasonInvalid), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_testallroutes.json -func ExampleResourceClient_TestAllRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().TestAllRoutes(ctx, "testHub", "myResourceGroup", armiothub.TestAllRoutesInput{ - Message: &armiothub.RoutingMessage{ - AppProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Body: to.Ptr("Body of message"), - SystemProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, - RoutingSource: to.Ptr(armiothub.RoutingSourceDeviceMessages), - }, 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.TestAllRoutesResult = armiothub.TestAllRoutesResult{ - // Routes: []*armiothub.MatchedRoute{ - // { - // Properties: &armiothub.RouteProperties{ - // Name: to.Ptr("Routeid"), - // EndpointNames: []*string{ - // to.Ptr("id1")}, - // IsEnabled: to.Ptr(true), - // Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_testnewroute.json -func ExampleResourceClient_TestRoute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().TestRoute(ctx, "testHub", "myResourceGroup", armiothub.TestRouteInput{ - Message: &armiothub.RoutingMessage{ - AppProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Body: to.Ptr("Body of message"), - SystemProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, - Route: &armiothub.RouteProperties{ - Name: to.Ptr("Routeid"), - EndpointNames: []*string{ - to.Ptr("id1")}, - IsEnabled: to.Ptr(true), - Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - }, - }, 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.TestRouteResult = armiothub.TestRouteResult{ - // Result: to.Ptr(armiothub.TestResultStatusFalse), - // Details: &armiothub.TestRouteResultDetails{ - // CompilationErrors: []*armiothub.RouteCompilationError{ - // { - // Location: &armiothub.RouteErrorRange{ - // End: &armiothub.RouteErrorPosition{ - // Column: to.Ptr[int32](24), - // Line: to.Ptr[int32](12), - // }, - // Start: &armiothub.RouteErrorPosition{ - // Column: to.Ptr[int32](12), - // Line: to.Ptr[int32](12), - // }, - // }, - // Message: to.Ptr("string response"), - // Severity: to.Ptr(armiothub.RouteErrorSeverityError), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listkeys.json -func ExampleResourceClient_NewListKeysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceClient().NewListKeysPager("myResourceGroup", "testHub", 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.SharedAccessSignatureAuthorizationRuleListResult = armiothub.SharedAccessSignatureAuthorizationRuleListResult{ - // Value: []*armiothub.SharedAccessSignatureAuthorizationRule{ - // { - // KeyName: to.Ptr("iothubowner"), - // PrimaryKey: to.Ptr(""), - // Rights: to.Ptr(armiothub.AccessRightsRegistryWriteServiceConnectDeviceConnect), - // SecondaryKey: to.Ptr(""), - // }, - // { - // KeyName: to.Ptr("service"), - // PrimaryKey: to.Ptr(""), - // Rights: to.Ptr(armiothub.AccessRightsServiceConnect), - // SecondaryKey: to.Ptr(""), - // }, - // { - // KeyName: to.Ptr("device"), - // PrimaryKey: to.Ptr(""), - // Rights: to.Ptr(armiothub.AccessRightsDeviceConnect), - // SecondaryKey: to.Ptr(""), - // }, - // { - // KeyName: to.Ptr("registryRead"), - // PrimaryKey: to.Ptr(""), - // Rights: to.Ptr(armiothub.AccessRightsRegistryRead), - // SecondaryKey: to.Ptr(""), - // }, - // { - // KeyName: to.Ptr("registryReadWrite"), - // PrimaryKey: to.Ptr(""), - // Rights: to.Ptr(armiothub.AccessRightsRegistryWrite), - // SecondaryKey: to.Ptr(""), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getkey.json -func ExampleResourceClient_GetKeysForKeyName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().GetKeysForKeyName(ctx, "myResourceGroup", "testHub", "iothubowner", 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.SharedAccessSignatureAuthorizationRule = armiothub.SharedAccessSignatureAuthorizationRule{ - // KeyName: to.Ptr("iothubowner"), - // PrimaryKey: to.Ptr(""), - // Rights: to.Ptr(armiothub.AccessRightsRegistryWriteServiceConnectDeviceConnect), - // SecondaryKey: to.Ptr(""), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_exportdevices.json -func ExampleResourceClient_ExportDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().ExportDevices(ctx, "myResourceGroup", "testHub", armiothub.ExportDevicesRequest{ - AuthenticationType: to.Ptr(armiothub.AuthenticationTypeIdentityBased), - ExcludeKeys: to.Ptr(true), - ExportBlobContainerURI: to.Ptr("testBlob"), - Identity: &armiothub.ManagedIdentity{ - UserAssignedIdentity: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), - }, - }, 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.JobResponse = armiothub.JobResponse{ - // Type: to.Ptr(armiothub.JobTypeUnknown), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // JobID: to.Ptr("test"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // Status: to.Ptr(armiothub.JobStatusUnknown), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_importdevices.json -func ExampleResourceClient_ImportDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceClient().ImportDevices(ctx, "myResourceGroup", "testHub", armiothub.ImportDevicesRequest{ - InputBlobContainerURI: to.Ptr("testBlob"), - OutputBlobContainerURI: to.Ptr("testBlob"), - }, 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.JobResponse = armiothub.JobResponse{ - // Type: to.Ptr(armiothub.JobTypeUnknown), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // JobID: to.Ptr("test"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "Thu, 15 Jun 2017 19:20:58 GMT"); return t}()), - // Status: to.Ptr(armiothub.JobStatusUnknown), - // } -} diff --git a/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go b/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go index 878891404e55..c62336720b6d 100644 --- a/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go +++ b/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_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 armiothub @@ -47,22 +46,25 @@ func NewResourceProviderCommonClient(subscriptionID string, credential azcore.To // GetSubscriptionQuota - Get the number of free and paid iot hubs in the subscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-15-preview +// Generated from API version 2023-06-30-preview // - options - ResourceProviderCommonClientGetSubscriptionQuotaOptions contains the optional parameters for the ResourceProviderCommonClient.GetSubscriptionQuota // method. func (client *ResourceProviderCommonClient) GetSubscriptionQuota(ctx context.Context, options *ResourceProviderCommonClientGetSubscriptionQuotaOptions) (ResourceProviderCommonClientGetSubscriptionQuotaResponse, error) { + var err error req, err := client.getSubscriptionQuotaCreateRequest(ctx, options) if err != nil { return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, err } - return client.getSubscriptionQuotaHandleResponse(resp) + resp, err := client.getSubscriptionQuotaHandleResponse(httpResp) + return resp, err } // getSubscriptionQuotaCreateRequest creates the GetSubscriptionQuota request. @@ -77,7 +79,7 @@ func (client *ResourceProviderCommonClient) getSubscriptionQuotaCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-15-preview") + reqQP.Set("api-version", "2023-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client_example_test.go b/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client_example_test.go deleted file mode 100644 index fac287f21d38..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client_example_test.go +++ /dev/null @@ -1,52 +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 armiothub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_usages.json -func ExampleResourceProviderCommonClient_GetSubscriptionQuota() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiothub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceProviderCommonClient().GetSubscriptionQuota(ctx, 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.UserSubscriptionQuotaListResult = armiothub.UserSubscriptionQuotaListResult{ - // Value: []*armiothub.UserSubscriptionQuota{ - // { - // Name: &armiothub.Name{ - // LocalizedValue: to.Ptr("Free Hub Count"), - // Value: to.Ptr("FreeHubCount"), - // }, - // Type: to.Ptr("/subscription/91d12660-3dec-467a-be2a-213b5544ddc0/providers/Microsoft.Devices/usages"), - // CurrentValue: to.Ptr[int32](1), - // ID: to.Ptr("/subscription/91d12660-3dec-467a-be2a-213b5544ddc0/providers/Microsoft.Devices/usages/freeHubCount"), - // Limit: to.Ptr[int32](1), - // Unit: to.Ptr("count"), - // }}, - // } -} diff --git a/sdk/resourcemanager/iothub/armiothub/response_types.go b/sdk/resourcemanager/iothub/armiothub/response_types.go index cfb1efafc2b6..9fe3d9232564 100644 --- a/sdk/resourcemanager/iothub/armiothub/response_types.go +++ b/sdk/resourcemanager/iothub/armiothub/response_types.go @@ -3,14 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armiothub // CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.CreateOrUpdate. type CertificatesClientCreateOrUpdateResponse struct { + // The X509 Certificate. CertificateDescription } @@ -21,21 +21,25 @@ type CertificatesClientDeleteResponse struct { // CertificatesClientGenerateVerificationCodeResponse contains the response from method CertificatesClient.GenerateVerificationCode. type CertificatesClientGenerateVerificationCodeResponse struct { + // The X509 Certificate. CertificateWithNonceDescription } // CertificatesClientGetResponse contains the response from method CertificatesClient.Get. type CertificatesClientGetResponse struct { + // The X509 Certificate. CertificateDescription } // CertificatesClientListByIotHubResponse contains the response from method CertificatesClient.ListByIotHub. type CertificatesClientListByIotHubResponse struct { + // The JSON-serialized array of Certificate objects. CertificateListDescription } // CertificatesClientVerifyResponse contains the response from method CertificatesClient.Verify. type CertificatesClientVerifyResponse struct { + // The X509 Certificate. CertificateDescription } @@ -46,16 +50,20 @@ type ClientManualFailoverResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of + // results. OperationListResult } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { + // The private endpoint connection of an IotHub PrivateEndpointConnection } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // The private endpoint connection of an IotHub PrivateEndpointConnection } @@ -67,31 +75,37 @@ type PrivateEndpointConnectionsClientListResponse struct { // PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginUpdate. type PrivateEndpointConnectionsClientUpdateResponse struct { + // The private endpoint connection of an IotHub PrivateEndpointConnection } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // The group information for creating a private endpoint on an IotHub GroupIDInformation } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. type PrivateLinkResourcesClientListResponse struct { + // The available private link resources for an IotHub PrivateLinkResources } // ResourceClientCheckNameAvailabilityResponse contains the response from method ResourceClient.CheckNameAvailability. type ResourceClientCheckNameAvailabilityResponse struct { + // The properties indicating whether a given IoT hub name is available. NameAvailabilityInfo } // ResourceClientCreateEventHubConsumerGroupResponse contains the response from method ResourceClient.CreateEventHubConsumerGroup. type ResourceClientCreateEventHubConsumerGroupResponse struct { + // The properties of the EventHubConsumerGroupInfo object. EventHubConsumerGroupInfo } // ResourceClientCreateOrUpdateResponse contains the response from method ResourceClient.BeginCreateOrUpdate. type ResourceClientCreateOrUpdateResponse struct { + // The description of the IoT hub. Description } @@ -102,100 +116,120 @@ type ResourceClientDeleteEventHubConsumerGroupResponse struct { // ResourceClientDeleteResponse contains the response from method ResourceClient.BeginDelete. type ResourceClientDeleteResponse struct { + // The description of the IoT hub. Description } // ResourceClientExportDevicesResponse contains the response from method ResourceClient.ExportDevices. type ResourceClientExportDevicesResponse struct { + // The properties of the Job Response object. JobResponse } // ResourceClientGetEndpointHealthResponse contains the response from method ResourceClient.NewGetEndpointHealthPager. type ResourceClientGetEndpointHealthResponse struct { + // The JSON-serialized array of EndpointHealthData objects with a next link. EndpointHealthDataListResult } // ResourceClientGetEventHubConsumerGroupResponse contains the response from method ResourceClient.GetEventHubConsumerGroup. type ResourceClientGetEventHubConsumerGroupResponse struct { + // The properties of the EventHubConsumerGroupInfo object. EventHubConsumerGroupInfo } // ResourceClientGetJobResponse contains the response from method ResourceClient.GetJob. type ResourceClientGetJobResponse struct { + // The properties of the Job Response object. JobResponse } // ResourceClientGetKeysForKeyNameResponse contains the response from method ResourceClient.GetKeysForKeyName. type ResourceClientGetKeysForKeyNameResponse struct { + // The properties of an IoT hub shared access policy. SharedAccessSignatureAuthorizationRule } // ResourceClientGetQuotaMetricsResponse contains the response from method ResourceClient.NewGetQuotaMetricsPager. type ResourceClientGetQuotaMetricsResponse struct { + // The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. QuotaMetricInfoListResult } // ResourceClientGetResponse contains the response from method ResourceClient.Get. type ResourceClientGetResponse struct { + // The description of the IoT hub. Description } // ResourceClientGetStatsResponse contains the response from method ResourceClient.GetStats. type ResourceClientGetStatsResponse struct { + // Identity registry statistics. RegistryStatistics } // ResourceClientGetValidSKUsResponse contains the response from method ResourceClient.NewGetValidSKUsPager. type ResourceClientGetValidSKUsResponse struct { + // The JSON-serialized array of IotHubSkuDescription objects with a next link. SKUDescriptionListResult } // ResourceClientImportDevicesResponse contains the response from method ResourceClient.ImportDevices. type ResourceClientImportDevicesResponse struct { + // The properties of the Job Response object. JobResponse } // ResourceClientListByResourceGroupResponse contains the response from method ResourceClient.NewListByResourceGroupPager. type ResourceClientListByResourceGroupResponse struct { + // The JSON-serialized array of IotHubDescription objects with a next link. DescriptionListResult } // ResourceClientListBySubscriptionResponse contains the response from method ResourceClient.NewListBySubscriptionPager. type ResourceClientListBySubscriptionResponse struct { + // The JSON-serialized array of IotHubDescription objects with a next link. DescriptionListResult } // ResourceClientListEventHubConsumerGroupsResponse contains the response from method ResourceClient.NewListEventHubConsumerGroupsPager. type ResourceClientListEventHubConsumerGroupsResponse struct { + // The JSON-serialized array of Event Hub-compatible consumer group names with a next link. EventHubConsumerGroupsListResult } // ResourceClientListJobsResponse contains the response from method ResourceClient.NewListJobsPager. type ResourceClientListJobsResponse struct { + // The JSON-serialized array of JobResponse objects with a next link. JobResponseListResult } // ResourceClientListKeysResponse contains the response from method ResourceClient.NewListKeysPager. type ResourceClientListKeysResponse struct { + // The list of shared access policies with a next link. SharedAccessSignatureAuthorizationRuleListResult } // ResourceClientTestAllRoutesResponse contains the response from method ResourceClient.TestAllRoutes. type ResourceClientTestAllRoutesResponse struct { + // Result of testing all routes TestAllRoutesResult } // ResourceClientTestRouteResponse contains the response from method ResourceClient.TestRoute. type ResourceClientTestRouteResponse struct { + // Result of testing one route TestRouteResult } // ResourceClientUpdateResponse contains the response from method ResourceClient.BeginUpdate. type ResourceClientUpdateResponse struct { + // The description of the IoT hub. Description } // ResourceProviderCommonClientGetSubscriptionQuotaResponse contains the response from method ResourceProviderCommonClient.GetSubscriptionQuota. type ResourceProviderCommonClientGetSubscriptionQuotaResponse struct { + // Json-serialized array of User subscription quota response UserSubscriptionQuotaListResult } diff --git a/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go b/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go index a3598527ca0b..c0a41f5d01e1 100644 --- a/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go +++ b/sdk/resourcemanager/iothub/armiothub/time_rfc1123.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 armiothub diff --git a/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go b/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go index c32fab2f9216..1948acce7eb6 100644 --- a/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub