From e23a32ddc2ea9c8994cb2383a75ef5afe02b4773 Mon Sep 17 00:00:00 2001 From: Heng Lu <79895375+ms-henglu@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:49:26 +0800 Subject: [PATCH] update aztft to v0.3.1-0.20231103032414-1c1646e4c907 (#112) --- go.mod | 3 +- go.sum | 6 +- .../iothub/armiothub/CHANGELOG.md | 21 + .../iothub/armiothub/LICENSE.txt | 21 + .../iothub/armiothub/README.md | 85 + .../iothub/armiothub/autorest.md | 12 + .../resourcemanager/iothub/armiothub/build.go | 7 + .../iothub/armiothub/certificates_client.go | 419 +++ .../resourcemanager/iothub/armiothub/ci.yml | 28 + .../iothub/armiothub/client.go | 111 + .../iothub/armiothub/client_factory.go | 74 + .../iothub/armiothub/constants.go | 471 +++ .../iothub/armiothub/models.go | 1461 ++++++++ .../iothub/armiothub/models_serde.go | 3185 +++++++++++++++++ .../iothub/armiothub/operations_client.go | 94 + .../privateendpointconnections_client.go | 307 ++ .../armiothub/privatelinkresources_client.go | 166 + .../iothub/armiothub/resource_client.go | 1516 ++++++++ .../resourceprovidercommon_client.go | 93 + .../iothub/armiothub/response_types.go | 201 ++ .../iothub/armiothub/time_rfc1123.go | 71 + .../iothub/armiothub/time_rfc3339.go | 87 + .../magodo/aztft/internal/client/client.go | 9 + .../aztft/internal/populate/populate.go | 1 + .../internal/populate/populate_iothub.go | 84 + .../magodo/aztft/internal/resmap/map.json | 273 +- .../magodo/aztft/internal/resmap/map_gen.json | 257 +- .../magodo/aztft/internal/resolve/resolve.go | 3 + .../resolve/resolve_data_factory_dataset.go | 3 + .../resolve_service_connector_appservice.go | 35 + .../magodo/aztft/internal/tfid/tfid.go | 8 + vendor/modules.txt | 5 +- 32 files changed, 9093 insertions(+), 24 deletions(-) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/LICENSE.txt create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/README.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/autorest.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/build.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/certificates_client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/ci.yml create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client_factory.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/constants.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models_serde.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/operations_client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resource_client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/response_types.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go create mode 100644 vendor/github.com/magodo/aztft/internal/populate/populate_iothub.go create mode 100644 vendor/github.com/magodo/aztft/internal/resolve/resolve_service_connector_appservice.go diff --git a/go.mod b/go.mod index c4551e22..923e1d8f 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/hashicorp/terraform-exec v0.18.1 github.com/hashicorp/terraform-json v0.17.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0 - github.com/magodo/aztft v0.3.1-0.20230825031936-c246852b4337 + github.com/magodo/aztft v0.3.1-0.20231103032414-1c1646e4c907 github.com/magodo/tfadd v0.10.1-0.20230512075749-9c0bab46fdb8 github.com/mitchellh/cli v1.1.5 github.com/zclconf/go-cty v1.13.2 @@ -37,6 +37,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/domainservices/armdomainservices v1.1.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub v1.1.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto v1.3.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic v1.1.1 // indirect diff --git a/go.sum b/go.sum index f00775c4..91bc96af 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight v1.1.1 h1:6ghFnaAk11vxyGn801zsqguqy+RH4Iz3F66dmzMcggY= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight v1.1.1/go.mod h1:u6bw9rYVrSELFGelW3WlH6+LvxvPhgAKOLqpqI2hv6k= 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/iothub/armiothub v1.1.1 h1:Dh8SxVXcSyQN76LI4IseKyrnqyTUsx336Axg8zDYSMs= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub v1.1.1/go.mod h1:fqmmortNEICbosf7BfNVO3wWs6Cz/pkxYfExJC97Vy8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0 h1:8d4U82r7ItT1Es91x3eUcAQweih36KWvUha8AZ9X0Rs= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0/go.mod h1:/1bkGperHinQbAHMWivoec/Ucu6//iXo6jn5mhmqCVU= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto v1.3.1 h1:ik0pyYcwUqdiPPXOioZfKL62SVu7iN5eh5zxHEbV3VE= @@ -188,8 +190,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/magodo/armid v0.0.0-20230511151020-27880e5961c3 h1:ob6vk6PlChZvutcxcLnmPH/VNmJEuwz+TmCYCVtJqeA= github.com/magodo/armid v0.0.0-20230511151020-27880e5961c3/go.mod h1:rR8E7zfGMbmfnSQvrkFiWYdhrfTqsVSltelnZB09BwA= -github.com/magodo/aztft v0.3.1-0.20230825031936-c246852b4337 h1:QFN7uYf31jurkxjOpTbTIYAtQ0Ux2ajjacOS0rTuOnY= -github.com/magodo/aztft v0.3.1-0.20230825031936-c246852b4337/go.mod h1:MZJT8lF7teMYXp8I5yWucRDd6XNl63tMIAtc7XS746g= +github.com/magodo/aztft v0.3.1-0.20231103032414-1c1646e4c907 h1:0SI+RSG4RvpvejvPjeHkh3vUCf12wFW6UzttZXBaK94= +github.com/magodo/aztft v0.3.1-0.20231103032414-1c1646e4c907/go.mod h1:hBvWN4EMP6ofzGA5d3jffaUQMz1jATxz45aaQ0+dzLE= github.com/magodo/tfadd v0.10.1-0.20230512075749-9c0bab46fdb8 h1:GWxGiCXPxOpekP5dBrPMQTfF7KdmwQ7EPlBeohJlPgo= github.com/magodo/tfadd v0.10.1-0.20230512075749-9c0bab46fdb8/go.mod h1:DbJnYhmAkyjNnVt819cytTfJMtv5DpqV9MkHuUbyv3c= github.com/magodo/tfpluginschema v0.0.0-20220905090502-2d6a05ebaefd h1:L0kTduNwpx60EdBPYOVF9oUY7jdfZHIncvQN490qWd4= diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md new file mode 100644 index 00000000..0558796f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md @@ -0,0 +1,21 @@ +# Release History + +## 1.1.1 (2023-04-14) +### Bug Fixes + +- Fix serialization bug of empty value of `any` type. + + +## 1.1.0 (2023-03-31) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + +## 1.0.0 (2022-05-17) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/LICENSE.txt new file mode 100644 index 00000000..dc0c2ffb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/README.md new file mode 100644 index 00000000..1a925af1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/README.md @@ -0,0 +1,85 @@ +# Azure IoT Hub Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub) + +The `armiothub` module provides operations for working with Azure IoT Hub. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/iothub/armiothub) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure IoT Hub module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure IoT Hub. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure IoT Hub module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armiothub.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armiothub.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewResourceClient() +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `IoT Hub` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/autorest.md new file mode 100644 index 00000000..e33bbcc1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/autorest.md @@ -0,0 +1,12 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/iothub/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/iothub/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.1.1 +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/build.go new file mode 100644 index 00000000..a4c9ffc4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/iothub/armiothub + +package armiothub diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/certificates_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/certificates_client.go new file mode 100644 index 00000000..ce3075a0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/certificates_client.go @@ -0,0 +1,419 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CertificatesClient contains the methods for the Certificates group. +// Don't use this type directly, use NewCertificatesClient() instead. +type CertificatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCertificatesClient creates a new instance of CertificatesClient with the specified values. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificatesClient, error) { + cl, err := arm.NewClient(moduleName+".CertificatesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CertificatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Adds new or replaces existing certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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 +// - certificateDescription - The certificate body. +// - 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) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, certificateName, certificateDescription, options) + if err != nil { + return CertificatesClientCreateOrUpdateResponse{}, err + } + resp, 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) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, certificateDescription CertificateDescription, options *CertificatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + 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) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (CertificatesClientCreateOrUpdateResponse, error) { + result := CertificatesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateDescription); err != nil { + return CertificatesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, certificateName, ifMatch, options) + if err != nil { + return CertificatesClientDeleteResponse{}, err + } + resp, 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) + } + return CertificatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, options *CertificatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GenerateVerificationCode - Generates verification code for proof of possession flow. The verification code will be used +// to generate a leaf certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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 - 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) { + req, err := client.generateVerificationCodeCreateRequest(ctx, resourceGroupName, resourceName, certificateName, ifMatch, options) + if err != nil { + return CertificatesClientGenerateVerificationCodeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificatesClientGenerateVerificationCodeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientGenerateVerificationCodeResponse{}, runtime.NewResponseError(resp) + } + return client.generateVerificationCodeHandleResponse(resp) +} + +// generateVerificationCodeCreateRequest creates the GenerateVerificationCode request. +func (client *CertificatesClient) generateVerificationCodeCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, options *CertificatesClientGenerateVerificationCodeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateVerificationCodeHandleResponse handles the GenerateVerificationCode response. +func (client *CertificatesClient) generateVerificationCodeHandleResponse(resp *http.Response) (CertificatesClientGenerateVerificationCodeResponse, error) { + result := CertificatesClientGenerateVerificationCodeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateWithNonceDescription); err != nil { + return CertificatesClientGenerateVerificationCodeResponse{}, err + } + return result, nil +} + +// Get - Returns the certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, certificateName, options) + if err != nil { + return CertificatesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CertificatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CertificatesClient) getHandleResponse(resp *http.Response) (CertificatesClientGetResponse, error) { + result := CertificatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateDescription); err != nil { + return CertificatesClientGetResponse{}, err + } + return result, nil +} + +// ListByIotHub - Returns the list of certificates. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.listByIotHubCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return CertificatesClientListByIotHubResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificatesClientListByIotHubResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientListByIotHubResponse{}, runtime.NewResponseError(resp) + } + return client.listByIotHubHandleResponse(resp) +} + +// listByIotHubCreateRequest creates the ListByIotHub request. +func (client *CertificatesClient) listByIotHubCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *CertificatesClientListByIotHubOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByIotHubHandleResponse handles the ListByIotHub response. +func (client *CertificatesClient) listByIotHubHandleResponse(resp *http.Response) (CertificatesClientListByIotHubResponse, error) { + result := CertificatesClientListByIotHubResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateListDescription); err != nil { + return CertificatesClientListByIotHubResponse{}, err + } + return result, nil +} + +// Verify - Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded +// certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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. +// - 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) { + req, err := client.verifyCreateRequest(ctx, resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody, options) + if err != nil { + return CertificatesClientVerifyResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificatesClientVerifyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificatesClientVerifyResponse{}, runtime.NewResponseError(resp) + } + return client.verifyHandleResponse(resp) +} + +// verifyCreateRequest creates the Verify request. +func (client *CertificatesClient) verifyCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, ifMatch string, certificateVerificationBody CertificateVerificationDescription, options *CertificatesClientVerifyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if certificateName == "" { + return nil, errors.New("parameter certificateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{certificateName}", url.PathEscape(certificateName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + 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) +} + +// verifyHandleResponse handles the Verify response. +func (client *CertificatesClient) verifyHandleResponse(resp *http.Response) (CertificatesClientVerifyResponse, error) { + result := CertificatesClientVerifyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateDescription); err != nil { + return CertificatesClientVerifyResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/ci.yml new file mode 100644 index 00000000..06aab7a9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/iothub/armiothub/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/iothub/armiothub/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/iothub/armiothub' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client.go new file mode 100644 index 00000000..fce2bf21 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client.go @@ -0,0 +1,111 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// Client contains the methods for the IotHub group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + internal *arm.Client + subscriptionID string +} + +// NewClient creates a new instance of Client with the specified values. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + cl, err := arm.NewClient(moduleName+".Client", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &Client{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 2021-07-02 +// - 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 +// locations property. To learn more, see https://aka.ms/manualfailover/region +// - options - ClientBeginManualFailoverOptions contains the optional parameters for the Client.BeginManualFailover method. +func (client *Client) BeginManualFailover(ctx context.Context, iotHubName string, resourceGroupName string, failoverInput FailoverInput, options *ClientBeginManualFailoverOptions) (*runtime.Poller[ClientManualFailoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.manualFailover(ctx, iotHubName, resourceGroupName, failoverInput, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientManualFailoverResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[ClientManualFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 2021-07-02 +func (client *Client) manualFailover(ctx context.Context, iotHubName string, resourceGroupName string, failoverInput FailoverInput, options *ClientBeginManualFailoverOptions) (*http.Response, error) { + req, err := client.manualFailoverCreateRequest(ctx, iotHubName, resourceGroupName, failoverInput, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, nil +} + +// manualFailoverCreateRequest creates the ManualFailover request. +func (client *Client) manualFailoverCreateRequest(ctx context.Context, iotHubName string, resourceGroupName string, failoverInput FailoverInput, options *ClientBeginManualFailoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover" + if iotHubName == "" { + return nil, errors.New("parameter iotHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotHubName}", url.PathEscape(iotHubName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, failoverInput) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client_factory.go new file mode 100644 index 00000000..93ee5197 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/client_factory.go @@ -0,0 +1,74 @@ +//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 + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewResourceClient() *ResourceClient { + subClient, _ := NewResourceClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewResourceProviderCommonClient() *ResourceProviderCommonClient { + subClient, _ := NewResourceProviderCommonClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCertificatesClient() *CertificatesClient { + subClient, _ := NewCertificatesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/constants.go new file mode 100644 index 00000000..7b073c6e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/constants.go @@ -0,0 +1,471 @@ +//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 + +const ( + moduleName = "armiothub" + moduleVersion = "v1.1.1" +) + +// 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" + AccessRightsRegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" + AccessRightsRegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" + AccessRightsRegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" + AccessRightsServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" + AccessRightsRegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" + AccessRightsRegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" + AccessRightsRegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" + AccessRightsRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" + AccessRightsRegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" +) + +// PossibleAccessRightsValues returns the possible values for the AccessRights const type. +func PossibleAccessRightsValues() []AccessRights { + return []AccessRights{ + AccessRightsRegistryRead, + AccessRightsRegistryWrite, + AccessRightsServiceConnect, + AccessRightsDeviceConnect, + AccessRightsRegistryReadRegistryWrite, + AccessRightsRegistryReadServiceConnect, + AccessRightsRegistryReadDeviceConnect, + AccessRightsRegistryWriteServiceConnect, + AccessRightsRegistryWriteDeviceConnect, + AccessRightsServiceConnectDeviceConnect, + AccessRightsRegistryReadRegistryWriteServiceConnect, + AccessRightsRegistryReadRegistryWriteDeviceConnect, + AccessRightsRegistryReadServiceConnectDeviceConnect, + AccessRightsRegistryWriteServiceConnectDeviceConnect, + AccessRightsRegistryReadRegistryWriteServiceConnectDeviceConnect, + } +} + +// AuthenticationType - Specifies authentication type being used for connecting to the storage account. +type AuthenticationType string + +const ( + AuthenticationTypeIdentityBased AuthenticationType = "identityBased" + AuthenticationTypeKeyBased AuthenticationType = "keyBased" +) + +// PossibleAuthenticationTypeValues returns the possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{ + AuthenticationTypeIdentityBased, + AuthenticationTypeKeyBased, + } +} + +// Capabilities - The capabilities and features enabled for the IoT hub. +type Capabilities string + +const ( + CapabilitiesDeviceManagement Capabilities = "DeviceManagement" + CapabilitiesNone Capabilities = "None" +) + +// PossibleCapabilitiesValues returns the possible values for the Capabilities const type. +func PossibleCapabilitiesValues() []Capabilities { + return []Capabilities{ + CapabilitiesDeviceManagement, + CapabilitiesNone, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DefaultAction - Default Action for Network Rule Set +type DefaultAction string + +const ( + DefaultActionAllow DefaultAction = "Allow" + DefaultActionDeny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns the possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{ + DefaultActionAllow, + DefaultActionDeny, + } +} + +// EndpointHealthStatus - Health statuses have following meanings. The 'healthy' status shows that the endpoint is accepting +// messages as expected. The 'unhealthy' status shows that the endpoint is not accepting messages as +// expected and IoT Hub is retrying to send data to this endpoint. The status of an unhealthy endpoint will be updated to +// healthy when IoT Hub has established an eventually consistent state of health. +// The 'dead' status shows that the endpoint is not accepting messages, after IoT Hub retried sending messages for the retrial +// period. See IoT Hub metrics to identify errors and monitor issues with +// endpoints. The 'unknown' status shows that the IoT Hub has not established a connection with the endpoint. No messages +// have been delivered to or rejected from this endpoint +type EndpointHealthStatus string + +const ( + EndpointHealthStatusDead EndpointHealthStatus = "dead" + EndpointHealthStatusDegraded EndpointHealthStatus = "degraded" + EndpointHealthStatusHealthy EndpointHealthStatus = "healthy" + EndpointHealthStatusUnhealthy EndpointHealthStatus = "unhealthy" + EndpointHealthStatusUnknown EndpointHealthStatus = "unknown" +) + +// PossibleEndpointHealthStatusValues returns the possible values for the EndpointHealthStatus const type. +func PossibleEndpointHealthStatusValues() []EndpointHealthStatus { + return []EndpointHealthStatus{ + EndpointHealthStatusDead, + EndpointHealthStatusDegraded, + EndpointHealthStatusHealthy, + EndpointHealthStatusUnhealthy, + EndpointHealthStatusUnknown, + } +} + +// IPFilterActionType - The desired action for requests captured by this rule. +type IPFilterActionType string + +const ( + IPFilterActionTypeAccept IPFilterActionType = "Accept" + IPFilterActionTypeReject IPFilterActionType = "Reject" +) + +// PossibleIPFilterActionTypeValues returns the possible values for the IPFilterActionType const type. +func PossibleIPFilterActionTypeValues() []IPFilterActionType { + return []IPFilterActionType{ + IPFilterActionTypeAccept, + IPFilterActionTypeReject, + } +} + +// IotHubNameUnavailabilityReason - The reason for unavailability. +type IotHubNameUnavailabilityReason string + +const ( + IotHubNameUnavailabilityReasonInvalid IotHubNameUnavailabilityReason = "Invalid" + IotHubNameUnavailabilityReasonAlreadyExists IotHubNameUnavailabilityReason = "AlreadyExists" +) + +// PossibleIotHubNameUnavailabilityReasonValues returns the possible values for the IotHubNameUnavailabilityReason const type. +func PossibleIotHubNameUnavailabilityReasonValues() []IotHubNameUnavailabilityReason { + return []IotHubNameUnavailabilityReason{ + IotHubNameUnavailabilityReasonInvalid, + IotHubNameUnavailabilityReasonAlreadyExists, + } +} + +// IotHubReplicaRoleType - The role of the region, can be either primary or secondary. The primary region is where the IoT +// hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and +// also the region where the IoT hub can failover to. +type IotHubReplicaRoleType string + +const ( + IotHubReplicaRoleTypePrimary IotHubReplicaRoleType = "primary" + IotHubReplicaRoleTypeSecondary IotHubReplicaRoleType = "secondary" +) + +// PossibleIotHubReplicaRoleTypeValues returns the possible values for the IotHubReplicaRoleType const type. +func PossibleIotHubReplicaRoleTypeValues() []IotHubReplicaRoleType { + return []IotHubReplicaRoleType{ + IotHubReplicaRoleTypePrimary, + IotHubReplicaRoleTypeSecondary, + } +} + +// IotHubSKU - The name of the SKU. +type IotHubSKU string + +const ( + IotHubSKUB1 IotHubSKU = "B1" + IotHubSKUB2 IotHubSKU = "B2" + IotHubSKUB3 IotHubSKU = "B3" + IotHubSKUF1 IotHubSKU = "F1" + IotHubSKUS1 IotHubSKU = "S1" + IotHubSKUS2 IotHubSKU = "S2" + IotHubSKUS3 IotHubSKU = "S3" +) + +// PossibleIotHubSKUValues returns the possible values for the IotHubSKU const type. +func PossibleIotHubSKUValues() []IotHubSKU { + return []IotHubSKU{ + IotHubSKUB1, + IotHubSKUB2, + IotHubSKUB3, + IotHubSKUF1, + IotHubSKUS1, + IotHubSKUS2, + IotHubSKUS3, + } +} + +// IotHubSKUTier - The billing tier for the IoT hub. +type IotHubSKUTier string + +const ( + IotHubSKUTierFree IotHubSKUTier = "Free" + IotHubSKUTierStandard IotHubSKUTier = "Standard" + IotHubSKUTierBasic IotHubSKUTier = "Basic" +) + +// PossibleIotHubSKUTierValues returns the possible values for the IotHubSKUTier const type. +func PossibleIotHubSKUTierValues() []IotHubSKUTier { + return []IotHubSKUTier{ + IotHubSKUTierFree, + IotHubSKUTierStandard, + IotHubSKUTierBasic, + } +} + +// IotHubScaleType - The type of the scaling enabled. +type IotHubScaleType string + +const ( + IotHubScaleTypeAutomatic IotHubScaleType = "Automatic" + IotHubScaleTypeManual IotHubScaleType = "Manual" + IotHubScaleTypeNone IotHubScaleType = "None" +) + +// PossibleIotHubScaleTypeValues returns the possible values for the IotHubScaleType const type. +func PossibleIotHubScaleTypeValues() []IotHubScaleType { + return []IotHubScaleType{ + IotHubScaleTypeAutomatic, + IotHubScaleTypeManual, + IotHubScaleTypeNone, + } +} + +// JobStatus - The status of the job. +type JobStatus string + +const ( + JobStatusUnknown JobStatus = "unknown" + JobStatusEnqueued JobStatus = "enqueued" + JobStatusRunning JobStatus = "running" + JobStatusCompleted JobStatus = "completed" + JobStatusFailed JobStatus = "failed" + JobStatusCancelled JobStatus = "cancelled" +) + +// PossibleJobStatusValues returns the possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{ + JobStatusUnknown, + JobStatusEnqueued, + JobStatusRunning, + JobStatusCompleted, + JobStatusFailed, + JobStatusCancelled, + } +} + +// JobType - The type of the job. +type JobType string + +const ( + JobTypeBackup JobType = "backup" + JobTypeExport JobType = "export" + JobTypeFactoryResetDevice JobType = "factoryResetDevice" + JobTypeFirmwareUpdate JobType = "firmwareUpdate" + JobTypeImport JobType = "import" + JobTypeReadDeviceProperties JobType = "readDeviceProperties" + JobTypeRebootDevice JobType = "rebootDevice" + JobTypeUnknown JobType = "unknown" + JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration" + JobTypeWriteDeviceProperties JobType = "writeDeviceProperties" +) + +// PossibleJobTypeValues returns the possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{ + JobTypeBackup, + JobTypeExport, + JobTypeFactoryResetDevice, + JobTypeFirmwareUpdate, + JobTypeImport, + JobTypeReadDeviceProperties, + JobTypeRebootDevice, + JobTypeUnknown, + JobTypeUpdateDeviceConfiguration, + JobTypeWriteDeviceProperties, + } +} + +// NetworkRuleIPAction - IP Filter Action +type NetworkRuleIPAction string + +const ( + NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" +) + +// PossibleNetworkRuleIPActionValues returns the possible values for the NetworkRuleIPAction const type. +func PossibleNetworkRuleIPActionValues() []NetworkRuleIPAction { + return []NetworkRuleIPAction{ + NetworkRuleIPActionAllow, + } +} + +// PrivateLinkServiceConnectionStatus - The status of a private endpoint connection +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns the possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{ + PrivateLinkServiceConnectionStatusApproved, + PrivateLinkServiceConnectionStatusDisconnected, + PrivateLinkServiceConnectionStatusPending, + PrivateLinkServiceConnectionStatusRejected, + } +} + +// PublicNetworkAccess - Whether requests from Public Network are allowed +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// ResourceIdentityType - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both +// an implicitly created identity and a set of user assigned identities. The type 'None' will remove any +// identities from the service. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeNone ResourceIdentityType = "None" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeUserAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeNone, + } +} + +// RouteErrorSeverity - Severity of the route error +type RouteErrorSeverity string + +const ( + RouteErrorSeverityError RouteErrorSeverity = "error" + RouteErrorSeverityWarning RouteErrorSeverity = "warning" +) + +// PossibleRouteErrorSeverityValues returns the possible values for the RouteErrorSeverity const type. +func PossibleRouteErrorSeverityValues() []RouteErrorSeverity { + return []RouteErrorSeverity{ + RouteErrorSeverityError, + RouteErrorSeverityWarning, + } +} + +// RoutingSource - The source that the routing rule is to be applied to, such as DeviceMessages. +type RoutingSource string + +const ( + RoutingSourceDeviceConnectionStateEvents RoutingSource = "DeviceConnectionStateEvents" + RoutingSourceDeviceJobLifecycleEvents RoutingSource = "DeviceJobLifecycleEvents" + RoutingSourceDeviceLifecycleEvents RoutingSource = "DeviceLifecycleEvents" + RoutingSourceDeviceMessages RoutingSource = "DeviceMessages" + RoutingSourceInvalid RoutingSource = "Invalid" + RoutingSourceTwinChangeEvents RoutingSource = "TwinChangeEvents" +) + +// PossibleRoutingSourceValues returns the possible values for the RoutingSource const type. +func PossibleRoutingSourceValues() []RoutingSource { + return []RoutingSource{ + RoutingSourceDeviceConnectionStateEvents, + RoutingSourceDeviceJobLifecycleEvents, + RoutingSourceDeviceLifecycleEvents, + RoutingSourceDeviceMessages, + RoutingSourceInvalid, + RoutingSourceTwinChangeEvents, + } +} + +// RoutingStorageContainerPropertiesEncoding - Encoding that is used to serialize messages to blobs. Supported values are +// 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. +type RoutingStorageContainerPropertiesEncoding string + +const ( + RoutingStorageContainerPropertiesEncodingAvro RoutingStorageContainerPropertiesEncoding = "Avro" + RoutingStorageContainerPropertiesEncodingAvroDeflate RoutingStorageContainerPropertiesEncoding = "AvroDeflate" + RoutingStorageContainerPropertiesEncodingJSON RoutingStorageContainerPropertiesEncoding = "JSON" +) + +// PossibleRoutingStorageContainerPropertiesEncodingValues returns the possible values for the RoutingStorageContainerPropertiesEncoding const type. +func PossibleRoutingStorageContainerPropertiesEncodingValues() []RoutingStorageContainerPropertiesEncoding { + return []RoutingStorageContainerPropertiesEncoding{ + RoutingStorageContainerPropertiesEncodingAvro, + RoutingStorageContainerPropertiesEncodingAvroDeflate, + RoutingStorageContainerPropertiesEncodingJSON, + } +} + +// TestResultStatus - Result of testing route +type TestResultStatus string + +const ( + TestResultStatusFalse TestResultStatus = "false" + TestResultStatusTrue TestResultStatus = "true" + TestResultStatusUndefined TestResultStatus = "undefined" +) + +// PossibleTestResultStatusValues returns the possible values for the TestResultStatus const type. +func PossibleTestResultStatusValues() []TestResultStatus { + return []TestResultStatus{ + TestResultStatusFalse, + TestResultStatusTrue, + TestResultStatusUndefined, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models.go new file mode 100644 index 00000000..29249325 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models.go @@ -0,0 +1,1461 @@ +//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 + +import "time" + +type ArmIdentity struct { + // The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created + // identity and a set of user assigned identities. The type 'None' will remove any + // identities from the service. + Type *ResourceIdentityType + + // Dictionary of + UserAssignedIdentities map[string]*ArmUserIdentity + + // READ-ONLY; Principal Id + PrincipalID *string + + // READ-ONLY; Tenant Id + TenantID *string +} + +type ArmUserIdentity struct { + // READ-ONLY + ClientID *string + + // READ-ONLY + PrincipalID *string +} + +// Capacity - IoT Hub capacity information. +type Capacity struct { + // READ-ONLY; The default number of units. + Default *int64 + + // READ-ONLY; The maximum number of units. + Maximum *int64 + + // READ-ONLY; The minimum number of units. + Minimum *int64 + + // READ-ONLY; The type of the scaling enabled. + ScaleType *IotHubScaleType +} + +// CertificateBodyDescription - The JSON-serialized X509 Certificate. +type CertificateBodyDescription struct { + // base-64 representation of the X509 leaf certificate .cer file or just .pem file content. + Certificate *string + + // True indicates that the certificate will be created in verified state and proof of possession will not be required. + IsVerified *bool +} + +// CertificateDescription - The X509 Certificate. +type CertificateDescription struct { + // The description of an X509 CA Certificate. + Properties *CertificateProperties + + // READ-ONLY; The entity tag. + Etag *string + + // READ-ONLY; The resource identifier. + ID *string + + // READ-ONLY; The name of the certificate. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// CertificateListDescription - The JSON-serialized array of Certificate objects. +type CertificateListDescription struct { + // The array of Certificate objects. + Value []*CertificateDescription +} + +// CertificateProperties - The description of an X509 CA Certificate. +type CertificateProperties struct { + // The certificate content + Certificate *string + + // Determines whether certificate has been verified. + IsVerified *bool + + // READ-ONLY; The certificate's create date and time. + Created *time.Time + + // READ-ONLY; The certificate's expiration date and time. + Expiry *time.Time + + // READ-ONLY; The certificate's subject name. + Subject *string + + // READ-ONLY; The certificate's thumbprint. + Thumbprint *string + + // READ-ONLY; The certificate's last update date and time. + Updated *time.Time +} + +// CertificatePropertiesWithNonce - The description of an X509 CA Certificate including the challenge nonce issued for the +// Proof-Of-Possession flow. +type CertificatePropertiesWithNonce struct { + // READ-ONLY; The certificate content + Certificate *string + + // READ-ONLY; The certificate's create date and time. + Created *time.Time + + // READ-ONLY; The certificate's expiration date and time. + Expiry *time.Time + + // READ-ONLY; Determines whether certificate has been verified. + IsVerified *bool + + // READ-ONLY; The certificate's subject name. + Subject *string + + // READ-ONLY; The certificate's thumbprint. + Thumbprint *string + + // READ-ONLY; The certificate's last update date and time. + Updated *time.Time + + // READ-ONLY; The certificate's verification code that will be used for proof of possession. + VerificationCode *string +} + +// CertificateVerificationDescription - The JSON-serialized leaf certificate +type CertificateVerificationDescription struct { + // base-64 representation of X509 certificate .cer file or just .pem file content. + Certificate *string +} + +// CertificateWithNonceDescription - The X509 Certificate. +type CertificateWithNonceDescription struct { + // The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + Properties *CertificatePropertiesWithNonce + + // READ-ONLY; The entity tag. + Etag *string + + // READ-ONLY; The resource identifier. + ID *string + + // READ-ONLY; The name of the certificate. + Name *string + + // READ-ONLY; The resource type. + 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. + DefaultTTLAsIso8601 *string + + // The properties of the feedback queue for cloud-to-device messages. + Feedback *FeedbackProperties + + // The max delivery count 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. + MaxDeliveryCount *int32 +} + +// Description - The description of the IoT hub. +type Description struct { + // REQUIRED; The resource location. + Location *string + + // REQUIRED; IotHub SKU info + SKU *SKUInfo + + // The Etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal + // ETag convention. + Etag *string + + // The managed identities for the IotHub. + Identity *ArmIdentity + + // IotHub properties + Properties *Properties + + // The resource tags. + Tags map[string]*string + + // READ-ONLY; The resource identifier. + ID *string + + // READ-ONLY; The resource name. + Name *string + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData + + // READ-ONLY; The resource type. + Type *string +} + +// DescriptionListResult - The JSON-serialized array of IotHubDescription objects with a next link. +type DescriptionListResult struct { + // The array of IotHubDescription objects. + Value []*Description + + // READ-ONLY; The next link. + NextLink *string +} + +// EndpointHealthData - The health data for an endpoint +type EndpointHealthData struct { + // Id of the endpoint + EndpointID *string + + // Health statuses have following meanings. The 'healthy' status shows that the endpoint is accepting messages as expected. + // The 'unhealthy' status shows that the endpoint is not accepting messages as + // expected and IoT Hub is retrying to send data to this endpoint. The status of an unhealthy endpoint will be updated to + // healthy when IoT Hub has established an eventually consistent state of health. + // The 'dead' status shows that the endpoint is not accepting messages, after IoT Hub retried sending messages for the retrial + // period. See IoT Hub metrics to identify errors and monitor issues with + // endpoints. The 'unknown' status shows that the IoT Hub has not established a connection with the endpoint. No messages + // have been delivered to or rejected from this endpoint + HealthStatus *EndpointHealthStatus + + // Last error obtained when a message failed to be delivered to iot hub + LastKnownError *string + + // Time at which the last known error occurred + LastKnownErrorTime *time.Time + + // Last time iot hub tried to send a message to the endpoint + LastSendAttemptTime *time.Time + + // Last time iot hub successfully sent a message to the endpoint + LastSuccessfulSendAttemptTime *time.Time +} + +// EndpointHealthDataListResult - The JSON-serialized array of EndpointHealthData objects with a next link. +type EndpointHealthDataListResult struct { + // JSON-serialized array of Endpoint health data + Value []*EndpointHealthData + + // READ-ONLY; Link to more results + NextLink *string +} + +// EnrichmentProperties - The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. +type EnrichmentProperties struct { + // REQUIRED; The list of endpoints for which the enrichment is applied to the message. + EndpointNames []*string + + // REQUIRED; The key or name for the enrichment property. + Key *string + + // REQUIRED; The value for the enrichment property. + Value *string +} + +// ErrorDetails - Error details. +type ErrorDetails struct { + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details *string + + // READ-ONLY; The HTTP status code. + HTTPStatusCode *string + + // READ-ONLY; The error message. + Message *string +} + +// EventHubConsumerGroupBodyDescription - The EventHub consumer group. +type EventHubConsumerGroupBodyDescription struct { + // REQUIRED; The EventHub consumer group name. + Properties *EventHubConsumerGroupName +} + +// EventHubConsumerGroupInfo - The properties of the EventHubConsumerGroupInfo object. +type EventHubConsumerGroupInfo struct { + // The tags. + Properties map[string]any + + // READ-ONLY; The etag. + Etag *string + + // READ-ONLY; The Event Hub-compatible consumer group identifier. + ID *string + + // READ-ONLY; The Event Hub-compatible consumer group name. + Name *string + + // READ-ONLY; the resource type. + Type *string +} + +// EventHubConsumerGroupName - The EventHub consumer group name. +type EventHubConsumerGroupName struct { + // REQUIRED; EventHub consumer group name + Name *string +} + +// EventHubConsumerGroupsListResult - The JSON-serialized array of Event Hub-compatible consumer group names with a next link. +type EventHubConsumerGroupsListResult struct { + // List of consumer groups objects + Value []*EventHubConsumerGroupInfo + + // READ-ONLY; The next link. + NextLink *string +} + +// EventHubProperties - The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. +type EventHubProperties struct { + // The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + PartitionCount *int32 + + // The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages + RetentionTimeInDays *int64 + + // READ-ONLY; The Event Hub-compatible endpoint. + Endpoint *string + + // READ-ONLY; The partition ids in the Event Hub-compatible endpoint. + PartitionIDs []*string + + // READ-ONLY; The Event Hub-compatible name. + Path *string +} + +// ExportDevicesRequest - Use to provide parameters when requesting an export of all devices in the IoT hub. +type ExportDevicesRequest struct { + // REQUIRED; The value indicating whether keys should be excluded during export. + ExcludeKeys *bool + + // REQUIRED; The export blob container URI. + ExportBlobContainerURI *string + + // Specifies authentication type being used for connecting to the storage account. + AuthenticationType *AuthenticationType + + // The name of the blob that will be created in the provided output blob container. This blob will contain the exported configurations + // for the Iot Hub. + ConfigurationsBlobName *string + + // The name of the blob that will be created in the provided output blob container. This blob will contain the exported device + // registry information for the IoT Hub. + ExportBlobName *string + + // Managed identity properties of storage endpoint for export devices. + Identity *ManagedIdentity + + // The value indicating whether configurations should be exported. + IncludeConfigurations *bool +} + +// FailoverInput - Use to provide failover region when requesting manual Failover for a hub. +type FailoverInput struct { + // REQUIRED; Region the hub will be failed over to + FailoverRegion *string +} + +// FallbackRouteProperties - The properties of the fallback route. IoT Hub uses these properties when it routes messages to +// the fallback endpoint. +type FallbackRouteProperties struct { + // REQUIRED; The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint + // is allowed. + EndpointNames []*string + + // REQUIRED; Used to specify whether the fallback route is enabled. + IsEnabled *bool + + // REQUIRED; The source to which the routing rule is to be applied to. For example, DeviceMessages + Source *RoutingSource + + // The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate + // to true by default. For grammar, See: + // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language + Condition *string + + // The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum + // length of 64 characters, and must be unique. + Name *string +} + +// FeedbackProperties - The properties of the feedback queue for cloud-to-device messages. +type FeedbackProperties struct { + // The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + LockDurationAsIso8601 *string + + // The number of times the IoT hub attempts to deliver a message on the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + MaxDeliveryCount *int32 + + // The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + TTLAsIso8601 *string +} + +// GroupIDInformation - The group information for creating a private endpoint on an IotHub +type GroupIDInformation struct { + // REQUIRED; The properties for a group information object + Properties *GroupIDInformationProperties + + // READ-ONLY; The resource identifier. + ID *string + + // READ-ONLY; The resource name. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// GroupIDInformationProperties - The properties for a group information object +type GroupIDInformationProperties struct { + // The group id + GroupID *string + + // The required members for a specific group id + RequiredMembers []*string + + // The required DNS zones for a specific group id + RequiredZoneNames []*string +} + +// IPFilterRule - The IP filter rules for the IoT hub. +type IPFilterRule struct { + // REQUIRED; The desired action for requests captured by this rule. + Action *IPFilterActionType + + // REQUIRED; The name of the IP filter rule. + FilterName *string + + // REQUIRED; A string that contains the IP address range in CIDR notation for the rule. + IPMask *string +} + +// ImportDevicesRequest - Use to provide parameters when requesting an import of all devices in the hub. +type ImportDevicesRequest struct { + // REQUIRED; The input blob container URI. + InputBlobContainerURI *string + + // REQUIRED; The output blob container URI. + OutputBlobContainerURI *string + + // Specifies authentication type being used for connecting to the storage account. + AuthenticationType *AuthenticationType + + // The blob name to be used when importing configurations from the provided input blob container. + ConfigurationsBlobName *string + + // Managed identity properties of storage endpoint for import devices. + Identity *ManagedIdentity + + // The value indicating whether configurations should be imported. + IncludeConfigurations *bool + + // The blob name to be used when importing from the provided input blob container. + InputBlobName *string + + // The blob name to use for storing the status of the import job. + OutputBlobName *string +} + +// JobResponse - The properties of the Job Response object. +type JobResponse struct { + // READ-ONLY; The time the job stopped processing. + EndTimeUTC *time.Time + + // READ-ONLY; If status == failed, this string containing the reason for the failure. + FailureReason *string + + // READ-ONLY; The job identifier. + JobID *string + + // READ-ONLY; The job identifier of the parent job, if any. + ParentJobID *string + + // READ-ONLY; The start time of the job. + StartTimeUTC *time.Time + + // READ-ONLY; The status of the job. + Status *JobStatus + + // READ-ONLY; The status message for the job. + StatusMessage *string + + // READ-ONLY; The type of the job. + Type *JobType +} + +// JobResponseListResult - The JSON-serialized array of JobResponse objects with a next link. +type JobResponseListResult struct { + // The array of JobResponse objects. + Value []*JobResponse + + // READ-ONLY; The next link. + NextLink *string +} + +// LocationDescription - Public representation of one of the locations where a resource is provisioned. +type LocationDescription struct { + // The name of the Azure region + Location *string + + // The role of the region, can be either primary or secondary. The primary region is where the IoT hub is currently provisioned. + // The secondary region is the Azure disaster recovery (DR) paired region and + // also the region where the IoT hub can failover to. + Role *IotHubReplicaRoleType +} + +// ManagedIdentity - The properties of the Managed identity. +type ManagedIdentity struct { + // The user assigned identity. + UserAssignedIdentity *string +} + +// MatchedRoute - Routes that matched +type MatchedRoute struct { + // Properties of routes that matched + Properties *RouteProperties +} + +// MessagingEndpointProperties - The properties of the messaging endpoints used by this IoT hub. +type MessagingEndpointProperties struct { + // The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + LockDurationAsIso8601 *string + + // The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + MaxDeliveryCount *int32 + + // The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + TTLAsIso8601 *string +} + +// Name of Iot Hub type +type Name struct { + // Localized value of name + LocalizedValue *string + + // IotHub type + Value *string +} + +// NameAvailabilityInfo - The properties indicating whether a given IoT hub name is available. +type NameAvailabilityInfo struct { + // The detailed reason message. + Message *string + + // READ-ONLY; The value which indicates whether the provided name is available. + NameAvailable *bool + + // READ-ONLY; The reason for unavailability. + Reason *IotHubNameUnavailabilityReason +} + +// NetworkRuleSetIPRule - IP Rule to be applied as part of Network Rule Set +type NetworkRuleSetIPRule struct { + // REQUIRED; Name of the IP filter rule. + FilterName *string + + // REQUIRED; A string that contains the IP address range in CIDR notation for the rule. + IPMask *string + + // IP Filter Action + Action *NetworkRuleIPAction +} + +// NetworkRuleSetProperties - Network Rule Set Properties of IotHub +type NetworkRuleSetProperties struct { + // REQUIRED; If True, then Network Rule Set is also applied to BuiltIn EventHub EndPoint of IotHub + ApplyToBuiltInEventHubEndpoint *bool + + // REQUIRED; List of IP Rules + IPRules []*NetworkRuleSetIPRule + + // Default Action for Network Rule Set + DefaultAction *DefaultAction +} + +// Operation - IoT Hub REST API operation +type Operation struct { + // The object that represents the operation. + Display *OperationDisplay + + // READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} + Name *string +} + +// OperationDisplay - The object that represents the operation. +type OperationDisplay struct { + // READ-ONLY; Description of the operation + Description *string + + // READ-ONLY; Name of the operation + Operation *string + + // READ-ONLY; Service provider: Microsoft Devices + Provider *string + + // READ-ONLY; Resource Type: IotHubs + Resource *string +} + +// OperationInputs - Input values. +type OperationInputs struct { + // REQUIRED; The name of the IoT hub to check. + Name *string +} + +// OperationListResult - 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. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string + + // READ-ONLY; List of IoT Hub operations supported by the Microsoft.Devices resource provider. + 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. + ID *string +} + +// PrivateEndpointConnection - The private endpoint connection of an IotHub +type PrivateEndpointConnection struct { + // REQUIRED; The properties of a private endpoint connection + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; The resource identifier. + ID *string + + // READ-ONLY; The resource name. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// PrivateEndpointConnectionProperties - The properties of a private endpoint connection +type PrivateEndpointConnectionProperties struct { + // REQUIRED; The current state of a private endpoint connection + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The private endpoint property of a private endpoint connection + 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 + Description *string + + // REQUIRED; The status of a private endpoint connection + Status *PrivateLinkServiceConnectionStatus + + // Actions required for a private endpoint connection + ActionsRequired *string +} + +// Properties - The properties of an IoT hub. +type Properties struct { + // List of allowed FQDNs(Fully Qualified Domain Name) for egress from Iot Hub. + AllowedFqdnList []*string + + // The shared access policies you can use to secure a connection to the IoT hub. + AuthorizationPolicies []*SharedAccessSignatureAuthorizationRule + + // The IoT hub cloud-to-device messaging properties. + CloudToDevice *CloudToDeviceProperties + + // IoT hub comments. + Comments *string + + // If true, all device(including Edge devices but excluding modules) scoped SAS keys cannot be used for authentication. + DisableDeviceSAS *bool + + // If true, SAS tokens with Iot hub scoped SAS keys cannot be used for authentication. + DisableLocalAuth *bool + + // If true, all module scoped SAS keys cannot be used for authentication. + DisableModuleSAS *bool + + // This property when set to true, will enable data residency, thus, disabling disaster recovery. + EnableDataResidency *bool + + // If True, file upload notifications are enabled. + EnableFileUploadNotifications *bool + + // The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present + // in the dictionary while making create or update calls for the IoT hub. + EventHubEndpoints map[string]*EventHubProperties + + // The capabilities and features enabled for the IoT hub. + Features *Capabilities + + // The IP filter rules. + IPFilterRules []*IPFilterRule + + // The messaging endpoint properties for the file upload notification queue. + MessagingEndpoints map[string]*MessagingEndpointProperties + + // Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below + // 1.2 to be rejected. + MinTLSVersion *string + + // Network Rule Set Properties of IotHub + NetworkRuleSets *NetworkRuleSetProperties + + // Private endpoint connections created on this IotHub + PrivateEndpointConnections []*PrivateEndpointConnection + + // Whether requests from Public Network are allowed + PublicNetworkAccess *PublicNetworkAccess + + // If true, egress from IotHub will be restricted to only the allowed FQDNs that are configured via allowedFqdnList. + RestrictOutboundNetworkAccess *bool + + // The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging + Routing *RoutingProperties + + // The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account + // and that MUST have its key as $default. Specifying more than one storage + // account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property + // is set to True, causes an error to be thrown. + StorageEndpoints map[string]*StorageEndpointProperties + + // READ-ONLY; The name of the host. + HostName *string + + // READ-ONLY; Primary and secondary location for iot hub + Locations []*LocationDescription + + // READ-ONLY; The provisioning state. + ProvisioningState *string + + // READ-ONLY; The hub state. + State *string +} + +// QuotaMetricInfo - Quota metrics properties. +type QuotaMetricInfo struct { + // READ-ONLY; The current value for the quota metric. + CurrentValue *int64 + + // READ-ONLY; The maximum value of the quota metric. + MaxValue *int64 + + // READ-ONLY; The name of the quota metric. + Name *string +} + +// QuotaMetricInfoListResult - The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. +type QuotaMetricInfoListResult struct { + // The array of quota metrics objects. + Value []*QuotaMetricInfo + + // READ-ONLY; The next link. + NextLink *string +} + +// RegistryStatistics - Identity registry statistics. +type RegistryStatistics struct { + // READ-ONLY; The count of disabled devices in the identity registry. + DisabledDeviceCount *int64 + + // READ-ONLY; The count of enabled devices in the identity registry. + EnabledDeviceCount *int64 + + // READ-ONLY; The total count of devices in the identity registry. + TotalDeviceCount *int64 +} + +// Resource - The common properties of an Azure resource. +type Resource struct { + // REQUIRED; The resource location. + Location *string + + // The resource tags. + Tags map[string]*string + + // READ-ONLY; The resource identifier. + ID *string + + // READ-ONLY; The resource name. + Name *string + + // READ-ONLY; The resource type. + 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 +} + +// RouteCompilationError - Compilation error when evaluating route +type RouteCompilationError struct { + // Location where the route error happened + Location *RouteErrorRange + + // Route error message + Message *string + + // Severity of the route error + Severity *RouteErrorSeverity +} + +// RouteErrorPosition - Position where the route error happened +type RouteErrorPosition struct { + // Column where the route error happened + Column *int32 + + // Line where the route error happened + Line *int32 +} + +// RouteErrorRange - Range of route errors +type RouteErrorRange struct { + // End where the route error happened + End *RouteErrorPosition + + // Start where the route error happened + Start *RouteErrorPosition +} + +// RouteProperties - The properties of a routing rule that your IoT hub uses to route messages to endpoints. +type RouteProperties struct { + // REQUIRED; The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is + // allowed. + EndpointNames []*string + + // REQUIRED; Used to specify whether a route is enabled. + IsEnabled *bool + + // REQUIRED; The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has + // a maximum length of 64 characters, and must be unique. + Name *string + + // REQUIRED; The source that the routing rule is to be applied to, such as DeviceMessages. + Source *RoutingSource + + // The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. + // For grammar, see: + // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language + Condition *string +} + +// RoutingEndpoints - The properties related to the custom endpoints to which your IoT hub routes messages based on the routing +// 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 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. + EventHubs []*RoutingEventHubProperties + + // The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. + ServiceBusQueues []*RoutingServiceBusQueueEndpointProperties + + // The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. + ServiceBusTopics []*RoutingServiceBusTopicEndpointProperties + + // The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. + StorageContainers []*RoutingStorageContainerProperties +} + +// RoutingEventHubProperties - The properties related to an event hub endpoint. +type RoutingEventHubProperties struct { + // REQUIRED; The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, + // hyphens and has a maximum length of 64 characters. The following names are reserved: + // events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + Name *string + + // Method used to authenticate against the event hub endpoint + AuthenticationType *AuthenticationType + + // The connection string of the event hub endpoint. + ConnectionString *string + + // The url of the event hub endpoint. It must include the protocol sb:// + EndpointURI *string + + // Event hub name on the event hub namespace + EntityPath *string + + // Id of the event hub endpoint + ID *string + + // Managed identity properties of routing event hub endpoint. + Identity *ManagedIdentity + + // The name of the resource group of the event hub endpoint. + ResourceGroup *string + + // The subscription identifier of the event hub endpoint. + SubscriptionID *string +} + +// RoutingMessage - Routing message +type RoutingMessage struct { + // App properties + AppProperties map[string]*string + + // Body of routing message + Body *string + + // System properties + SystemProperties map[string]*string +} + +// RoutingProperties - The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging +type RoutingProperties struct { + // The properties related to the custom endpoints to which your IoT hub routes messages based on the routing 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. + Endpoints *RoutingEndpoints + + // The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. + // See: https://aka.ms/telemetryoneventgrid + Enrichments []*EnrichmentProperties + + // The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section + // are met. This is an optional parameter. When this property is not set, the + // messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub + // endpoint. + FallbackRoute *FallbackRouteProperties + + // The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum + // of 100 routing rules are allowed for paid hubs and a maximum of 5 routing + // rules are allowed for free hubs. + Routes []*RouteProperties +} + +// RoutingServiceBusQueueEndpointProperties - The properties related to service bus queue endpoint types. +type RoutingServiceBusQueueEndpointProperties struct { + // REQUIRED; The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, + // hyphens and has a maximum length of 64 characters. The following names are reserved: + // events, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same + // as the actual queue name. + Name *string + + // Method used to authenticate against the service bus queue endpoint + AuthenticationType *AuthenticationType + + // The connection string of the service bus queue endpoint. + ConnectionString *string + + // The url of the service bus queue endpoint. It must include the protocol sb:// + EndpointURI *string + + // Queue name on the service bus namespace + EntityPath *string + + // Id of the service bus queue endpoint + ID *string + + // Managed identity properties of routing service bus queue endpoint. + Identity *ManagedIdentity + + // The name of the resource group of the service bus queue endpoint. + ResourceGroup *string + + // The subscription identifier of the service bus queue endpoint. + SubscriptionID *string +} + +// RoutingServiceBusTopicEndpointProperties - The properties related to service bus topic endpoint types. +type RoutingServiceBusTopicEndpointProperties struct { + // REQUIRED; The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, + // hyphens and has a maximum length of 64 characters. The following names are reserved: + // events, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same + // as the actual topic name. + Name *string + + // Method used to authenticate against the service bus topic endpoint + AuthenticationType *AuthenticationType + + // The connection string of the service bus topic endpoint. + ConnectionString *string + + // The url of the service bus topic endpoint. It must include the protocol sb:// + EndpointURI *string + + // Queue name on the service bus topic + EntityPath *string + + // Id of the service bus topic endpoint + ID *string + + // Managed identity properties of routing service bus topic endpoint. + Identity *ManagedIdentity + + // The name of the resource group of the service bus topic endpoint. + ResourceGroup *string + + // The subscription identifier of the service bus topic endpoint. + SubscriptionID *string +} + +// RoutingStorageContainerProperties - The properties related to a storage container endpoint. +type RoutingStorageContainerProperties struct { + // REQUIRED; The name of storage container in the storage account. + ContainerName *string + + // REQUIRED; The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, + // hyphens and has a maximum length of 64 characters. The following names are reserved: + // events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + Name *string + + // Method used to authenticate against the storage endpoint + AuthenticationType *AuthenticationType + + // Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds. + BatchFrequencyInSeconds *int32 + + // The connection string of the storage account. + ConnectionString *string + + // Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value + // is 'avro'. + Encoding *RoutingStorageContainerPropertiesEncoding + + // The url of the storage endpoint. It must include the protocol https:// + EndpointURI *string + + // File name format for the blob. Default format is {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory + // but can be reordered. + FileNameFormat *string + + // Id of the storage container endpoint + ID *string + + // Managed identity properties of routing storage endpoint. + Identity *ManagedIdentity + + // Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). + // Default value is 314572800(300MB). + MaxChunkSizeInBytes *int32 + + // The name of the resource group of the storage account. + ResourceGroup *string + + // The subscription identifier of the storage account. + SubscriptionID *string +} + +// RoutingTwin - Twin reference input parameter. This is an optional parameter +type RoutingTwin struct { + Properties *RoutingTwinProperties + + // Twin Tags + Tags any +} + +type RoutingTwinProperties struct { + // Twin desired properties + Desired any + + // Twin desired properties + Reported any +} + +// SKUDescription - SKU properties. +type SKUDescription struct { + // REQUIRED; IotHub capacity + Capacity *Capacity + + // REQUIRED; The type of the resource. + SKU *SKUInfo + + // READ-ONLY; The type of the resource. + ResourceType *string +} + +// SKUDescriptionListResult - The JSON-serialized array of IotHubSkuDescription objects with a next link. +type SKUDescriptionListResult struct { + // The array of IotHubSkuDescription. + Value []*SKUDescription + + // READ-ONLY; The next link. + NextLink *string +} + +// SKUInfo - Information about the SKU of the IoT hub. +type SKUInfo struct { + // REQUIRED; The name of the SKU. + Name *IotHubSKU + + // The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + Capacity *int64 + + // READ-ONLY; The billing tier for the IoT hub. + Tier *IotHubSKUTier +} + +// SharedAccessSignatureAuthorizationRule - The properties of an IoT hub shared access policy. +type SharedAccessSignatureAuthorizationRule struct { + // REQUIRED; The name of the shared access policy. + KeyName *string + + // REQUIRED; The permissions assigned to the shared access policy. + Rights *AccessRights + + // The primary key. + PrimaryKey *string + + // The secondary key. + SecondaryKey *string +} + +// SharedAccessSignatureAuthorizationRuleListResult - The list of shared access policies with a next link. +type SharedAccessSignatureAuthorizationRuleListResult struct { + // The list of shared access policies. + Value []*SharedAccessSignatureAuthorizationRule + + // READ-ONLY; The next link. + NextLink *string +} + +// StorageEndpointProperties - The properties of the Azure Storage endpoint for file upload. +type StorageEndpointProperties struct { + // REQUIRED; The connection string for the Azure Storage account to which files are uploaded. + ConnectionString *string + + // REQUIRED; The name of the root container where you upload files. The container need not exist but should be creatable using + // the connectionString specified. + ContainerName *string + + // Specifies authentication type being used for connecting to the storage account. + AuthenticationType *AuthenticationType + + // Managed identity properties of storage endpoint for file upload. + Identity *ManagedIdentity + + // The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: + // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + SasTTLAsIso8601 *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TagsResource - A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. +type TagsResource struct { + // Resource tags + Tags map[string]*string +} + +// TestAllRoutesInput - Input for testing all routes +type TestAllRoutesInput struct { + // Routing message + Message *RoutingMessage + + // Routing source + RoutingSource *RoutingSource + + // Routing Twin Reference + Twin *RoutingTwin +} + +// TestAllRoutesResult - Result of testing all routes +type TestAllRoutesResult struct { + // JSON-serialized array of matched routes + Routes []*MatchedRoute +} + +// TestRouteInput - Input for testing route +type TestRouteInput struct { + // REQUIRED; Route properties + Route *RouteProperties + + // Routing message + Message *RoutingMessage + + // Routing Twin Reference + Twin *RoutingTwin +} + +// TestRouteResult - Result of testing one route +type TestRouteResult struct { + // Detailed result of testing route + Details *TestRouteResultDetails + + // Result of testing route + Result *TestResultStatus +} + +// TestRouteResultDetails - Detailed result of testing a route +type TestRouteResultDetails struct { + // JSON-serialized list of route compilation errors + CompilationErrors []*RouteCompilationError +} + +// UserSubscriptionQuota - User subscription quota response +type UserSubscriptionQuota struct { + // Current number of IotHub type + CurrentValue *int32 + + // IotHub type id + ID *string + + // Numerical limit on IotHub type + Limit *int32 + + // IotHub type + Name *Name + + // Response type + Type *string + + // Unit of IotHub type + Unit *string +} + +// UserSubscriptionQuotaListResult - Json-serialized array of User subscription quota response +type UserSubscriptionQuotaListResult struct { + Value []*UserSubscriptionQuota + + // READ-ONLY + NextLink *string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models_serde.go new file mode 100644 index 00000000..9393f53f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/models_serde.go @@ -0,0 +1,3185 @@ +//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 + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ArmIdentity. +func (a ArmIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "type", a.Type) + populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmIdentity. +func (a *ArmIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &a.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArmUserIdentity. +func (a ArmUserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "principalId", a.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmUserIdentity. +func (a *ArmUserIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Capacity. +func (c Capacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "default", c.Default) + populate(objectMap, "maximum", c.Maximum) + populate(objectMap, "minimum", c.Minimum) + populate(objectMap, "scaleType", c.ScaleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Capacity. +func (c *Capacity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &c.Default) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &c.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &c.Minimum) + delete(rawMsg, key) + case "scaleType": + err = unpopulate(val, "ScaleType", &c.ScaleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateBodyDescription. +func (c CertificateBodyDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificate", c.Certificate) + populate(objectMap, "isVerified", c.IsVerified) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateBodyDescription. +func (c *CertificateBodyDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "isVerified": + err = unpopulate(val, "IsVerified", &c.IsVerified) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateDescription. +func (c CertificateDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateDescription. +func (c *CertificateDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateListDescription. +func (c CertificateListDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateListDescription. +func (c *CertificateListDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateProperties. +func (c CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificate", c.Certificate) + populateTimeRFC1123(objectMap, "created", c.Created) + populateTimeRFC1123(objectMap, "expiry", c.Expiry) + populate(objectMap, "isVerified", c.IsVerified) + populate(objectMap, "subject", c.Subject) + populate(objectMap, "thumbprint", c.Thumbprint) + populateTimeRFC1123(objectMap, "updated", c.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. +func (c *CertificateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC1123(val, "Created", &c.Created) + delete(rawMsg, key) + case "expiry": + err = unpopulateTimeRFC1123(val, "Expiry", &c.Expiry) + delete(rawMsg, key) + case "isVerified": + err = unpopulate(val, "IsVerified", &c.IsVerified) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC1123(val, "Updated", &c.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificatePropertiesWithNonce. +func (c CertificatePropertiesWithNonce) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificate", c.Certificate) + populateTimeRFC1123(objectMap, "created", c.Created) + populateTimeRFC1123(objectMap, "expiry", c.Expiry) + populate(objectMap, "isVerified", c.IsVerified) + populate(objectMap, "subject", c.Subject) + populate(objectMap, "thumbprint", c.Thumbprint) + populateTimeRFC1123(objectMap, "updated", c.Updated) + populate(objectMap, "verificationCode", c.VerificationCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificatePropertiesWithNonce. +func (c *CertificatePropertiesWithNonce) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC1123(val, "Created", &c.Created) + delete(rawMsg, key) + case "expiry": + err = unpopulateTimeRFC1123(val, "Expiry", &c.Expiry) + delete(rawMsg, key) + case "isVerified": + err = unpopulate(val, "IsVerified", &c.IsVerified) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC1123(val, "Updated", &c.Updated) + delete(rawMsg, key) + case "verificationCode": + err = unpopulate(val, "VerificationCode", &c.VerificationCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateVerificationDescription. +func (c CertificateVerificationDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificate", c.Certificate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateVerificationDescription. +func (c *CertificateVerificationDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateWithNonceDescription. +func (c CertificateWithNonceDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateWithNonceDescription. +func (c *CertificateWithNonceDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudToDeviceProperties. +func (c CloudToDeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultTtlAsIso8601", c.DefaultTTLAsIso8601) + populate(objectMap, "feedback", c.Feedback) + populate(objectMap, "maxDeliveryCount", c.MaxDeliveryCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudToDeviceProperties. +func (c *CloudToDeviceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultTtlAsIso8601": + err = unpopulate(val, "DefaultTTLAsIso8601", &c.DefaultTTLAsIso8601) + delete(rawMsg, key) + case "feedback": + err = unpopulate(val, "Feedback", &c.Feedback) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &c.MaxDeliveryCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Description. +func (d Description) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Description. +func (d *Description) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DescriptionListResult. +func (d DescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DescriptionListResult. +func (d *DescriptionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointHealthData. +func (e EndpointHealthData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpointId", e.EndpointID) + populate(objectMap, "healthStatus", e.HealthStatus) + populate(objectMap, "lastKnownError", e.LastKnownError) + populateTimeRFC1123(objectMap, "lastKnownErrorTime", e.LastKnownErrorTime) + populateTimeRFC1123(objectMap, "lastSendAttemptTime", e.LastSendAttemptTime) + populateTimeRFC1123(objectMap, "lastSuccessfulSendAttemptTime", e.LastSuccessfulSendAttemptTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointHealthData. +func (e *EndpointHealthData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpointId": + err = unpopulate(val, "EndpointID", &e.EndpointID) + delete(rawMsg, key) + case "healthStatus": + err = unpopulate(val, "HealthStatus", &e.HealthStatus) + delete(rawMsg, key) + case "lastKnownError": + err = unpopulate(val, "LastKnownError", &e.LastKnownError) + delete(rawMsg, key) + case "lastKnownErrorTime": + err = unpopulateTimeRFC1123(val, "LastKnownErrorTime", &e.LastKnownErrorTime) + delete(rawMsg, key) + case "lastSendAttemptTime": + err = unpopulateTimeRFC1123(val, "LastSendAttemptTime", &e.LastSendAttemptTime) + delete(rawMsg, key) + case "lastSuccessfulSendAttemptTime": + err = unpopulateTimeRFC1123(val, "LastSuccessfulSendAttemptTime", &e.LastSuccessfulSendAttemptTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointHealthDataListResult. +func (e EndpointHealthDataListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointHealthDataListResult. +func (e *EndpointHealthDataListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentProperties. +func (e EnrichmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpointNames", e.EndpointNames) + populate(objectMap, "key", e.Key) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentProperties. +func (e *EnrichmentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpointNames": + err = unpopulate(val, "EndpointNames", &e.EndpointNames) + delete(rawMsg, key) + case "key": + err = unpopulate(val, "Key", &e.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "httpStatusCode", e.HTTPStatusCode) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "httpStatusCode": + err = unpopulate(val, "HTTPStatusCode", &e.HTTPStatusCode) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConsumerGroupBodyDescription. +func (e EventHubConsumerGroupBodyDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupBodyDescription. +func (e *EventHubConsumerGroupBodyDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConsumerGroupInfo. +func (e EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupInfo. +func (e *EventHubConsumerGroupInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConsumerGroupName. +func (e EventHubConsumerGroupName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupName. +func (e *EventHubConsumerGroupName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConsumerGroupsListResult. +func (e EventHubConsumerGroupsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupsListResult. +func (e *EventHubConsumerGroupsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubProperties. +func (e EventHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoint", e.Endpoint) + populate(objectMap, "partitionCount", e.PartitionCount) + populate(objectMap, "partitionIds", e.PartitionIDs) + populate(objectMap, "path", e.Path) + populate(objectMap, "retentionTimeInDays", e.RetentionTimeInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubProperties. +func (e *EventHubProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &e.Endpoint) + delete(rawMsg, key) + case "partitionCount": + err = unpopulate(val, "PartitionCount", &e.PartitionCount) + delete(rawMsg, key) + case "partitionIds": + err = unpopulate(val, "PartitionIDs", &e.PartitionIDs) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &e.Path) + delete(rawMsg, key) + case "retentionTimeInDays": + err = unpopulate(val, "RetentionTimeInDays", &e.RetentionTimeInDays) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportDevicesRequest. +func (e ExportDevicesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", e.AuthenticationType) + populate(objectMap, "configurationsBlobName", e.ConfigurationsBlobName) + populate(objectMap, "excludeKeys", e.ExcludeKeys) + populate(objectMap, "exportBlobContainerUri", e.ExportBlobContainerURI) + populate(objectMap, "exportBlobName", e.ExportBlobName) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "includeConfigurations", e.IncludeConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDevicesRequest. +func (e *ExportDevicesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &e.AuthenticationType) + delete(rawMsg, key) + case "configurationsBlobName": + err = unpopulate(val, "ConfigurationsBlobName", &e.ConfigurationsBlobName) + delete(rawMsg, key) + case "excludeKeys": + err = unpopulate(val, "ExcludeKeys", &e.ExcludeKeys) + delete(rawMsg, key) + case "exportBlobContainerUri": + err = unpopulate(val, "ExportBlobContainerURI", &e.ExportBlobContainerURI) + delete(rawMsg, key) + case "exportBlobName": + err = unpopulate(val, "ExportBlobName", &e.ExportBlobName) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "includeConfigurations": + err = unpopulate(val, "IncludeConfigurations", &e.IncludeConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FailoverInput. +func (f FailoverInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "failoverRegion", f.FailoverRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverInput. +func (f *FailoverInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "failoverRegion": + err = unpopulate(val, "FailoverRegion", &f.FailoverRegion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FallbackRouteProperties. +func (f FallbackRouteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "condition", f.Condition) + populate(objectMap, "endpointNames", f.EndpointNames) + populate(objectMap, "isEnabled", f.IsEnabled) + populate(objectMap, "name", f.Name) + populate(objectMap, "source", f.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FallbackRouteProperties. +func (f *FallbackRouteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "condition": + err = unpopulate(val, "Condition", &f.Condition) + delete(rawMsg, key) + case "endpointNames": + err = unpopulate(val, "EndpointNames", &f.EndpointNames) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &f.IsEnabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &f.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FeedbackProperties. +func (f FeedbackProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lockDurationAsIso8601", f.LockDurationAsIso8601) + populate(objectMap, "maxDeliveryCount", f.MaxDeliveryCount) + populate(objectMap, "ttlAsIso8601", f.TTLAsIso8601) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeedbackProperties. +func (f *FeedbackProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lockDurationAsIso8601": + err = unpopulate(val, "LockDurationAsIso8601", &f.LockDurationAsIso8601) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &f.MaxDeliveryCount) + delete(rawMsg, key) + case "ttlAsIso8601": + err = unpopulate(val, "TTLAsIso8601", &f.TTLAsIso8601) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupIDInformation. +func (g GroupIDInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupIDInformation. +func (g *GroupIDInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupIDInformationProperties. +func (g GroupIDInformationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "requiredMembers", g.RequiredMembers) + populate(objectMap, "requiredZoneNames", g.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupIDInformationProperties. +func (g *GroupIDInformationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &g.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &g.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &g.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPFilterRule. +func (i IPFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", i.Action) + populate(objectMap, "filterName", i.FilterName) + populate(objectMap, "ipMask", i.IPMask) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPFilterRule. +func (i *IPFilterRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "filterName": + err = unpopulate(val, "FilterName", &i.FilterName) + delete(rawMsg, key) + case "ipMask": + err = unpopulate(val, "IPMask", &i.IPMask) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportDevicesRequest. +func (i ImportDevicesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", i.AuthenticationType) + populate(objectMap, "configurationsBlobName", i.ConfigurationsBlobName) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "includeConfigurations", i.IncludeConfigurations) + populate(objectMap, "inputBlobContainerUri", i.InputBlobContainerURI) + populate(objectMap, "inputBlobName", i.InputBlobName) + populate(objectMap, "outputBlobContainerUri", i.OutputBlobContainerURI) + populate(objectMap, "outputBlobName", i.OutputBlobName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportDevicesRequest. +func (i *ImportDevicesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &i.AuthenticationType) + delete(rawMsg, key) + case "configurationsBlobName": + err = unpopulate(val, "ConfigurationsBlobName", &i.ConfigurationsBlobName) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &i.Identity) + delete(rawMsg, key) + case "includeConfigurations": + err = unpopulate(val, "IncludeConfigurations", &i.IncludeConfigurations) + delete(rawMsg, key) + case "inputBlobContainerUri": + err = unpopulate(val, "InputBlobContainerURI", &i.InputBlobContainerURI) + delete(rawMsg, key) + case "inputBlobName": + err = unpopulate(val, "InputBlobName", &i.InputBlobName) + delete(rawMsg, key) + case "outputBlobContainerUri": + err = unpopulate(val, "OutputBlobContainerURI", &i.OutputBlobContainerURI) + delete(rawMsg, key) + case "outputBlobName": + err = unpopulate(val, "OutputBlobName", &i.OutputBlobName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobResponse. +func (j JobResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC1123(objectMap, "endTimeUtc", j.EndTimeUTC) + populate(objectMap, "failureReason", j.FailureReason) + populate(objectMap, "jobId", j.JobID) + populate(objectMap, "parentJobId", j.ParentJobID) + populateTimeRFC1123(objectMap, "startTimeUtc", j.StartTimeUTC) + populate(objectMap, "status", j.Status) + populate(objectMap, "statusMessage", j.StatusMessage) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResponse. +func (j *JobResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeUtc": + err = unpopulateTimeRFC1123(val, "EndTimeUTC", &j.EndTimeUTC) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, "FailureReason", &j.FailureReason) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &j.JobID) + delete(rawMsg, key) + case "parentJobId": + err = unpopulate(val, "ParentJobID", &j.ParentJobID) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC1123(val, "StartTimeUTC", &j.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + case "statusMessage": + err = unpopulate(val, "StatusMessage", &j.StatusMessage) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobResponseListResult. +func (j JobResponseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResponseListResult. +func (j *JobResponseListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationDescription. +func (l LocationDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", l.Location) + populate(objectMap, "role", l.Role) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationDescription. +func (l *LocationDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &l.Role) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentity. +func (m ManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "userAssignedIdentity", m.UserAssignedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentity. +func (m *ManagedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "userAssignedIdentity": + err = unpopulate(val, "UserAssignedIdentity", &m.UserAssignedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MatchedRoute. +func (m MatchedRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchedRoute. +func (m *MatchedRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MessagingEndpointProperties. +func (m MessagingEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lockDurationAsIso8601", m.LockDurationAsIso8601) + populate(objectMap, "maxDeliveryCount", m.MaxDeliveryCount) + populate(objectMap, "ttlAsIso8601", m.TTLAsIso8601) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MessagingEndpointProperties. +func (m *MessagingEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lockDurationAsIso8601": + err = unpopulate(val, "LockDurationAsIso8601", &m.LockDurationAsIso8601) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &m.MaxDeliveryCount) + delete(rawMsg, key) + case "ttlAsIso8601": + err = unpopulate(val, "TTLAsIso8601", &m.TTLAsIso8601) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Name. +func (n Name) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", n.LocalizedValue) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Name. +func (n *Name) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &n.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NameAvailabilityInfo. +func (n NameAvailabilityInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", n.Message) + populate(objectMap, "nameAvailable", n.NameAvailable) + populate(objectMap, "reason", n.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityInfo. +func (n *NameAvailabilityInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &n.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &n.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &n.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSetIPRule. +func (n NetworkRuleSetIPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", n.Action) + populate(objectMap, "filterName", n.FilterName) + populate(objectMap, "ipMask", n.IPMask) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSetIPRule. +func (n *NetworkRuleSetIPRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &n.Action) + delete(rawMsg, key) + case "filterName": + err = unpopulate(val, "FilterName", &n.FilterName) + delete(rawMsg, key) + case "ipMask": + err = unpopulate(val, "IPMask", &n.IPMask) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSetProperties. +func (n NetworkRuleSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applyToBuiltInEventHubEndpoint", n.ApplyToBuiltInEventHubEndpoint) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSetProperties. +func (n *NetworkRuleSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applyToBuiltInEventHubEndpoint": + err = unpopulate(val, "ApplyToBuiltInEventHubEndpoint", &n.ApplyToBuiltInEventHubEndpoint) + delete(rawMsg, key) + case "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationInputs. +func (o OperationInputs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationInputs. +func (o *OperationInputs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResources. +func (p PrivateLinkResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResources. +func (p *PrivateLinkResources) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedFqdnList", p.AllowedFqdnList) + populate(objectMap, "authorizationPolicies", p.AuthorizationPolicies) + populate(objectMap, "cloudToDevice", p.CloudToDevice) + populate(objectMap, "comments", p.Comments) + populate(objectMap, "disableDeviceSAS", p.DisableDeviceSAS) + populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) + populate(objectMap, "disableModuleSAS", p.DisableModuleSAS) + populate(objectMap, "enableDataResidency", p.EnableDataResidency) + populate(objectMap, "enableFileUploadNotifications", p.EnableFileUploadNotifications) + populate(objectMap, "eventHubEndpoints", p.EventHubEndpoints) + populate(objectMap, "features", p.Features) + populate(objectMap, "hostName", p.HostName) + populate(objectMap, "ipFilterRules", p.IPFilterRules) + populate(objectMap, "locations", p.Locations) + populate(objectMap, "messagingEndpoints", p.MessagingEndpoints) + populate(objectMap, "minTlsVersion", p.MinTLSVersion) + populate(objectMap, "networkRuleSets", p.NetworkRuleSets) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "restrictOutboundNetworkAccess", p.RestrictOutboundNetworkAccess) + populate(objectMap, "routing", p.Routing) + populate(objectMap, "state", p.State) + populate(objectMap, "storageEndpoints", p.StorageEndpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedFqdnList": + err = unpopulate(val, "AllowedFqdnList", &p.AllowedFqdnList) + delete(rawMsg, key) + case "authorizationPolicies": + err = unpopulate(val, "AuthorizationPolicies", &p.AuthorizationPolicies) + delete(rawMsg, key) + case "cloudToDevice": + err = unpopulate(val, "CloudToDevice", &p.CloudToDevice) + delete(rawMsg, key) + case "comments": + err = unpopulate(val, "Comments", &p.Comments) + delete(rawMsg, key) + case "disableDeviceSAS": + err = unpopulate(val, "DisableDeviceSAS", &p.DisableDeviceSAS) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &p.DisableLocalAuth) + delete(rawMsg, key) + case "disableModuleSAS": + err = unpopulate(val, "DisableModuleSAS", &p.DisableModuleSAS) + delete(rawMsg, key) + case "enableDataResidency": + err = unpopulate(val, "EnableDataResidency", &p.EnableDataResidency) + delete(rawMsg, key) + case "enableFileUploadNotifications": + err = unpopulate(val, "EnableFileUploadNotifications", &p.EnableFileUploadNotifications) + delete(rawMsg, key) + case "eventHubEndpoints": + err = unpopulate(val, "EventHubEndpoints", &p.EventHubEndpoints) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &p.Features) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &p.HostName) + delete(rawMsg, key) + case "ipFilterRules": + err = unpopulate(val, "IPFilterRules", &p.IPFilterRules) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &p.Locations) + delete(rawMsg, key) + case "messagingEndpoints": + err = unpopulate(val, "MessagingEndpoints", &p.MessagingEndpoints) + delete(rawMsg, key) + case "minTlsVersion": + err = unpopulate(val, "MinTLSVersion", &p.MinTLSVersion) + delete(rawMsg, key) + case "networkRuleSets": + err = unpopulate(val, "NetworkRuleSets", &p.NetworkRuleSets) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + delete(rawMsg, key) + case "restrictOutboundNetworkAccess": + err = unpopulate(val, "RestrictOutboundNetworkAccess", &p.RestrictOutboundNetworkAccess) + delete(rawMsg, key) + case "routing": + err = unpopulate(val, "Routing", &p.Routing) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "storageEndpoints": + err = unpopulate(val, "StorageEndpoints", &p.StorageEndpoints) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaMetricInfo. +func (q QuotaMetricInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) + populate(objectMap, "maxValue", q.MaxValue) + populate(objectMap, "name", q.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaMetricInfo. +func (q *QuotaMetricInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) + case "maxValue": + err = unpopulate(val, "MaxValue", &q.MaxValue) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaMetricInfoListResult. +func (q QuotaMetricInfoListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaMetricInfoListResult. +func (q *QuotaMetricInfoListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryStatistics. +func (r RegistryStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disabledDeviceCount", r.DisabledDeviceCount) + populate(objectMap, "enabledDeviceCount", r.EnabledDeviceCount) + populate(objectMap, "totalDeviceCount", r.TotalDeviceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryStatistics. +func (r *RegistryStatistics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disabledDeviceCount": + err = unpopulate(val, "DisabledDeviceCount", &r.DisabledDeviceCount) + delete(rawMsg, key) + case "enabledDeviceCount": + err = unpopulate(val, "EnabledDeviceCount", &r.EnabledDeviceCount) + delete(rawMsg, key) + case "totalDeviceCount": + err = unpopulate(val, "TotalDeviceCount", &r.TotalDeviceCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteCompilationError. +func (r RouteCompilationError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", r.Location) + populate(objectMap, "message", r.Message) + populate(objectMap, "severity", r.Severity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteCompilationError. +func (r *RouteCompilationError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &r.Severity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteErrorPosition. +func (r RouteErrorPosition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "column", r.Column) + populate(objectMap, "line", r.Line) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteErrorPosition. +func (r *RouteErrorPosition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "column": + err = unpopulate(val, "Column", &r.Column) + delete(rawMsg, key) + case "line": + err = unpopulate(val, "Line", &r.Line) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteErrorRange. +func (r RouteErrorRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "end", r.End) + populate(objectMap, "start", r.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteErrorRange. +func (r *RouteErrorRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "end": + err = unpopulate(val, "End", &r.End) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &r.Start) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteProperties. +func (r RouteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "endpointNames", r.EndpointNames) + populate(objectMap, "isEnabled", r.IsEnabled) + populate(objectMap, "name", r.Name) + populate(objectMap, "source", r.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteProperties. +func (r *RouteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "endpointNames": + err = unpopulate(val, "EndpointNames", &r.EndpointNames) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &r.IsEnabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &r.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingEndpoints. +func (r RoutingEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventHubs", r.EventHubs) + populate(objectMap, "serviceBusQueues", r.ServiceBusQueues) + populate(objectMap, "serviceBusTopics", r.ServiceBusTopics) + populate(objectMap, "storageContainers", r.StorageContainers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingEndpoints. +func (r *RoutingEndpoints) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventHubs": + err = unpopulate(val, "EventHubs", &r.EventHubs) + delete(rawMsg, key) + case "serviceBusQueues": + err = unpopulate(val, "ServiceBusQueues", &r.ServiceBusQueues) + delete(rawMsg, key) + case "serviceBusTopics": + err = unpopulate(val, "ServiceBusTopics", &r.ServiceBusTopics) + delete(rawMsg, key) + case "storageContainers": + err = unpopulate(val, "StorageContainers", &r.StorageContainers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingEventHubProperties. +func (r RoutingEventHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "entityPath", r.EntityPath) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingEventHubProperties. +func (r *RoutingEventHubProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &r.EntityPath) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingMessage. +func (r RoutingMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appProperties", r.AppProperties) + populate(objectMap, "body", r.Body) + populate(objectMap, "systemProperties", r.SystemProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingMessage. +func (r *RoutingMessage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appProperties": + err = unpopulate(val, "AppProperties", &r.AppProperties) + delete(rawMsg, key) + case "body": + err = unpopulate(val, "Body", &r.Body) + delete(rawMsg, key) + case "systemProperties": + err = unpopulate(val, "SystemProperties", &r.SystemProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingProperties. +func (r RoutingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoints", r.Endpoints) + populate(objectMap, "enrichments", r.Enrichments) + populate(objectMap, "fallbackRoute", r.FallbackRoute) + populate(objectMap, "routes", r.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingProperties. +func (r *RoutingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoints": + err = unpopulate(val, "Endpoints", &r.Endpoints) + delete(rawMsg, key) + case "enrichments": + err = unpopulate(val, "Enrichments", &r.Enrichments) + delete(rawMsg, key) + case "fallbackRoute": + err = unpopulate(val, "FallbackRoute", &r.FallbackRoute) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &r.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingServiceBusQueueEndpointProperties. +func (r RoutingServiceBusQueueEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "entityPath", r.EntityPath) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingServiceBusQueueEndpointProperties. +func (r *RoutingServiceBusQueueEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &r.EntityPath) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingServiceBusTopicEndpointProperties. +func (r RoutingServiceBusTopicEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "entityPath", r.EntityPath) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingServiceBusTopicEndpointProperties. +func (r *RoutingServiceBusTopicEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &r.EntityPath) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingStorageContainerProperties. +func (r RoutingStorageContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "batchFrequencyInSeconds", r.BatchFrequencyInSeconds) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "containerName", r.ContainerName) + populate(objectMap, "encoding", r.Encoding) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "fileNameFormat", r.FileNameFormat) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "maxChunkSizeInBytes", r.MaxChunkSizeInBytes) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingStorageContainerProperties. +func (r *RoutingStorageContainerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "batchFrequencyInSeconds": + err = unpopulate(val, "BatchFrequencyInSeconds", &r.BatchFrequencyInSeconds) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &r.ContainerName) + delete(rawMsg, key) + case "encoding": + err = unpopulate(val, "Encoding", &r.Encoding) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "fileNameFormat": + err = unpopulate(val, "FileNameFormat", &r.FileNameFormat) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "maxChunkSizeInBytes": + err = unpopulate(val, "MaxChunkSizeInBytes", &r.MaxChunkSizeInBytes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingTwin. +func (r RoutingTwin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", r.Properties) + populateAny(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingTwin. +func (r *RoutingTwin) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingTwinProperties. +func (r RoutingTwinProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "desired", r.Desired) + populateAny(objectMap, "reported", r.Reported) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingTwinProperties. +func (r *RoutingTwinProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "desired": + err = unpopulate(val, "Desired", &r.Desired) + delete(rawMsg, key) + case "reported": + err = unpopulate(val, "Reported", &r.Reported) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUDescription. +func (s SKUDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "sku", s.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDescription. +func (s *SKUDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUDescriptionListResult. +func (s SKUDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDescriptionListResult. +func (s *SKUDescriptionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUInfo. +func (s SKUInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "name", s.Name) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUInfo. +func (s *SKUInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedAccessSignatureAuthorizationRule. +func (s SharedAccessSignatureAuthorizationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyName", s.KeyName) + populate(objectMap, "primaryKey", s.PrimaryKey) + populate(objectMap, "rights", s.Rights) + populate(objectMap, "secondaryKey", s.SecondaryKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedAccessSignatureAuthorizationRule. +func (s *SharedAccessSignatureAuthorizationRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyName": + err = unpopulate(val, "KeyName", &s.KeyName) + delete(rawMsg, key) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) + delete(rawMsg, key) + case "rights": + err = unpopulate(val, "Rights", &s.Rights) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedAccessSignatureAuthorizationRuleListResult. +func (s SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedAccessSignatureAuthorizationRuleListResult. +func (s *SharedAccessSignatureAuthorizationRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageEndpointProperties. +func (s StorageEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", s.AuthenticationType) + populate(objectMap, "connectionString", s.ConnectionString) + populate(objectMap, "containerName", s.ContainerName) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "sasTtlAsIso8601", s.SasTTLAsIso8601) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageEndpointProperties. +func (s *StorageEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &s.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &s.ConnectionString) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &s.ContainerName) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "sasTtlAsIso8601": + err = unpopulate(val, "SasTTLAsIso8601", &s.SasTTLAsIso8601) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestAllRoutesInput. +func (t TestAllRoutesInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", t.Message) + populate(objectMap, "routingSource", t.RoutingSource) + populate(objectMap, "twin", t.Twin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestAllRoutesInput. +func (t *TestAllRoutesInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &t.Message) + delete(rawMsg, key) + case "routingSource": + err = unpopulate(val, "RoutingSource", &t.RoutingSource) + delete(rawMsg, key) + case "twin": + err = unpopulate(val, "Twin", &t.Twin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestAllRoutesResult. +func (t TestAllRoutesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "routes", t.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestAllRoutesResult. +func (t *TestAllRoutesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "routes": + err = unpopulate(val, "Routes", &t.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestRouteInput. +func (t TestRouteInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", t.Message) + populate(objectMap, "route", t.Route) + populate(objectMap, "twin", t.Twin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestRouteInput. +func (t *TestRouteInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &t.Message) + delete(rawMsg, key) + case "route": + err = unpopulate(val, "Route", &t.Route) + delete(rawMsg, key) + case "twin": + err = unpopulate(val, "Twin", &t.Twin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestRouteResult. +func (t TestRouteResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "details", t.Details) + populate(objectMap, "result", t.Result) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestRouteResult. +func (t *TestRouteResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "details": + err = unpopulate(val, "Details", &t.Details) + delete(rawMsg, key) + case "result": + err = unpopulate(val, "Result", &t.Result) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestRouteResultDetails. +func (t TestRouteResultDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "compilationErrors", t.CompilationErrors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestRouteResultDetails. +func (t *TestRouteResultDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "compilationErrors": + err = unpopulate(val, "CompilationErrors", &t.CompilationErrors) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserSubscriptionQuota. +func (u UserSubscriptionQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "id", u.ID) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + populate(objectMap, "type", u.Type) + populate(objectMap, "unit", u.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserSubscriptionQuota. +func (u *UserSubscriptionQuota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserSubscriptionQuotaListResult. +func (u UserSubscriptionQuotaListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserSubscriptionQuotaListResult. +func (u *UserSubscriptionQuotaListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/operations_client.go new file mode 100644 index 00000000..1f784327 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/operations_client.go @@ -0,0 +1,94 @@ +//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 + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available IoT Hub REST API operations. +// +// Generated from API version 2021-07-02 +// - 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]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Devices/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go new file mode 100644 index 00000000..6971577f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go @@ -0,0 +1,307 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete private endpoint connection with the specified name +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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 - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete private endpoint connection with the specified name +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get private endpoint connection properties +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// List - List private endpoint connection properties +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionArray); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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 +// - privateEndpointConnection - The private endpoint connection with updated properties +// - options - PrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdate +// method. +func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[PrivateEndpointConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 2021-07-02 +func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, privateEndpointConnection) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go new file mode 100644 index 00000000..4e1db9ec --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go @@ -0,0 +1,166 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 2021-07-02 +// - 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupID, options) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupID string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { + result := PrivateLinkResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GroupIDInformation); err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + return result, nil +} + +// List - List private link resources for the given IotHub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { + result := PrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResources); err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resource_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resource_client.go new file mode 100644 index 00000000..16fbac7f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resource_client.go @@ -0,0 +1,1516 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResourceClient contains the methods for the IotHubResource group. +// Don't use this type directly, use NewResourceClient() instead. +type ResourceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewResourceClient creates a new instance of ResourceClient with the specified values. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceClient, error) { + cl, err := arm.NewClient(moduleName+".ResourceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Check if an IoT hub name is available. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, operationInputs, options) + if err != nil { + return ResourceClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *ResourceClient) checkNameAvailabilityCreateRequest(ctx context.Context, operationInputs OperationInputs, options *ResourceClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, operationInputs) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ResourceClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ResourceClientCheckNameAvailabilityResponse, error) { + result := ResourceClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailabilityInfo); err != nil { + return ResourceClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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. +// - name - The name of the consumer group to add. +// - consumerGroupBody - The consumer group to add. +// - 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) { + req, err := client.createEventHubConsumerGroupCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody, options) + if err != nil { + return ResourceClientCreateEventHubConsumerGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientCreateEventHubConsumerGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientCreateEventHubConsumerGroupResponse{}, runtime.NewResponseError(resp) + } + return client.createEventHubConsumerGroupHandleResponse(resp) +} + +// createEventHubConsumerGroupCreateRequest creates the CreateEventHubConsumerGroup request. +func (client *ResourceClient) createEventHubConsumerGroupCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, consumerGroupBody EventHubConsumerGroupBodyDescription, options *ResourceClientCreateEventHubConsumerGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if eventHubEndpointName == "" { + return nil, errors.New("parameter eventHubEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventHubEndpointName}", url.PathEscape(eventHubEndpointName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, consumerGroupBody) +} + +// createEventHubConsumerGroupHandleResponse handles the CreateEventHubConsumerGroup response. +func (client *ResourceClient) createEventHubConsumerGroupHandleResponse(resp *http.Response) (ResourceClientCreateEventHubConsumerGroupResponse, error) { + result := ResourceClientCreateEventHubConsumerGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupInfo); err != nil { + return ResourceClientCreateEventHubConsumerGroupResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve +// the IoT hub metadata and security metadata, and then combine them with the modified values in a new +// body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback +// to default, which may lead to unexpected behavior. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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. +// - options - ResourceClientBeginCreateOrUpdateOptions contains the optional parameters for the ResourceClient.BeginCreateOrUpdate +// method. +func (client *ResourceClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription Description, options *ResourceClientBeginCreateOrUpdateOptions) (*runtime.Poller[ResourceClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, iotHubDescription, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ResourceClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[ResourceClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the +// IoT hub metadata and security metadata, and then combine them with the modified values in a new +// body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback +// to default, which may lead to unexpected behavior. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +func (client *ResourceClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription Description, options *ResourceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, iotHubDescription, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ResourceClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription Description, options *ResourceClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + 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) +} + +// BeginDelete - Delete an IoT hub. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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. +func (client *ResourceClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientBeginDeleteOptions) (*runtime.Poller[ResourceClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ResourceClientDeleteResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[ResourceClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete an IoT hub. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +func (client *ResourceClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ResourceClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 2021-07-02 +// - 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. +// - name - The name of the consumer group to delete. +// - 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) { + req, err := client.deleteEventHubConsumerGroupCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, options) + if err != nil { + return ResourceClientDeleteEventHubConsumerGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientDeleteEventHubConsumerGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientDeleteEventHubConsumerGroupResponse{}, runtime.NewResponseError(resp) + } + return ResourceClientDeleteEventHubConsumerGroupResponse{}, nil +} + +// deleteEventHubConsumerGroupCreateRequest creates the DeleteEventHubConsumerGroup request. +func (client *ResourceClient) deleteEventHubConsumerGroupCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, options *ResourceClientDeleteEventHubConsumerGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if eventHubEndpointName == "" { + return nil, errors.New("parameter eventHubEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventHubEndpointName}", url.PathEscape(eventHubEndpointName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ExportDevices - Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. +// For more information, see: +// 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 2021-07-02 +// - 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) { + req, err := client.exportDevicesCreateRequest(ctx, resourceGroupName, resourceName, exportDevicesParameters, options) + if err != nil { + return ResourceClientExportDevicesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientExportDevicesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientExportDevicesResponse{}, runtime.NewResponseError(resp) + } + return client.exportDevicesHandleResponse(resp) +} + +// exportDevicesCreateRequest creates the ExportDevices request. +func (client *ResourceClient) exportDevicesCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest, options *ResourceClientExportDevicesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, exportDevicesParameters) +} + +// exportDevicesHandleResponse handles the ExportDevices response. +func (client *ResourceClient) exportDevicesHandleResponse(resp *http.Response) (ResourceClientExportDevicesResponse, error) { + result := ResourceClientExportDevicesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobResponse); err != nil { + return ResourceClientExportDevicesResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ResourceClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ResourceClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ResourceClient) getHandleResponse(resp *http.Response) (ResourceClientGetResponse, error) { + result := ResourceClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Description); err != nil { + return ResourceClientGetResponse{}, err + } + return result, nil +} + +// NewGetEndpointHealthPager - Get the health for routing endpoints. +// +// Generated from API version 2021-07-02 +// - options - ResourceClientGetEndpointHealthOptions contains the optional parameters for the ResourceClient.NewGetEndpointHealthPager +// method. +func (client *ResourceClient) NewGetEndpointHealthPager(resourceGroupName string, iotHubName string, options *ResourceClientGetEndpointHealthOptions) *runtime.Pager[ResourceClientGetEndpointHealthResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientGetEndpointHealthResponse]{ + More: func(page ResourceClientGetEndpointHealthResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientGetEndpointHealthResponse) (ResourceClientGetEndpointHealthResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getEndpointHealthCreateRequest(ctx, resourceGroupName, iotHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientGetEndpointHealthResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetEndpointHealthResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetEndpointHealthResponse{}, runtime.NewResponseError(resp) + } + return client.getEndpointHealthHandleResponse(resp) + }, + }) +} + +// getEndpointHealthCreateRequest creates the GetEndpointHealth request. +func (client *ResourceClient) getEndpointHealthCreateRequest(ctx context.Context, resourceGroupName string, iotHubName string, options *ResourceClientGetEndpointHealthOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if iotHubName == "" { + return nil, errors.New("parameter iotHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotHubName}", url.PathEscape(iotHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEndpointHealthHandleResponse handles the GetEndpointHealth response. +func (client *ResourceClient) getEndpointHealthHandleResponse(resp *http.Response) (ResourceClientGetEndpointHealthResponse, error) { + result := ResourceClientGetEndpointHealthResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EndpointHealthDataListResult); err != nil { + return ResourceClientGetEndpointHealthResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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. +// - name - The name of the consumer group to retrieve. +// - 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) { + req, err := client.getEventHubConsumerGroupCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, name, options) + if err != nil { + return ResourceClientGetEventHubConsumerGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetEventHubConsumerGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetEventHubConsumerGroupResponse{}, runtime.NewResponseError(resp) + } + return client.getEventHubConsumerGroupHandleResponse(resp) +} + +// getEventHubConsumerGroupCreateRequest creates the GetEventHubConsumerGroup request. +func (client *ResourceClient) getEventHubConsumerGroupCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, name string, options *ResourceClientGetEventHubConsumerGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if eventHubEndpointName == "" { + return nil, errors.New("parameter eventHubEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventHubEndpointName}", url.PathEscape(eventHubEndpointName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getEventHubConsumerGroupHandleResponse handles the GetEventHubConsumerGroup response. +func (client *ResourceClient) getEventHubConsumerGroupHandleResponse(resp *http.Response) (ResourceClientGetEventHubConsumerGroupResponse, error) { + result := ResourceClientGetEventHubConsumerGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupInfo); err != nil { + return ResourceClientGetEventHubConsumerGroupResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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) { + req, err := client.getJobCreateRequest(ctx, resourceGroupName, resourceName, jobID, options) + if err != nil { + return ResourceClientGetJobResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetJobResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetJobResponse{}, runtime.NewResponseError(resp) + } + return client.getJobHandleResponse(resp) +} + +// getJobCreateRequest creates the GetJob request. +func (client *ResourceClient) getJobCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, jobID string, options *ResourceClientGetJobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if jobID == "" { + return nil, errors.New("parameter jobID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobId}", url.PathEscape(jobID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getJobHandleResponse handles the GetJob response. +func (client *ResourceClient) getJobHandleResponse(resp *http.Response) (ResourceClientGetJobResponse, error) { + result := ResourceClientGetJobResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobResponse); err != nil { + return ResourceClientGetJobResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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) { + req, err := client.getKeysForKeyNameCreateRequest(ctx, resourceGroupName, resourceName, keyName, options) + if err != nil { + return ResourceClientGetKeysForKeyNameResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetKeysForKeyNameResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetKeysForKeyNameResponse{}, runtime.NewResponseError(resp) + } + return client.getKeysForKeyNameHandleResponse(resp) +} + +// getKeysForKeyNameCreateRequest creates the GetKeysForKeyName request. +func (client *ResourceClient) getKeysForKeyNameCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, keyName string, options *ResourceClientGetKeysForKeyNameOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if keyName == "" { + return nil, errors.New("parameter keyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyName}", url.PathEscape(keyName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getKeysForKeyNameHandleResponse handles the GetKeysForKeyName response. +func (client *ResourceClient) getKeysForKeyNameHandleResponse(resp *http.Response) (ResourceClientGetKeysForKeyNameResponse, error) { + result := ResourceClientGetKeysForKeyNameResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessSignatureAuthorizationRule); err != nil { + return ResourceClientGetKeysForKeyNameResponse{}, err + } + return result, nil +} + +// NewGetQuotaMetricsPager - Get the quota metrics for an IoT hub. +// +// Generated from API version 2021-07-02 +// - 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 +// method. +func (client *ResourceClient) NewGetQuotaMetricsPager(resourceGroupName string, resourceName string, options *ResourceClientGetQuotaMetricsOptions) *runtime.Pager[ResourceClientGetQuotaMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientGetQuotaMetricsResponse]{ + More: func(page ResourceClientGetQuotaMetricsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientGetQuotaMetricsResponse) (ResourceClientGetQuotaMetricsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getQuotaMetricsCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientGetQuotaMetricsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetQuotaMetricsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetQuotaMetricsResponse{}, runtime.NewResponseError(resp) + } + return client.getQuotaMetricsHandleResponse(resp) + }, + }) +} + +// getQuotaMetricsCreateRequest creates the GetQuotaMetrics request. +func (client *ResourceClient) getQuotaMetricsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientGetQuotaMetricsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getQuotaMetricsHandleResponse handles the GetQuotaMetrics response. +func (client *ResourceClient) getQuotaMetricsHandleResponse(resp *http.Response) (ResourceClientGetQuotaMetricsResponse, error) { + result := ResourceClientGetQuotaMetricsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QuotaMetricInfoListResult); err != nil { + return ResourceClientGetQuotaMetricsResponse{}, err + } + return result, nil +} + +// GetStats - Get the statistics from an IoT hub. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.getStatsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ResourceClientGetStatsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetStatsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetStatsResponse{}, runtime.NewResponseError(resp) + } + return client.getStatsHandleResponse(resp) +} + +// getStatsCreateRequest creates the GetStats request. +func (client *ResourceClient) getStatsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientGetStatsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getStatsHandleResponse handles the GetStats response. +func (client *ResourceClient) getStatsHandleResponse(resp *http.Response) (ResourceClientGetStatsResponse, error) { + result := ResourceClientGetStatsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryStatistics); err != nil { + return ResourceClientGetStatsResponse{}, err + } + return result, nil +} + +// NewGetValidSKUsPager - Get the list of valid SKUs for an IoT hub. +// +// Generated from API version 2021-07-02 +// - 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 +// method. +func (client *ResourceClient) NewGetValidSKUsPager(resourceGroupName string, resourceName string, options *ResourceClientGetValidSKUsOptions) *runtime.Pager[ResourceClientGetValidSKUsResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientGetValidSKUsResponse]{ + More: func(page ResourceClientGetValidSKUsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientGetValidSKUsResponse) (ResourceClientGetValidSKUsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getValidSKUsCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientGetValidSKUsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientGetValidSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientGetValidSKUsResponse{}, runtime.NewResponseError(resp) + } + return client.getValidSKUsHandleResponse(resp) + }, + }) +} + +// getValidSKUsCreateRequest creates the GetValidSKUs request. +func (client *ResourceClient) getValidSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientGetValidSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getValidSKUsHandleResponse handles the GetValidSKUs response. +func (client *ResourceClient) getValidSKUsHandleResponse(resp *http.Response) (ResourceClientGetValidSKUsResponse, error) { + result := ResourceClientGetValidSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUDescriptionListResult); err != nil { + return ResourceClientGetValidSKUsResponse{}, err + } + return result, nil +} + +// ImportDevices - Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, +// see: +// 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 2021-07-02 +// - 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) { + req, err := client.importDevicesCreateRequest(ctx, resourceGroupName, resourceName, importDevicesParameters, options) + if err != nil { + return ResourceClientImportDevicesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientImportDevicesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientImportDevicesResponse{}, runtime.NewResponseError(resp) + } + return client.importDevicesHandleResponse(resp) +} + +// importDevicesCreateRequest creates the ImportDevices request. +func (client *ResourceClient) importDevicesCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest, options *ResourceClientImportDevicesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, importDevicesParameters) +} + +// importDevicesHandleResponse handles the ImportDevices response. +func (client *ResourceClient) importDevicesHandleResponse(resp *http.Response) (ResourceClientImportDevicesResponse, error) { + result := ResourceClientImportDevicesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobResponse); err != nil { + return ResourceClientImportDevicesResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all the IoT hubs in a resource group. +// +// Generated from API version 2021-07-02 +// - resourceGroupName - The name of the resource group that contains the IoT hub. +// - options - ResourceClientListByResourceGroupOptions contains the optional parameters for the ResourceClient.NewListByResourceGroupPager +// method. +func (client *ResourceClient) NewListByResourceGroupPager(resourceGroupName string, options *ResourceClientListByResourceGroupOptions) *runtime.Pager[ResourceClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientListByResourceGroupResponse]{ + More: func(page ResourceClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientListByResourceGroupResponse) (ResourceClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ResourceClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ResourceClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ResourceClient) listByResourceGroupHandleResponse(resp *http.Response) (ResourceClientListByResourceGroupResponse, error) { + result := ResourceClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DescriptionListResult); err != nil { + return ResourceClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all the IoT hubs in a subscription. +// +// Generated from API version 2021-07-02 +// - options - ResourceClientListBySubscriptionOptions contains the optional parameters for the ResourceClient.NewListBySubscriptionPager +// method. +func (client *ResourceClient) NewListBySubscriptionPager(options *ResourceClientListBySubscriptionOptions) *runtime.Pager[ResourceClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientListBySubscriptionResponse]{ + More: func(page ResourceClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientListBySubscriptionResponse) (ResourceClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ResourceClient) listBySubscriptionCreateRequest(ctx context.Context, options *ResourceClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ResourceClient) listBySubscriptionHandleResponse(resp *http.Response) (ResourceClientListBySubscriptionResponse, error) { + result := ResourceClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DescriptionListResult); err != nil { + return ResourceClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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. +// - options - ResourceClientListEventHubConsumerGroupsOptions contains the optional parameters for the ResourceClient.NewListEventHubConsumerGroupsPager +// method. +func (client *ResourceClient) NewListEventHubConsumerGroupsPager(resourceGroupName string, resourceName string, eventHubEndpointName string, options *ResourceClientListEventHubConsumerGroupsOptions) *runtime.Pager[ResourceClientListEventHubConsumerGroupsResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientListEventHubConsumerGroupsResponse]{ + More: func(page ResourceClientListEventHubConsumerGroupsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientListEventHubConsumerGroupsResponse) (ResourceClientListEventHubConsumerGroupsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listEventHubConsumerGroupsCreateRequest(ctx, resourceGroupName, resourceName, eventHubEndpointName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientListEventHubConsumerGroupsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientListEventHubConsumerGroupsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientListEventHubConsumerGroupsResponse{}, runtime.NewResponseError(resp) + } + return client.listEventHubConsumerGroupsHandleResponse(resp) + }, + }) +} + +// listEventHubConsumerGroupsCreateRequest creates the ListEventHubConsumerGroups request. +func (client *ResourceClient) listEventHubConsumerGroupsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, eventHubEndpointName string, options *ResourceClientListEventHubConsumerGroupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if eventHubEndpointName == "" { + return nil, errors.New("parameter eventHubEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{eventHubEndpointName}", url.PathEscape(eventHubEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listEventHubConsumerGroupsHandleResponse handles the ListEventHubConsumerGroups response. +func (client *ResourceClient) listEventHubConsumerGroupsHandleResponse(resp *http.Response) (ResourceClientListEventHubConsumerGroupsResponse, error) { + result := ResourceClientListEventHubConsumerGroupsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupsListResult); err != nil { + return ResourceClientListEventHubConsumerGroupsResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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. +func (client *ResourceClient) NewListJobsPager(resourceGroupName string, resourceName string, options *ResourceClientListJobsOptions) *runtime.Pager[ResourceClientListJobsResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientListJobsResponse]{ + More: func(page ResourceClientListJobsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientListJobsResponse) (ResourceClientListJobsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listJobsCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientListJobsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientListJobsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientListJobsResponse{}, runtime.NewResponseError(resp) + } + return client.listJobsHandleResponse(resp) + }, + }) +} + +// listJobsCreateRequest creates the ListJobs request. +func (client *ResourceClient) listJobsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientListJobsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listJobsHandleResponse handles the ListJobs response. +func (client *ResourceClient) listJobsHandleResponse(resp *http.Response) (ResourceClientListJobsResponse, error) { + result := ResourceClientListJobsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobResponseListResult); err != nil { + return ResourceClientListJobsResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - 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. +func (client *ResourceClient) NewListKeysPager(resourceGroupName string, resourceName string, options *ResourceClientListKeysOptions) *runtime.Pager[ResourceClientListKeysResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceClientListKeysResponse]{ + More: func(page ResourceClientListKeysResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceClientListKeysResponse) (ResourceClientListKeysResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listKeysCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceClientListKeysResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientListKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientListKeysResponse{}, runtime.NewResponseError(resp) + } + return client.listKeysHandleResponse(resp) + }, + }) +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *ResourceClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *ResourceClient) listKeysHandleResponse(resp *http.Response) (ResourceClientListKeysResponse, error) { + result := ResourceClientListKeysResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessSignatureAuthorizationRuleListResult); err != nil { + return ResourceClientListKeysResponse{}, err + } + return result, nil +} + +// TestAllRoutes - Test all routes configured in this Iot Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.testAllRoutesCreateRequest(ctx, iotHubName, resourceGroupName, input, options) + if err != nil { + return ResourceClientTestAllRoutesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientTestAllRoutesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientTestAllRoutesResponse{}, runtime.NewResponseError(resp) + } + return client.testAllRoutesHandleResponse(resp) +} + +// testAllRoutesCreateRequest creates the TestAllRoutes request. +func (client *ResourceClient) testAllRoutesCreateRequest(ctx context.Context, iotHubName string, resourceGroupName string, input TestAllRoutesInput, options *ResourceClientTestAllRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall" + if iotHubName == "" { + return nil, errors.New("parameter iotHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotHubName}", url.PathEscape(iotHubName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, input) +} + +// testAllRoutesHandleResponse handles the TestAllRoutes response. +func (client *ResourceClient) testAllRoutesHandleResponse(resp *http.Response) (ResourceClientTestAllRoutesResponse, error) { + result := ResourceClientTestAllRoutesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TestAllRoutesResult); err != nil { + return ResourceClientTestAllRoutesResponse{}, err + } + return result, nil +} + +// TestRoute - Test the new route for this Iot Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-07-02 +// - 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) { + req, err := client.testRouteCreateRequest(ctx, iotHubName, resourceGroupName, input, options) + if err != nil { + return ResourceClientTestRouteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceClientTestRouteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientTestRouteResponse{}, runtime.NewResponseError(resp) + } + return client.testRouteHandleResponse(resp) +} + +// testRouteCreateRequest creates the TestRoute request. +func (client *ResourceClient) testRouteCreateRequest(ctx context.Context, iotHubName string, resourceGroupName string, input TestRouteInput, options *ResourceClientTestRouteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew" + if iotHubName == "" { + return nil, errors.New("parameter iotHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotHubName}", url.PathEscape(iotHubName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, input) +} + +// testRouteHandleResponse handles the TestRoute response. +func (client *ResourceClient) testRouteHandleResponse(resp *http.Response) (ResourceClientTestRouteResponse, error) { + result := ResourceClientTestRouteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TestRouteResult); err != nil { + return ResourceClientTestRouteResponse{}, err + } + return result, nil +} + +// 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 2021-07-02 +// - resourceGroupName - Resource group identifier. +// - resourceName - Name of iot hub to update. +// - iotHubTags - Updated tag information to set into the iot hub instance. +// - options - ResourceClientBeginUpdateOptions contains the optional parameters for the ResourceClient.BeginUpdate method. +func (client *ResourceClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource, options *ResourceClientBeginUpdateOptions) (*runtime.Poller[ResourceClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceName, iotHubTags, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ResourceClientUpdateResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[ResourceClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 2021-07-02 +func (client *ResourceClient) update(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource, options *ResourceClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, iotHubTags, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ResourceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource, options *ResourceClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, iotHubTags) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go new file mode 100644 index 00000000..ece414a5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go @@ -0,0 +1,93 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResourceProviderCommonClient contains the methods for the ResourceProviderCommon group. +// Don't use this type directly, use NewResourceProviderCommonClient() instead. +type ResourceProviderCommonClient struct { + internal *arm.Client + subscriptionID string +} + +// NewResourceProviderCommonClient creates a new instance of ResourceProviderCommonClient with the specified values. +// - subscriptionID - The subscription identifier. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewResourceProviderCommonClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceProviderCommonClient, error) { + cl, err := arm.NewClient(moduleName+".ResourceProviderCommonClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceProviderCommonClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 2021-07-02 +// - options - ResourceProviderCommonClientGetSubscriptionQuotaOptions contains the optional parameters for the ResourceProviderCommonClient.GetSubscriptionQuota +// method. +func (client *ResourceProviderCommonClient) GetSubscriptionQuota(ctx context.Context, options *ResourceProviderCommonClientGetSubscriptionQuotaOptions) (ResourceProviderCommonClientGetSubscriptionQuotaResponse, error) { + req, err := client.getSubscriptionQuotaCreateRequest(ctx, options) + if err != nil { + return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, runtime.NewResponseError(resp) + } + return client.getSubscriptionQuotaHandleResponse(resp) +} + +// getSubscriptionQuotaCreateRequest creates the GetSubscriptionQuota request. +func (client *ResourceProviderCommonClient) getSubscriptionQuotaCreateRequest(ctx context.Context, options *ResourceProviderCommonClientGetSubscriptionQuotaOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getSubscriptionQuotaHandleResponse handles the GetSubscriptionQuota response. +func (client *ResourceProviderCommonClient) getSubscriptionQuotaHandleResponse(resp *http.Response) (ResourceProviderCommonClientGetSubscriptionQuotaResponse, error) { + result := ResourceProviderCommonClientGetSubscriptionQuotaResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UserSubscriptionQuotaListResult); err != nil { + return ResourceProviderCommonClientGetSubscriptionQuotaResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/response_types.go new file mode 100644 index 00000000..cfb1efaf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/response_types.go @@ -0,0 +1,201 @@ +//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 + +// CertificatesClientCreateOrUpdateResponse contains the response from method CertificatesClient.CreateOrUpdate. +type CertificatesClientCreateOrUpdateResponse struct { + CertificateDescription +} + +// CertificatesClientDeleteResponse contains the response from method CertificatesClient.Delete. +type CertificatesClientDeleteResponse struct { + // placeholder for future response values +} + +// CertificatesClientGenerateVerificationCodeResponse contains the response from method CertificatesClient.GenerateVerificationCode. +type CertificatesClientGenerateVerificationCodeResponse struct { + CertificateWithNonceDescription +} + +// CertificatesClientGetResponse contains the response from method CertificatesClient.Get. +type CertificatesClientGetResponse struct { + CertificateDescription +} + +// CertificatesClientListByIotHubResponse contains the response from method CertificatesClient.ListByIotHub. +type CertificatesClientListByIotHubResponse struct { + CertificateListDescription +} + +// CertificatesClientVerifyResponse contains the response from method CertificatesClient.Verify. +type CertificatesClientVerifyResponse struct { + CertificateDescription +} + +// ClientManualFailoverResponse contains the response from method Client.BeginManualFailover. +type ClientManualFailoverResponse struct { + // placeholder for future response values +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + OperationListResult +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. +type PrivateEndpointConnectionsClientListResponse struct { + // The list of private endpoint connections for an IotHub + PrivateEndpointConnectionArray []*PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginUpdate. +type PrivateEndpointConnectionsClientUpdateResponse struct { + PrivateEndpointConnection +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + GroupIDInformation +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. +type PrivateLinkResourcesClientListResponse struct { + PrivateLinkResources +} + +// ResourceClientCheckNameAvailabilityResponse contains the response from method ResourceClient.CheckNameAvailability. +type ResourceClientCheckNameAvailabilityResponse struct { + NameAvailabilityInfo +} + +// ResourceClientCreateEventHubConsumerGroupResponse contains the response from method ResourceClient.CreateEventHubConsumerGroup. +type ResourceClientCreateEventHubConsumerGroupResponse struct { + EventHubConsumerGroupInfo +} + +// ResourceClientCreateOrUpdateResponse contains the response from method ResourceClient.BeginCreateOrUpdate. +type ResourceClientCreateOrUpdateResponse struct { + Description +} + +// ResourceClientDeleteEventHubConsumerGroupResponse contains the response from method ResourceClient.DeleteEventHubConsumerGroup. +type ResourceClientDeleteEventHubConsumerGroupResponse struct { + // placeholder for future response values +} + +// ResourceClientDeleteResponse contains the response from method ResourceClient.BeginDelete. +type ResourceClientDeleteResponse struct { + Description +} + +// ResourceClientExportDevicesResponse contains the response from method ResourceClient.ExportDevices. +type ResourceClientExportDevicesResponse struct { + JobResponse +} + +// ResourceClientGetEndpointHealthResponse contains the response from method ResourceClient.NewGetEndpointHealthPager. +type ResourceClientGetEndpointHealthResponse struct { + EndpointHealthDataListResult +} + +// ResourceClientGetEventHubConsumerGroupResponse contains the response from method ResourceClient.GetEventHubConsumerGroup. +type ResourceClientGetEventHubConsumerGroupResponse struct { + EventHubConsumerGroupInfo +} + +// ResourceClientGetJobResponse contains the response from method ResourceClient.GetJob. +type ResourceClientGetJobResponse struct { + JobResponse +} + +// ResourceClientGetKeysForKeyNameResponse contains the response from method ResourceClient.GetKeysForKeyName. +type ResourceClientGetKeysForKeyNameResponse struct { + SharedAccessSignatureAuthorizationRule +} + +// ResourceClientGetQuotaMetricsResponse contains the response from method ResourceClient.NewGetQuotaMetricsPager. +type ResourceClientGetQuotaMetricsResponse struct { + QuotaMetricInfoListResult +} + +// ResourceClientGetResponse contains the response from method ResourceClient.Get. +type ResourceClientGetResponse struct { + Description +} + +// ResourceClientGetStatsResponse contains the response from method ResourceClient.GetStats. +type ResourceClientGetStatsResponse struct { + RegistryStatistics +} + +// ResourceClientGetValidSKUsResponse contains the response from method ResourceClient.NewGetValidSKUsPager. +type ResourceClientGetValidSKUsResponse struct { + SKUDescriptionListResult +} + +// ResourceClientImportDevicesResponse contains the response from method ResourceClient.ImportDevices. +type ResourceClientImportDevicesResponse struct { + JobResponse +} + +// ResourceClientListByResourceGroupResponse contains the response from method ResourceClient.NewListByResourceGroupPager. +type ResourceClientListByResourceGroupResponse struct { + DescriptionListResult +} + +// ResourceClientListBySubscriptionResponse contains the response from method ResourceClient.NewListBySubscriptionPager. +type ResourceClientListBySubscriptionResponse struct { + DescriptionListResult +} + +// ResourceClientListEventHubConsumerGroupsResponse contains the response from method ResourceClient.NewListEventHubConsumerGroupsPager. +type ResourceClientListEventHubConsumerGroupsResponse struct { + EventHubConsumerGroupsListResult +} + +// ResourceClientListJobsResponse contains the response from method ResourceClient.NewListJobsPager. +type ResourceClientListJobsResponse struct { + JobResponseListResult +} + +// ResourceClientListKeysResponse contains the response from method ResourceClient.NewListKeysPager. +type ResourceClientListKeysResponse struct { + SharedAccessSignatureAuthorizationRuleListResult +} + +// ResourceClientTestAllRoutesResponse contains the response from method ResourceClient.TestAllRoutes. +type ResourceClientTestAllRoutesResponse struct { + TestAllRoutesResult +} + +// ResourceClientTestRouteResponse contains the response from method ResourceClient.TestRoute. +type ResourceClientTestRouteResponse struct { + TestRouteResult +} + +// ResourceClientUpdateResponse contains the response from method ResourceClient.BeginUpdate. +type ResourceClientUpdateResponse struct { + Description +} + +// ResourceProviderCommonClientGetSubscriptionQuotaResponse contains the response from method ResourceProviderCommonClient.GetSubscriptionQuota. +type ResourceProviderCommonClientGetSubscriptionQuotaResponse struct { + UserSubscriptionQuotaListResult +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go new file mode 100644 index 00000000..a3598527 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go @@ -0,0 +1,71 @@ +//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 + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "strings" + "time" +) + +const ( + rfc1123JSON = `"` + time.RFC1123 + `"` +) + +type timeRFC1123 time.Time + +func (t timeRFC1123) MarshalJSON() ([]byte, error) { + b := []byte(time.Time(t).Format(rfc1123JSON)) + return b, nil +} + +func (t timeRFC1123) MarshalText() ([]byte, error) { + b := []byte(time.Time(t).Format(time.RFC1123)) + return b, nil +} + +func (t *timeRFC1123) UnmarshalJSON(data []byte) error { + p, err := time.Parse(rfc1123JSON, strings.ToUpper(string(data))) + *t = timeRFC1123(p) + return err +} + +func (t *timeRFC1123) UnmarshalText(data []byte) error { + p, err := time.Parse(time.RFC1123, string(data)) + *t = timeRFC1123(p) + return err +} + +func populateTimeRFC1123(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC1123)(t) +} + +func unpopulateTimeRFC1123(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC1123 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go new file mode 100644 index 00000000..c32fab2f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go @@ -0,0 +1,87 @@ +//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 + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/magodo/aztft/internal/client/client.go b/vendor/github.com/magodo/aztft/internal/client/client.go index 20e61322..373d0e23 100644 --- a/vendor/github.com/magodo/aztft/internal/client/client.go +++ b/vendor/github.com/magodo/aztft/internal/client/client.go @@ -21,6 +21,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/domainservices/armdomainservices" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic" @@ -606,3 +607,11 @@ func (b *ClientBuilder) NewPaloalToNetworkFirewallsClient(subscriptionId string) &b.ClientOpt, ) } + +func (b *ClientBuilder) NewIothubsClient(subscriptionId string) (*armiothub.ResourceClient, error) { + return armiothub.NewResourceClient( + subscriptionId, + b.Cred, + &b.ClientOpt, + ) +} diff --git a/vendor/github.com/magodo/aztft/internal/populate/populate.go b/vendor/github.com/magodo/aztft/internal/populate/populate.go index d134869e..571a82db 100644 --- a/vendor/github.com/magodo/aztft/internal/populate/populate.go +++ b/vendor/github.com/magodo/aztft/internal/populate/populate.go @@ -20,6 +20,7 @@ var populaters = map[string]populateFunc{ "azurerm_disk_pool_iscsi_target": populateDiskPoolIscsiTarget, "azurerm_subnet": populateSubnet, "azurerm_logic_app_workflow": populateLogicAppWorkflow, + "azurerm_iothub": populateIotHub, } func NeedsAPI(rt string) bool { diff --git a/vendor/github.com/magodo/aztft/internal/populate/populate_iothub.go b/vendor/github.com/magodo/aztft/internal/populate/populate_iothub.go new file mode 100644 index 00000000..7802e90c --- /dev/null +++ b/vendor/github.com/magodo/aztft/internal/populate/populate_iothub.go @@ -0,0 +1,84 @@ +package populate + +import ( + "context" + "fmt" + + "github.com/magodo/armid" + "github.com/magodo/aztft/internal/client" +) + +func populateIotHub(b *client.ClientBuilder, id armid.ResourceId) ([]armid.ResourceId, error) { + resourceGroupId := id.RootScope().(*armid.ResourceGroup) + client, err := b.NewIothubsClient(resourceGroupId.SubscriptionId) + if err != nil { + return nil, err + } + resp, err := client.Get(context.Background(), resourceGroupId.Name, id.Names()[0], nil) + if err != nil { + return nil, fmt.Errorf("retrieving %q: %v", id, err) + } + props := resp.Description.Properties + if props == nil { + return nil, nil + } + + if props.Routing == nil || props.Routing.Endpoints == nil { + return nil, nil + } + + endpoints := *props.Routing.Endpoints + + var result []armid.ResourceId + + for _, ep := range endpoints.EventHubs { + if ep == nil { + continue + } + if ep.Name == nil { + continue + } + azureId := id.Clone().(*armid.ScopedResourceId) + azureId.AttrTypes = append(azureId.AttrTypes, "endpointsEventhub") + azureId.AttrNames = append(azureId.AttrNames, *ep.Name) + result = append(result, azureId) + } + for _, ep := range endpoints.ServiceBusQueues { + if ep == nil { + continue + } + if ep.Name == nil { + continue + } + azureId := id.Clone().(*armid.ScopedResourceId) + azureId.AttrTypes = append(azureId.AttrTypes, "endpointsServicebusQueue") + azureId.AttrNames = append(azureId.AttrNames, *ep.Name) + result = append(result, azureId) + } + for _, ep := range endpoints.ServiceBusTopics { + if ep == nil { + continue + } + if ep.Name == nil { + continue + } + azureId := id.Clone().(*armid.ScopedResourceId) + azureId.AttrTypes = append(azureId.AttrTypes, "endpointsServicebusTopic") + azureId.AttrNames = append(azureId.AttrNames, *ep.Name) + result = append(result, azureId) + } + for _, ep := range endpoints.StorageContainers { + if ep == nil { + continue + } + if ep.Name == nil { + continue + } + azureId := id.Clone().(*armid.ScopedResourceId) + azureId.AttrTypes = append(azureId.AttrTypes, "endpointsStorageContainer") + azureId.AttrNames = append(azureId.AttrNames, *ep.Name) + result = append(result, azureId) + } + + return result, nil +} diff --git a/vendor/github.com/magodo/aztft/internal/resmap/map.json b/vendor/github.com/magodo/aztft/internal/resmap/map.json index debb15ca..fa118a3c 100644 --- a/vendor/github.com/magodo/aztft/internal/resmap/map.json +++ b/vendor/github.com/magodo/aztft/internal/resmap/map.json @@ -1247,6 +1247,35 @@ ] } }, + "azurerm_application_load_balancer": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.ServiceNetworking", + "types": [ + "trafficControllers" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.ServiceNetworking/trafficControllers" + ] + } + }, + "azurerm_application_load_balancer_frontend": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.ServiceNetworking", + "types": [ + "trafficControllers", + "frontends" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.ServiceNetworking/trafficControllers/frontends" + ] + } + }, "azurerm_application_security_group": { "management_plane": { "scopes": [ @@ -1332,6 +1361,20 @@ ] } }, + "azurerm_arc_resource_bridge_appliance": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.ResourceConnector", + "types": [ + "appliances" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.ResourceConnector/appliances" + ] + } + }, "azurerm_attestation_provider": { "management_plane": { "scopes": [ @@ -1570,6 +1613,21 @@ ] } }, + "azurerm_automation_python3_package": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Automation", + "types": [ + "automationAccounts", + "python3Packages" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Automation/automationAccounts/python3Packages" + ] + } + }, "azurerm_automation_runbook": { "management_plane": { "scopes": [ @@ -3306,6 +3364,21 @@ ] } }, + "azurerm_data_factory_dataset_azure_sql_table": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.DataFactory", + "types": [ + "factories", + "datasets" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.DataFactory/factories/datasets" + ] + } + }, "azurerm_data_factory_dataset_binary": { "management_plane": { "scopes": [ @@ -4386,6 +4459,34 @@ ] } }, + "azurerm_dev_center": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.DevCenter", + "types": [ + "devCenters" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.DevCenter/devCenters" + ] + } + }, + "azurerm_dev_center_project": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.DevCenter", + "types": [ + "projects" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.DevCenter/projects" + ] + } + }, "azurerm_dev_test_global_vm_shutdown_schedule": { "management_plane": { "scopes": [ @@ -5367,6 +5468,20 @@ ] } }, + "azurerm_function_app_connection": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups/Microsoft.Web/sites" + ], + "provider": "Microsoft.ServiceLinker", + "types": [ + "linkers" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Web/sites/Microsoft.ServiceLinker/linkers" + ] + } + }, "azurerm_function_app_function": { "management_plane": { "scopes": [ @@ -6011,9 +6126,22 @@ ] } }, + "azurerm_iothub_endpoint_cosmosdb_account": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Devices", + "types": [ + "iotHubs", + "endpointsCosmosdbAccount" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Devices/iotHubs/endpoints" + ] + } + }, "azurerm_iothub_endpoint_eventhub": { - "is_removed": true, - "remove_reason": "This is a property rather than a resource", "management_plane": { "scopes": [ "/subscriptions/resourceGroups" @@ -6021,7 +6149,7 @@ "provider": "Microsoft.Devices", "types": [ "iotHubs", - "endpoints" + "endpointsEventhub" ], "import_specs": [ "/subscriptions/resourceGroups/Microsoft.Devices/iotHubs/endpoints" @@ -6029,8 +6157,6 @@ } }, "azurerm_iothub_endpoint_servicebus_queue": { - "is_removed": true, - "remove_reason": "This is a property rather than a resource", "management_plane": { "scopes": [ "/subscriptions/resourceGroups" @@ -6038,7 +6164,7 @@ "provider": "Microsoft.Devices", "types": [ "iotHubs", - "endpoints" + "endpointsServicebusQueue" ], "import_specs": [ "/subscriptions/resourceGroups/Microsoft.Devices/iotHubs/endpoints" @@ -6046,8 +6172,6 @@ } }, "azurerm_iothub_endpoint_servicebus_topic": { - "is_removed": true, - "remove_reason": "This is a property rather than a resource", "management_plane": { "scopes": [ "/subscriptions/resourceGroups" @@ -6055,7 +6179,7 @@ "provider": "Microsoft.Devices", "types": [ "iotHubs", - "endpoints" + "endpointsServicebusTopic" ], "import_specs": [ "/subscriptions/resourceGroups/Microsoft.Devices/iotHubs/endpoints" @@ -6063,8 +6187,6 @@ } }, "azurerm_iothub_endpoint_storage_container": { - "is_removed": true, - "remove_reason": "This is a property rather than a resource", "management_plane": { "scopes": [ "/subscriptions/resourceGroups" @@ -6072,7 +6194,7 @@ "provider": "Microsoft.Devices", "types": [ "iotHubs", - "endpoints" + "endpointsStorageContainer" ], "import_specs": [ "/subscriptions/resourceGroups/Microsoft.Devices/iotHubs/endpoints" @@ -9226,6 +9348,23 @@ ] } }, + "azurerm_netapp_volume_quota_rule": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.NetApp", + "types": [ + "netAppAccounts", + "capacityPools", + "volumes", + "volumeQuotaRules" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.NetApp/netAppAccounts/capacityPools/volumes/volumeQuotaRules" + ] + } + }, "azurerm_network_connection_monitor": { "management_plane": { "scopes": [ @@ -9269,6 +9408,21 @@ ] } }, + "azurerm_network_function_collector_policy": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.NetworkFunction", + "types": [ + "azureTrafficCollectors", + "collectorPolicies" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.NetworkFunction/azureTrafficCollectors/collectorPolicies" + ] + } + }, "azurerm_network_interface": { "management_plane": { "scopes": [ @@ -9631,6 +9785,21 @@ ] } }, + "azurerm_new_relic_tag_rule": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "NewRelic.Observability", + "types": [ + "monitors", + "tagRules" + ], + "import_specs": [ + "/subscriptions/resourceGroups/NewRelic.Observability/monitors/tagRules" + ] + } + }, "azurerm_nginx_certificate": { "management_plane": { "scopes": [ @@ -10793,6 +10962,34 @@ ] } }, + "azurerm_resource_management_private_link": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Authorization", + "types": [ + "resourceManagementPrivateLinks" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Authorization/resourceManagementPrivateLinks" + ] + } + }, + "azurerm_resource_management_private_link_association": { + "management_plane": { + "scopes": [ + "/Microsoft.Management/managementGroups" + ], + "provider": "Microsoft.Authorization", + "types": [ + "privateLinkAssociations" + ], + "import_specs": [ + "/Microsoft.Management/managementGroups/Microsoft.Authorization/privateLinkAssociations" + ] + } + }, "azurerm_resource_policy_assignment": { "management_plane": { "scopes": [ @@ -11089,6 +11286,20 @@ ] } }, + "azurerm_security_center_storage_defender": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups/Microsoft.Storage/storageAccounts" + ], + "provider": "Microsoft.Security", + "types": [ + "defenderForStorageSettings" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Storage/storageAccounts/Microsoft.Security/defenderForStorageSettings" + ] + } + }, "azurerm_security_center_subscription_pricing": { "management_plane": { "scopes": [ @@ -12140,11 +12351,11 @@ ], "provider": "Microsoft.AppPlatform", "types": [ - "Spring", + "spring", "applicationAccelerators" ], "import_specs": [ - "/subscriptions/resourceGroups/Microsoft.AppPlatform/Spring/applicationAccelerators" + "/subscriptions/resourceGroups/Microsoft.AppPlatform/spring/applicationAccelerators" ] } }, @@ -12259,6 +12470,21 @@ ] } }, + "azurerm_spring_cloud_application_insights_application_performance_monitoring": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.AppPlatform", + "types": [ + "spring", + "apms" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.AppPlatform/spring/apms" + ] + } + }, "azurerm_spring_cloud_application_live_view": { "management_plane": { "scopes": [ @@ -12406,12 +12632,12 @@ ], "provider": "Microsoft.AppPlatform", "types": [ - "Spring", + "spring", "applicationAccelerators", "customizedAccelerators" ], "import_specs": [ - "/subscriptions/resourceGroups/Microsoft.AppPlatform/Spring/applicationAccelerators/customizedAccelerators" + "/subscriptions/resourceGroups/Microsoft.AppPlatform/spring/applicationAccelerators/customizedAccelerators" ] } }, @@ -14287,6 +14513,21 @@ ] } }, + "azurerm_virtual_hub_routing_intent": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Network", + "types": [ + "virtualHubs", + "routingIntent" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Network/virtualHubs/routingIntent" + ] + } + }, "azurerm_virtual_hub_security_partner_provider": { "management_plane": { "scopes": [ diff --git a/vendor/github.com/magodo/aztft/internal/resmap/map_gen.json b/vendor/github.com/magodo/aztft/internal/resmap/map_gen.json index 7b70a231..394760bc 100644 --- a/vendor/github.com/magodo/aztft/internal/resmap/map_gen.json +++ b/vendor/github.com/magodo/aztft/internal/resmap/map_gen.json @@ -1230,6 +1230,35 @@ ] } }, + "azurerm_application_load_balancer": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.ServiceNetworking", + "types": [ + "trafficControllers" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.ServiceNetworking/trafficControllers" + ] + } + }, + "azurerm_application_load_balancer_frontend": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.ServiceNetworking", + "types": [ + "trafficControllers", + "frontends" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.ServiceNetworking/trafficControllers/frontends" + ] + } + }, "azurerm_application_security_group": { "management_plane": { "scopes": [ @@ -1315,6 +1344,20 @@ ] } }, + "azurerm_arc_resource_bridge_appliance": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.ResourceConnector", + "types": [ + "appliances" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.ResourceConnector/appliances" + ] + } + }, "azurerm_attestation_provider": { "management_plane": { "scopes": [ @@ -1553,6 +1596,21 @@ ] } }, + "azurerm_automation_python3_package": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Automation", + "types": [ + "automationAccounts", + "python3Packages" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Automation/automationAccounts/python3Packages" + ] + } + }, "azurerm_automation_runbook": { "management_plane": { "scopes": [ @@ -3283,6 +3341,21 @@ ] } }, + "azurerm_data_factory_dataset_azure_sql_table": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.DataFactory", + "types": [ + "factories", + "datasets" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.DataFactory/factories/datasets" + ] + } + }, "azurerm_data_factory_dataset_binary": { "management_plane": { "scopes": [ @@ -4355,6 +4428,34 @@ ] } }, + "azurerm_dev_center": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.DevCenter", + "types": [ + "devCenters" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.DevCenter/devCenters" + ] + } + }, + "azurerm_dev_center_project": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.DevCenter", + "types": [ + "projects" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.DevCenter/projects" + ] + } + }, "azurerm_dev_test_global_vm_shutdown_schedule": { "management_plane": { "scopes": [ @@ -5308,6 +5409,20 @@ ] } }, + "azurerm_function_app_connection": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups/Microsoft.Web/sites" + ], + "provider": "Microsoft.ServiceLinker", + "types": [ + "linkers" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Web/sites/Microsoft.ServiceLinker/linkers" + ] + } + }, "azurerm_function_app_function": { "management_plane": { "scopes": [ @@ -5950,6 +6065,21 @@ ] } }, + "azurerm_iothub_endpoint_cosmosdb_account": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Devices", + "types": [ + "iotHubs", + "endpoints" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Devices/iotHubs/endpoints" + ] + } + }, "azurerm_iothub_endpoint_eventhub": { "management_plane": { "scopes": [ @@ -9120,6 +9250,23 @@ ] } }, + "azurerm_netapp_volume_quota_rule": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.NetApp", + "types": [ + "netAppAccounts", + "capacityPools", + "volumes", + "volumeQuotaRules" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.NetApp/netAppAccounts/capacityPools/volumes/volumeQuotaRules" + ] + } + }, "azurerm_network_connection_monitor": { "management_plane": { "scopes": [ @@ -9163,6 +9310,21 @@ ] } }, + "azurerm_network_function_collector_policy": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.NetworkFunction", + "types": [ + "azureTrafficCollectors", + "collectorPolicies" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.NetworkFunction/azureTrafficCollectors/collectorPolicies" + ] + } + }, "azurerm_network_interface": { "management_plane": { "scopes": [ @@ -9445,6 +9607,21 @@ ] } }, + "azurerm_new_relic_tag_rule": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "NewRelic.Observability", + "types": [ + "monitors", + "tagRules" + ], + "import_specs": [ + "/subscriptions/resourceGroups/NewRelic.Observability/monitors/tagRules" + ] + } + }, "azurerm_nginx_certificate": { "management_plane": { "scopes": [ @@ -10606,6 +10783,34 @@ ] } }, + "azurerm_resource_management_private_link": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Authorization", + "types": [ + "resourceManagementPrivateLinks" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Authorization/resourceManagementPrivateLinks" + ] + } + }, + "azurerm_resource_management_private_link_association": { + "management_plane": { + "scopes": [ + "/Microsoft.Management/managementGroups" + ], + "provider": "Microsoft.Authorization", + "types": [ + "privateLinkAssociations" + ], + "import_specs": [ + "/Microsoft.Management/managementGroups/Microsoft.Authorization/privateLinkAssociations" + ] + } + }, "azurerm_resource_policy_assignment": { "management_plane": { "scopes": [ @@ -10912,6 +11117,20 @@ ] } }, + "azurerm_security_center_storage_defender": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Storage", + "types": [ + "storageAccounts" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Storage/storageAccounts" + ] + } + }, "azurerm_security_center_subscription_pricing": { "management_plane": { "scopes": [ @@ -11960,11 +12179,11 @@ ], "provider": "Microsoft.AppPlatform", "types": [ - "Spring", + "spring", "applicationAccelerators" ], "import_specs": [ - "/subscriptions/resourceGroups/Microsoft.AppPlatform/Spring/applicationAccelerators" + "/subscriptions/resourceGroups/Microsoft.AppPlatform/spring/applicationAccelerators" ] } }, @@ -12077,6 +12296,21 @@ ] } }, + "azurerm_spring_cloud_application_insights_application_performance_monitoring": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.AppPlatform", + "types": [ + "spring", + "apms" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.AppPlatform/spring/apms" + ] + } + }, "azurerm_spring_cloud_application_live_view": { "management_plane": { "scopes": [ @@ -12224,12 +12458,12 @@ ], "provider": "Microsoft.AppPlatform", "types": [ - "Spring", + "spring", "applicationAccelerators", "customizedAccelerators" ], "import_specs": [ - "/subscriptions/resourceGroups/Microsoft.AppPlatform/Spring/applicationAccelerators/customizedAccelerators" + "/subscriptions/resourceGroups/Microsoft.AppPlatform/spring/applicationAccelerators/customizedAccelerators" ] } }, @@ -14073,6 +14307,21 @@ ] } }, + "azurerm_virtual_hub_routing_intent": { + "management_plane": { + "scopes": [ + "/subscriptions/resourceGroups" + ], + "provider": "Microsoft.Network", + "types": [ + "virtualHubs", + "routingIntent" + ], + "import_specs": [ + "/subscriptions/resourceGroups/Microsoft.Network/virtualHubs/routingIntent" + ] + } + }, "azurerm_virtual_hub_security_partner_provider": { "management_plane": { "scopes": [ diff --git a/vendor/github.com/magodo/aztft/internal/resolve/resolve.go b/vendor/github.com/magodo/aztft/internal/resolve/resolve.go index 4cebe397..16f897b0 100644 --- a/vendor/github.com/magodo/aztft/internal/resolve/resolve.go +++ b/vendor/github.com/magodo/aztft/internal/resolve/resolve.go @@ -193,6 +193,9 @@ var Resolvers = map[string]map[string]resolver{ "/PALOALTONETWORKS.CLOUDNGFW/FIREWALLS": { "/SUBSCRIPTIONS/RESOURCEGROUPS": paloalToNetworkFirewall{}, }, + "/MICROSOFT.SERVICELINKER/LINKERS": { + "/SUBSCRIPTIONS/RESOURCEGROUPS/MICROSOFT.WEB/SITES": serviceConnectorAppServiceResolver{}, + }, } type ResolveError struct { diff --git a/vendor/github.com/magodo/aztft/internal/resolve/resolve_data_factory_dataset.go b/vendor/github.com/magodo/aztft/internal/resolve/resolve_data_factory_dataset.go index c3d4655e..5cd8b32e 100644 --- a/vendor/github.com/magodo/aztft/internal/resolve/resolve_data_factory_dataset.go +++ b/vendor/github.com/magodo/aztft/internal/resolve/resolve_data_factory_dataset.go @@ -25,6 +25,7 @@ func (dataFactoryDatasetsResolver) ResourceTypes() []string { "azurerm_data_factory_dataset_http", "azurerm_data_factory_dataset_binary", "azurerm_data_factory_dataset_mysql", + "azurerm_data_factory_dataset_azure_sql_table", } } @@ -67,6 +68,8 @@ func (dataFactoryDatasetsResolver) Resolve(b *client.ClientBuilder, id armid.Res return "azurerm_data_factory_dataset_binary", nil case *armdatafactory.MySQLTableDataset: return "azurerm_data_factory_dataset_mysql", nil + case *armdatafactory.AzureSQLTableDataset: + return "azurerm_data_factory_dataset_azure_sql_table", nil default: return "", fmt.Errorf("unknown dataset type %T", props) } diff --git a/vendor/github.com/magodo/aztft/internal/resolve/resolve_service_connector_appservice.go b/vendor/github.com/magodo/aztft/internal/resolve/resolve_service_connector_appservice.go new file mode 100644 index 00000000..ddd52fc1 --- /dev/null +++ b/vendor/github.com/magodo/aztft/internal/resolve/resolve_service_connector_appservice.go @@ -0,0 +1,35 @@ +package resolve + +import ( + "fmt" + + "github.com/magodo/armid" + "github.com/magodo/aztft/internal/client" +) + +type serviceConnectorAppServiceResolver struct{} + +func (serviceConnectorAppServiceResolver) ResourceTypes() []string { + return []string{ + "azurerm_function_app_connection", + "azurerm_app_service_connection", + } +} + +func (serviceConnectorAppServiceResolver) Resolve(b *client.ClientBuilder, id armid.ResourceId) (string, error) { + rt, err := appServiceSitesResolver{}.Resolve(b, id.ParentScope()) + if err != nil { + return "", err + } + + switch rt { + case "azurerm_logic_app_standard", + "azurerm_linux_function_app", + "azurerm_windows_function_app": + return "azurerm_function_app_connection", nil + case "azurerm_linux_web_app", + "azurerm_windows_web_app": + return "azurerm_app_service_connection", nil + } + return "", fmt.Errorf("unknown app service site resource type: %s", rt) +} diff --git a/vendor/github.com/magodo/aztft/internal/tfid/tfid.go b/vendor/github.com/magodo/aztft/internal/tfid/tfid.go index 91782ae0..10393249 100644 --- a/vendor/github.com/magodo/aztft/internal/tfid/tfid.go +++ b/vendor/github.com/magodo/aztft/internal/tfid/tfid.go @@ -158,6 +158,14 @@ func StaticBuild(id armid.ResourceId, rt string) (string, error) { "azurerm_subnet_network_security_group_association", "azurerm_subnet_route_table_association": return id.Parent().String(), nil + case "azurerm_iothub_endpoint_cosmosdb_account", + "azurerm_iothub_endpoint_eventhub", + "azurerm_iothub_endpoint_servicebus_queue", + "azurerm_iothub_endpoint_servicebus_topic", + "azurerm_iothub_endpoint_storage_container": + id := id.(*armid.ScopedResourceId) + id.AttrTypes[len(id.AttrTypes)-1] = "endpoints" + return id.String(), nil case "azurerm_api_management_api_operation_policy", "azurerm_api_management_api_policy", "azurerm_api_management_policy", diff --git a/vendor/modules.txt b/vendor/modules.txt index 1a4bfa9b..88d8648b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -87,6 +87,9 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight v1.1.1 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub v1.1.1 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault @@ -268,7 +271,7 @@ github.com/imdario/mergo # github.com/magodo/armid v0.0.0-20230511151020-27880e5961c3 ## explicit; go 1.18 github.com/magodo/armid -# github.com/magodo/aztft v0.3.1-0.20230825031936-c246852b4337 +# github.com/magodo/aztft v0.3.1-0.20231103032414-1c1646e4c907 ## explicit; go 1.19 github.com/magodo/aztft/aztft github.com/magodo/aztft/internal/client