From b1048fdec1db508e6cf540e3f5eaaefe6f1602f0 Mon Sep 17 00:00:00 2001 From: Jiahui Peng <46921893+Alancere@users.noreply.github.com> Date: Tue, 7 Dec 2021 17:10:14 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/hybridnetwork/armhybridnetwork/0.1.0 (#16384) * [Release] sdk/resourcemanager/hybridnetwork/armhybridnetwork/0.1.0 generation from spec commit: 3c5135f8325eaf79be7b137cae363bdcba028c17 * Update CHANGELOG.md Co-authored-by: Dapeng Zhang --- .../armhybridnetwork/CHANGELOG.md | 5 + .../armhybridnetwork/LICENSE.txt | 21 + .../hybridnetwork/armhybridnetwork/README.md | 75 + .../armhybridnetwork/autorest.md | 13 + .../hybridnetwork/armhybridnetwork/build.go | 7 + .../hybridnetwork/armhybridnetwork/ci.yml | 27 + .../hybridnetwork/armhybridnetwork/go.mod | 9 + .../hybridnetwork/armhybridnetwork/go.sum | 45 + .../armhybridnetwork/go_mod_tidy_hack.go | 13 + ...e_generated_example_devices_client_test.go | 174 ++ ...ed_example_networkfunctions_client_test.go | 192 ++ ...mple_networkfunctionvendors_client_test.go | 33 + ...e_networkfunctionvendorskus_client_test.go | 52 + ...enerated_example_operations_client_test.go | 33 + ...rated_example_roleinstances_client_test.go | 130 ++ ...mple_vendornetworkfunctions_client_test.go | 136 ++ ...e_generated_example_vendors_client_test.go | 96 + ...ed_example_vendorskupreview_client_test.go | 105 ++ ...enerated_example_vendorskus_client_test.go | 183 ++ .../zz_generated_constants.go | 448 +++++ .../zz_generated_devices_client.go | 502 +++++ .../armhybridnetwork/zz_generated_models.go | 1610 +++++++++++++++++ .../zz_generated_networkfunctions_client.go | 437 +++++ ...generated_networkfunctionvendors_client.go | 97 + ...erated_networkfunctionvendorskus_client.go | 163 ++ .../zz_generated_operations_client.go | 89 + .../armhybridnetwork/zz_generated_pagers.go | 719 ++++++++ .../armhybridnetwork/zz_generated_pollers.go | 617 +++++++ .../zz_generated_polymorphic_helpers.go | 67 + .../zz_generated_response_types.go | 972 ++++++++++ .../zz_generated_roleinstances_client.go | 434 +++++ .../zz_generated_time_rfc3339.go | 85 + ...generated_vendornetworkfunctions_client.go | 257 +++ .../zz_generated_vendors_client.go | 305 ++++ .../zz_generated_vendorskupreview_client.go | 334 ++++ .../zz_generated_vendorskus_client.go | 318 ++++ 36 files changed, 8803 insertions(+) create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/CHANGELOG.md create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/LICENSE.txt create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/README.md create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/autorest.md create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/build.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ci.yml create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.mod create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.sum create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_devices_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctions_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendors_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendorskus_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_operations_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_roleinstances_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendornetworkfunctions_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendors_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskupreview_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskus_client_test.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_constants.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_devices_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_models.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctions_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendors_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendorskus_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_polymorphic_helpers.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_roleinstances_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendornetworkfunctions_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendors_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskupreview_client.go create mode 100644 sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskus_client.go diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/CHANGELOG.md b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/CHANGELOG.md new file mode 100644 index 000000000000..549748e2931f --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-07) + +- Init release. diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/LICENSE.txt b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/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/sdk/resourcemanager/hybridnetwork/armhybridnetwork/README.md b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/README.md new file mode 100644 index 000000000000..4aeea051c135 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/README.md @@ -0,0 +1,75 @@ +# Azure Private Edge Zone Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork) + +The `armhybridnetwork` module provides operations for working with Azure Private Edge Zone. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/hybridnetwork/armhybridnetwork) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.13 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Private Edge Zone module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Private Edge Zone. 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). + +## Clients + +Azure Private Edge Zone modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client := armhybridnetwork.NewVendorSKUsClient(, 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{ + Host: arm.AzureChina, +} +client := armhybridnetwork.NewVendorSKUsClient(, cred, &options) +``` + +## 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 `Private Edge Zone` 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/sdk/resourcemanager/hybridnetwork/armhybridnetwork/autorest.md b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/autorest.md new file mode 100644 index 000000000000..c8412ef1443e --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/3c5135f8325eaf79be7b137cae363bdcba028c17/specification/hybridnetwork/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/3c5135f8325eaf79be7b137cae363bdcba028c17/specification/hybridnetwork/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/build.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/build.go new file mode 100644 index 000000000000..8c1efbddb159 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/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.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/hybridnetwork/armhybridnetwork + +package armhybridnetwork diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ci.yml b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ci.yml new file mode 100644 index 000000000000..9b41e7058326 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ci.yml @@ -0,0 +1,27 @@ +# 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/hybridnetwork/armhybridnetwork/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/hybridnetwork/armhybridnetwork/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/hybridnetwork/armhybridnetwork' diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.mod b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.mod new file mode 100644 index 000000000000..406d743cf504 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.mod @@ -0,0 +1,9 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v59.4.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 +) diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.sum b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.sum new file mode 100644 index 000000000000..b5602e34337c --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go.sum @@ -0,0 +1,45 @@ +github.com/Azure/azure-sdk-for-go v59.4.0+incompatible h1:gDA8odnngdNd3KYHL2NoK1j9vpWBgEnFSjKKLpkC8Aw= +github.com/Azure/azure-sdk-for-go v59.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 h1:VBvHGLJbaY0+c66NZHdS9cgjHVYSH6DDa0XJMyrblsI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0/go.mod h1:GJzjM4SR9T0KyX5gKCVyz1ytD8FeWeUPCwtFCt1AyfE= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go_mod_tidy_hack.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go_mod_tidy_hack.go new file mode 100644 index 000000000000..dcdea1edc5cd --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armhybridnetwork + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_devices_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_devices_client_test.go new file mode 100644 index 000000000000..4efa4fd6dbf0 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_devices_client_test.go @@ -0,0 +1,174 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceDelete.json +func ExampleDevicesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceGet.json +func ExampleDevicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Device.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceCreate.json +func ExampleDevicesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armhybridnetwork.Device{ + TrackedResource: armhybridnetwork.TrackedResource{ + Location: to.StringPtr(""), + }, + Properties: &armhybridnetwork.AzureStackEdgeFormat{ + DevicePropertiesFormat: armhybridnetwork.DevicePropertiesFormat{ + DeviceType: armhybridnetwork.DeviceTypeAzureStackEdge.ToPtr(), + }, + AzureStackEdge: &armhybridnetwork.SubResource{ + ID: to.StringPtr(""), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("Device.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceUpdateTags.json +func ExampleDevicesClient_UpdateTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + res, err := client.UpdateTags(ctx, + "", + "", + armhybridnetwork.TagsObject{ + Tags: map[string]*string{ + "tag1": to.StringPtr("value1"), + "tag2": to.StringPtr("value2"), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Device.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceListBySubscription.json +func ExampleDevicesClient_ListBySubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + pager := client.ListBySubscription(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("Device.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceListByResourceGroup.json +func ExampleDevicesClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + pager := client.ListByResourceGroup("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("Device.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/DeviceListRegistrationKey.json +func ExampleDevicesClient_ListRegistrationKey() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewDevicesClient("", cred, nil) + _, err = client.ListRegistrationKey(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctions_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctions_client_test.go new file mode 100644 index 000000000000..dcc6e2484065 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctions_client_test.go @@ -0,0 +1,192 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionDelete.json +func ExampleNetworkFunctionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionsClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionGet.json +func ExampleNetworkFunctionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("NetworkFunction.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionCreate.json +func ExampleNetworkFunctionsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionsClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armhybridnetwork.NetworkFunction{ + TrackedResource: armhybridnetwork.TrackedResource{ + Location: to.StringPtr(""), + }, + Properties: &armhybridnetwork.NetworkFunctionPropertiesFormat{ + Device: &armhybridnetwork.SubResource{ + ID: to.StringPtr(""), + }, + ManagedApplicationParameters: map[string]interface{}{}, + NetworkFunctionUserConfigurations: []*armhybridnetwork.NetworkFunctionUserConfiguration{ + { + NetworkInterfaces: []*armhybridnetwork.NetworkInterface{ + { + IPConfigurations: []*armhybridnetwork.NetworkInterfaceIPConfiguration{ + { + DNSServers: []*string{}, + Gateway: to.StringPtr(""), + IPAddress: to.StringPtr(""), + IPAllocationMethod: armhybridnetwork.IPAllocationMethodDynamic.ToPtr(), + IPVersion: armhybridnetwork.IPVersionIPv4.ToPtr(), + Subnet: to.StringPtr(""), + }}, + MacAddress: to.StringPtr(""), + NetworkInterfaceName: to.StringPtr(""), + VMSwitchType: armhybridnetwork.VMSwitchTypeManagement.ToPtr(), + }, + { + IPConfigurations: []*armhybridnetwork.NetworkInterfaceIPConfiguration{ + { + DNSServers: []*string{}, + Gateway: to.StringPtr(""), + IPAddress: to.StringPtr(""), + IPAllocationMethod: armhybridnetwork.IPAllocationMethodDynamic.ToPtr(), + IPVersion: armhybridnetwork.IPVersionIPv4.ToPtr(), + Subnet: to.StringPtr(""), + }}, + MacAddress: to.StringPtr(""), + NetworkInterfaceName: to.StringPtr(""), + VMSwitchType: armhybridnetwork.VMSwitchTypeWan.ToPtr(), + }}, + RoleName: to.StringPtr(""), + UserDataParameters: map[string]interface{}{}, + }}, + SKUName: to.StringPtr(""), + SKUType: armhybridnetwork.SKUTypeSDWAN.ToPtr(), + VendorName: to.StringPtr(""), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("NetworkFunction.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionUpdateTags.json +func ExampleNetworkFunctionsClient_UpdateTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionsClient("", cred, nil) + res, err := client.UpdateTags(ctx, + "", + "", + armhybridnetwork.TagsObject{ + Tags: map[string]*string{ + "tag1": to.StringPtr("value1"), + "tag2": to.StringPtr("value2"), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("NetworkFunction.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionListBySubscription.json +func ExampleNetworkFunctionsClient_ListBySubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionsClient("", cred, nil) + pager := client.ListBySubscription(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("NetworkFunction.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionListByResourceGroup.json +func ExampleNetworkFunctionsClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionsClient("", cred, nil) + pager := client.ListByResourceGroup("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("NetworkFunction.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendors_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendors_client_test.go new file mode 100644 index 000000000000..043c267efa52 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendors_client_test.go @@ -0,0 +1,33 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionVendorAndSkuListBySubscription.json +func ExampleNetworkFunctionVendorsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionVendorsClient("", cred, nil) + pager := client.List(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendorskus_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendorskus_client_test.go new file mode 100644 index 000000000000..b59b3429f2ca --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_networkfunctionvendorskus_client_test.go @@ -0,0 +1,52 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionSkuListByVendor.json +func ExampleNetworkFunctionVendorSKUsClient_ListByVendor() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionVendorSKUsClient("", cred, nil) + pager := client.ListByVendor("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/NetworkFunctionSkuDetailsGet.json +func ExampleNetworkFunctionVendorSKUsClient_ListBySKU() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewNetworkFunctionVendorSKUsClient("", cred, nil) + pager := client.ListBySKU("", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_operations_client_test.go new file mode 100644 index 000000000000..e3ace9a4e192 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_operations_client_test.go @@ -0,0 +1,33 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/GetOperations.json +func ExampleOperationsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewOperationsClient(cred, nil) + pager := client.List(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_roleinstances_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_roleinstances_client_test.go new file mode 100644 index 000000000000..fa194d8b345f --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_roleinstances_client_test.go @@ -0,0 +1,130 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/RoleInstanceStart.json +func ExampleRoleInstancesClient_BeginStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewRoleInstancesClient("", cred, nil) + poller, err := client.BeginStart(ctx, + "", + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/RoleInstanceStop.json +func ExampleRoleInstancesClient_BeginStop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewRoleInstancesClient("", cred, nil) + poller, err := client.BeginStop(ctx, + "", + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/RoleInstanceRestart.json +func ExampleRoleInstancesClient_BeginRestart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewRoleInstancesClient("", cred, nil) + poller, err := client.BeginRestart(ctx, + "", + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/RoleInstanceGet.json +func ExampleRoleInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewRoleInstancesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("RoleInstance.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/RoleInstanceListByVendorNetworkFunction.json +func ExampleRoleInstancesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewRoleInstancesClient("", cred, nil) + pager := client.List("", + "", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("RoleInstance.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendornetworkfunctions_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendornetworkfunctions_client_test.go new file mode 100644 index 000000000000..5bee5cc57a84 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendornetworkfunctions_client_test.go @@ -0,0 +1,136 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorNfGet.json +func ExampleVendorNetworkFunctionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorNetworkFunctionsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("VendorNetworkFunction.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorNfCreate.json +func ExampleVendorNetworkFunctionsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorNetworkFunctionsClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armhybridnetwork.VendorNetworkFunction{ + Properties: &armhybridnetwork.VendorNetworkFunctionPropertiesFormat{ + NetworkFunctionVendorConfigurations: []*armhybridnetwork.NetworkFunctionVendorConfiguration{ + { + NetworkInterfaces: []*armhybridnetwork.NetworkInterface{ + { + IPConfigurations: []*armhybridnetwork.NetworkInterfaceIPConfiguration{ + { + DNSServers: []*string{}, + Gateway: to.StringPtr(""), + IPAddress: to.StringPtr(""), + IPAllocationMethod: armhybridnetwork.IPAllocationMethodDynamic.ToPtr(), + IPVersion: armhybridnetwork.IPVersionIPv4.ToPtr(), + Subnet: to.StringPtr(""), + }}, + MacAddress: to.StringPtr(""), + NetworkInterfaceName: to.StringPtr(""), + VMSwitchType: armhybridnetwork.VMSwitchTypeManagement.ToPtr(), + }, + { + IPConfigurations: []*armhybridnetwork.NetworkInterfaceIPConfiguration{ + { + DNSServers: []*string{}, + Gateway: to.StringPtr(""), + IPAddress: to.StringPtr(""), + IPAllocationMethod: armhybridnetwork.IPAllocationMethodDynamic.ToPtr(), + IPVersion: armhybridnetwork.IPVersionIPv4.ToPtr(), + Subnet: to.StringPtr(""), + }}, + MacAddress: to.StringPtr(""), + NetworkInterfaceName: to.StringPtr(""), + VMSwitchType: armhybridnetwork.VMSwitchTypeWan.ToPtr(), + }}, + OSProfile: &armhybridnetwork.OsProfile{ + AdminUsername: to.StringPtr(""), + CustomData: to.StringPtr(""), + LinuxConfiguration: &armhybridnetwork.LinuxConfiguration{ + SSH: &armhybridnetwork.SSHConfiguration{ + PublicKeys: []*armhybridnetwork.SSHPublicKey{ + { + Path: to.StringPtr(""), + KeyData: to.StringPtr(""), + }}, + }, + }, + }, + RoleName: to.StringPtr(""), + UserDataParameters: map[string]interface{}{}, + }}, + SKUType: armhybridnetwork.SKUTypeSDWAN.ToPtr(), + VendorProvisioningState: armhybridnetwork.VendorProvisioningStateProvisioning.ToPtr(), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("VendorNetworkFunction.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorNfListByVendor.json +func ExampleVendorNetworkFunctionsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorNetworkFunctionsClient("", cred, nil) + pager := client.List("", + "", + &armhybridnetwork.VendorNetworkFunctionsListOptions{Filter: nil}) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("VendorNetworkFunction.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendors_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendors_client_test.go new file mode 100644 index 000000000000..985e581d1013 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendors_client_test.go @@ -0,0 +1,96 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorDelete.json +func ExampleVendorsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorsClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorGet.json +func ExampleVendorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorsClient("", cred, nil) + res, err := client.Get(ctx, + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Vendor.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorCreate.json +func ExampleVendorsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorsClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + &armhybridnetwork.VendorsBeginCreateOrUpdateOptions{Parameters: &armhybridnetwork.Vendor{}}) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("Vendor.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorListBySubscription.json +func ExampleVendorsClient_ListBySubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorsClient("", cred, nil) + pager := client.ListBySubscription(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("Vendor.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskupreview_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskupreview_client_test.go new file mode 100644 index 000000000000..5c1277b16253 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskupreview_client_test.go @@ -0,0 +1,105 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuPreviewListBySku.json +func ExampleVendorSKUPreviewClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUPreviewClient("", cred, nil) + pager := client.List("", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("PreviewSubscription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuPreviewCreate.json +func ExampleVendorSKUPreviewClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUPreviewClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armhybridnetwork.PreviewSubscription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PreviewSubscription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuPreviewGet.json +func ExampleVendorSKUPreviewClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUPreviewClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PreviewSubscription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuPreviewDelete.json +func ExampleVendorSKUPreviewClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUPreviewClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskus_client_test.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskus_client_test.go new file mode 100644 index 000000000000..9332a7c5450d --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/ze_generated_example_vendorskus_client_test.go @@ -0,0 +1,183 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridnetwork/armhybridnetwork" +) + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuDelete.json +func ExampleVendorSKUsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUsClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuGet.json +func ExampleVendorSKUsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("VendorSKU.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuCreate.json +func ExampleVendorSKUsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUsClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armhybridnetwork.VendorSKU{ + Properties: &armhybridnetwork.VendorSKUPropertiesFormat{ + DeploymentMode: armhybridnetwork.SKUDeploymentModePrivateEdgeZone.ToPtr(), + ManagedApplicationTemplate: map[string]interface{}{}, + NetworkFunctionTemplate: &armhybridnetwork.NetworkFunctionTemplate{ + NetworkFunctionRoleConfigurations: []*armhybridnetwork.NetworkFunctionRoleConfiguration{ + { + CustomProfile: &armhybridnetwork.CustomProfile{ + MetadataConfigurationPath: to.StringPtr(""), + }, + NetworkInterfaces: []*armhybridnetwork.NetworkInterface{ + { + IPConfigurations: []*armhybridnetwork.NetworkInterfaceIPConfiguration{ + { + DNSServers: []*string{}, + Gateway: to.StringPtr(""), + IPAddress: to.StringPtr(""), + IPAllocationMethod: armhybridnetwork.IPAllocationMethodDynamic.ToPtr(), + IPVersion: armhybridnetwork.IPVersionIPv4.ToPtr(), + Subnet: to.StringPtr(""), + }}, + MacAddress: to.StringPtr(""), + NetworkInterfaceName: to.StringPtr(""), + VMSwitchType: armhybridnetwork.VMSwitchTypeWan.ToPtr(), + }, + { + IPConfigurations: []*armhybridnetwork.NetworkInterfaceIPConfiguration{ + { + DNSServers: []*string{}, + Gateway: to.StringPtr(""), + IPAddress: to.StringPtr(""), + IPAllocationMethod: armhybridnetwork.IPAllocationMethodDynamic.ToPtr(), + IPVersion: armhybridnetwork.IPVersionIPv4.ToPtr(), + Subnet: to.StringPtr(""), + }}, + MacAddress: to.StringPtr(""), + NetworkInterfaceName: to.StringPtr(""), + VMSwitchType: armhybridnetwork.VMSwitchTypeManagement.ToPtr(), + }}, + OSProfile: &armhybridnetwork.OsProfile{ + AdminUsername: to.StringPtr(""), + CustomData: to.StringPtr(""), + LinuxConfiguration: &armhybridnetwork.LinuxConfiguration{ + SSH: &armhybridnetwork.SSHConfiguration{ + PublicKeys: []*armhybridnetwork.SSHPublicKey{ + { + Path: to.StringPtr(""), + KeyData: to.StringPtr(""), + }}, + }, + }, + }, + RoleName: to.StringPtr(""), + RoleType: armhybridnetwork.NetworkFunctionRoleConfigurationTypeVirtualMachine.ToPtr(), + StorageProfile: &armhybridnetwork.StorageProfile{ + DataDisks: []*armhybridnetwork.DataDisk{ + { + Name: to.StringPtr(""), + CreateOption: armhybridnetwork.DiskCreateOptionTypesEmpty.ToPtr(), + DiskSizeGB: to.Int32Ptr(10), + }}, + ImageReference: &armhybridnetwork.ImageReference{ + Offer: to.StringPtr(""), + Publisher: to.StringPtr(""), + SKU: to.StringPtr(""), + Version: to.StringPtr(""), + }, + OSDisk: &armhybridnetwork.OsDisk{ + Name: to.StringPtr(""), + DiskSizeGB: to.Int32Ptr(30), + OSType: armhybridnetwork.OperatingSystemTypesLinux.ToPtr(), + Vhd: &armhybridnetwork.VirtualHardDisk{ + URI: to.StringPtr(""), + }, + }, + }, + VirtualMachineSize: armhybridnetwork.VirtualMachineSizeTypesStandardD3V2.ToPtr(), + }}, + }, + Preview: to.BoolPtr(true), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("VendorSKU.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2021-05-01/examples/VendorSkuListByVendor.json +func ExampleVendorSKUsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhybridnetwork.NewVendorSKUsClient("", cred, nil) + pager := client.List("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("VendorSKU.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_constants.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_constants.go new file mode 100644 index 000000000000..362ecc2f5512 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_constants.go @@ -0,0 +1,448 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +const ( + module = "armhybridnetwork" + version = "v0.1.0" +) + +// 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, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// DeviceType - The type of the device. +type DeviceType string + +const ( + DeviceTypeAzureStackEdge DeviceType = "AzureStackEdge" + DeviceTypeUnknown DeviceType = "Unknown" +) + +// PossibleDeviceTypeValues returns the possible values for the DeviceType const type. +func PossibleDeviceTypeValues() []DeviceType { + return []DeviceType{ + DeviceTypeAzureStackEdge, + DeviceTypeUnknown, + } +} + +// ToPtr returns a *DeviceType pointing to the current value. +func (c DeviceType) ToPtr() *DeviceType { + return &c +} + +// DiskCreateOptionTypes - Specifies how the virtual machine should be created. +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesUnknown DiskCreateOptionTypes = "Unknown" +) + +// PossibleDiskCreateOptionTypesValues returns the possible values for the DiskCreateOptionTypes const type. +func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { + return []DiskCreateOptionTypes{ + DiskCreateOptionTypesEmpty, + DiskCreateOptionTypesUnknown, + } +} + +// ToPtr returns a *DiskCreateOptionTypes pointing to the current value. +func (c DiskCreateOptionTypes) ToPtr() *DiskCreateOptionTypes { + return &c +} + +// IPAllocationMethod - IP address allocation method. +type IPAllocationMethod string + +const ( + IPAllocationMethodDynamic IPAllocationMethod = "Dynamic" + IPAllocationMethodStatic IPAllocationMethod = "Static" + IPAllocationMethodUnknown IPAllocationMethod = "Unknown" +) + +// PossibleIPAllocationMethodValues returns the possible values for the IPAllocationMethod const type. +func PossibleIPAllocationMethodValues() []IPAllocationMethod { + return []IPAllocationMethod{ + IPAllocationMethodDynamic, + IPAllocationMethodStatic, + IPAllocationMethodUnknown, + } +} + +// ToPtr returns a *IPAllocationMethod pointing to the current value. +func (c IPAllocationMethod) ToPtr() *IPAllocationMethod { + return &c +} + +// IPVersion - IP address version. +type IPVersion string + +const ( + IPVersionIPv4 IPVersion = "IPv4" + IPVersionUnknown IPVersion = "Unknown" +) + +// PossibleIPVersionValues returns the possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{ + IPVersionIPv4, + IPVersionUnknown, + } +} + +// ToPtr returns a *IPVersion pointing to the current value. +func (c IPVersion) ToPtr() *IPVersion { + return &c +} + +// NetworkFunctionRoleConfigurationType - Role type. +type NetworkFunctionRoleConfigurationType string + +const ( + NetworkFunctionRoleConfigurationTypeUnknown NetworkFunctionRoleConfigurationType = "Unknown" + NetworkFunctionRoleConfigurationTypeVirtualMachine NetworkFunctionRoleConfigurationType = "VirtualMachine" +) + +// PossibleNetworkFunctionRoleConfigurationTypeValues returns the possible values for the NetworkFunctionRoleConfigurationType const type. +func PossibleNetworkFunctionRoleConfigurationTypeValues() []NetworkFunctionRoleConfigurationType { + return []NetworkFunctionRoleConfigurationType{ + NetworkFunctionRoleConfigurationTypeUnknown, + NetworkFunctionRoleConfigurationTypeVirtualMachine, + } +} + +// ToPtr returns a *NetworkFunctionRoleConfigurationType pointing to the current value. +func (c NetworkFunctionRoleConfigurationType) ToPtr() *NetworkFunctionRoleConfigurationType { + return &c +} + +// NetworkFunctionType - The network function type. +type NetworkFunctionType string + +const ( + NetworkFunctionTypeContainerizedNetworkFunction NetworkFunctionType = "ContainerizedNetworkFunction" + NetworkFunctionTypeUnknown NetworkFunctionType = "Unknown" + NetworkFunctionTypeVirtualNetworkFunction NetworkFunctionType = "VirtualNetworkFunction" +) + +// PossibleNetworkFunctionTypeValues returns the possible values for the NetworkFunctionType const type. +func PossibleNetworkFunctionTypeValues() []NetworkFunctionType { + return []NetworkFunctionType{ + NetworkFunctionTypeContainerizedNetworkFunction, + NetworkFunctionTypeUnknown, + NetworkFunctionTypeVirtualNetworkFunction, + } +} + +// ToPtr returns a *NetworkFunctionType pointing to the current value. +func (c NetworkFunctionType) ToPtr() *NetworkFunctionType { + return &c +} + +// OperatingSystemTypes - The OS type. +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesUnknown OperatingSystemTypes = "Unknown" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +// PossibleOperatingSystemTypesValues returns the possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{ + OperatingSystemTypesLinux, + OperatingSystemTypesUnknown, + OperatingSystemTypesWindows, + } +} + +// ToPtr returns a *OperatingSystemTypes pointing to the current value. +func (c OperatingSystemTypes) ToPtr() *OperatingSystemTypes { + return &c +} + +// OperationalState - The operational state of the role instance. +type OperationalState string + +const ( + OperationalStateRunning OperationalState = "Running" + OperationalStateStarting OperationalState = "Starting" + OperationalStateStopped OperationalState = "Stopped" + OperationalStateStopping OperationalState = "Stopping" + OperationalStateUnknown OperationalState = "Unknown" +) + +// PossibleOperationalStateValues returns the possible values for the OperationalState const type. +func PossibleOperationalStateValues() []OperationalState { + return []OperationalState{ + OperationalStateRunning, + OperationalStateStarting, + OperationalStateStopped, + OperationalStateStopping, + OperationalStateUnknown, + } +} + +// ToPtr returns a *OperationalState pointing to the current value. +func (c OperationalState) ToPtr() *OperationalState { + return &c +} + +// ProvisioningState - The current provisioning state. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleted, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUnknown, + } +} + +// ToPtr returns a *ProvisioningState pointing to the current value. +func (c ProvisioningState) ToPtr() *ProvisioningState { + return &c +} + +// SKUDeploymentMode - The sku deployment mode. +type SKUDeploymentMode string + +const ( + SKUDeploymentModeAzure SKUDeploymentMode = "Azure" + SKUDeploymentModePrivateEdgeZone SKUDeploymentMode = "PrivateEdgeZone" + SKUDeploymentModeUnknown SKUDeploymentMode = "Unknown" +) + +// PossibleSKUDeploymentModeValues returns the possible values for the SKUDeploymentMode const type. +func PossibleSKUDeploymentModeValues() []SKUDeploymentMode { + return []SKUDeploymentMode{ + SKUDeploymentModeAzure, + SKUDeploymentModePrivateEdgeZone, + SKUDeploymentModeUnknown, + } +} + +// ToPtr returns a *SKUDeploymentMode pointing to the current value. +func (c SKUDeploymentMode) ToPtr() *SKUDeploymentMode { + return &c +} + +// SKUType - Sku type. +type SKUType string + +const ( + SKUTypeEvolvedPacketCore SKUType = "EvolvedPacketCore" + SKUTypeFirewall SKUType = "Firewall" + SKUTypeSDWAN SKUType = "SDWAN" + SKUTypeUnknown SKUType = "Unknown" +) + +// PossibleSKUTypeValues returns the possible values for the SKUType const type. +func PossibleSKUTypeValues() []SKUType { + return []SKUType{ + SKUTypeEvolvedPacketCore, + SKUTypeFirewall, + SKUTypeSDWAN, + SKUTypeUnknown, + } +} + +// ToPtr returns a *SKUType pointing to the current value. +func (c SKUType) ToPtr() *SKUType { + return &c +} + +// Status - The current device status. +type Status string + +const ( + StatusDeleted Status = "Deleted" + StatusNotRegistered Status = "NotRegistered" + StatusRegistered Status = "Registered" + StatusUnknown Status = "Unknown" +) + +// PossibleStatusValues returns the possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ + StatusDeleted, + StatusNotRegistered, + StatusRegistered, + StatusUnknown, + } +} + +// ToPtr returns a *Status pointing to the current value. +func (c Status) ToPtr() *Status { + return &c +} + +// VMSwitchType - The type of the VM switch. +type VMSwitchType string + +const ( + VMSwitchTypeLan VMSwitchType = "Lan" + VMSwitchTypeManagement VMSwitchType = "Management" + VMSwitchTypeUnknown VMSwitchType = "Unknown" + VMSwitchTypeWan VMSwitchType = "Wan" +) + +// PossibleVMSwitchTypeValues returns the possible values for the VMSwitchType const type. +func PossibleVMSwitchTypeValues() []VMSwitchType { + return []VMSwitchType{ + VMSwitchTypeLan, + VMSwitchTypeManagement, + VMSwitchTypeUnknown, + VMSwitchTypeWan, + } +} + +// ToPtr returns a *VMSwitchType pointing to the current value. +func (c VMSwitchType) ToPtr() *VMSwitchType { + return &c +} + +// VendorProvisioningState - The current vendor provisioning state. +type VendorProvisioningState string + +const ( + VendorProvisioningStateDeprovisioned VendorProvisioningState = "Deprovisioned" + VendorProvisioningStateNotProvisioned VendorProvisioningState = "NotProvisioned" + VendorProvisioningStateProvisioned VendorProvisioningState = "Provisioned" + VendorProvisioningStateProvisioning VendorProvisioningState = "Provisioning" + VendorProvisioningStateUnknown VendorProvisioningState = "Unknown" + VendorProvisioningStateUserDataValidationFailed VendorProvisioningState = "UserDataValidationFailed" +) + +// PossibleVendorProvisioningStateValues returns the possible values for the VendorProvisioningState const type. +func PossibleVendorProvisioningStateValues() []VendorProvisioningState { + return []VendorProvisioningState{ + VendorProvisioningStateDeprovisioned, + VendorProvisioningStateNotProvisioned, + VendorProvisioningStateProvisioned, + VendorProvisioningStateProvisioning, + VendorProvisioningStateUnknown, + VendorProvisioningStateUserDataValidationFailed, + } +} + +// ToPtr returns a *VendorProvisioningState pointing to the current value. +func (c VendorProvisioningState) ToPtr() *VendorProvisioningState { + return &c +} + +// VirtualMachineSizeTypes - The size of the virtual machine. +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesStandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardF1 VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardF16 VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardF16S VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardF1S VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardF2 VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardF2S VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardF4 VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardF4S VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardF8 VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardF8S VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesUnknown VirtualMachineSizeTypes = "Unknown" +) + +// PossibleVirtualMachineSizeTypesValues returns the possible values for the VirtualMachineSizeTypes const type. +func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes { + return []VirtualMachineSizeTypes{ + VirtualMachineSizeTypesStandardD11V2, + VirtualMachineSizeTypesStandardD12V2, + VirtualMachineSizeTypesStandardD13V2, + VirtualMachineSizeTypesStandardD1V2, + VirtualMachineSizeTypesStandardD2V2, + VirtualMachineSizeTypesStandardD3V2, + VirtualMachineSizeTypesStandardD4V2, + VirtualMachineSizeTypesStandardD5V2, + VirtualMachineSizeTypesStandardDS11V2, + VirtualMachineSizeTypesStandardDS12V2, + VirtualMachineSizeTypesStandardDS13V2, + VirtualMachineSizeTypesStandardDS1V2, + VirtualMachineSizeTypesStandardDS2V2, + VirtualMachineSizeTypesStandardDS3V2, + VirtualMachineSizeTypesStandardDS4V2, + VirtualMachineSizeTypesStandardDS5V2, + VirtualMachineSizeTypesStandardF1, + VirtualMachineSizeTypesStandardF16, + VirtualMachineSizeTypesStandardF16S, + VirtualMachineSizeTypesStandardF1S, + VirtualMachineSizeTypesStandardF2, + VirtualMachineSizeTypesStandardF2S, + VirtualMachineSizeTypesStandardF4, + VirtualMachineSizeTypesStandardF4S, + VirtualMachineSizeTypesStandardF8, + VirtualMachineSizeTypesStandardF8S, + VirtualMachineSizeTypesUnknown, + } +} + +// ToPtr returns a *VirtualMachineSizeTypes pointing to the current value. +func (c VirtualMachineSizeTypes) ToPtr() *VirtualMachineSizeTypes { + return &c +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_devices_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_devices_client.go new file mode 100644 index 000000000000..3568a6d49e1b --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_devices_client.go @@ -0,0 +1,502 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// DevicesClient contains the methods for the Devices group. +// Don't use this type directly, use NewDevicesClient() instead. +type DevicesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewDevicesClient creates a new instance of DevicesClient with the specified values. +func NewDevicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DevicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DevicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a device. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deviceName string, parameters Device, options *DevicesBeginCreateOrUpdateOptions) (DevicesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, deviceName, parameters, options) + if err != nil { + return DevicesCreateOrUpdatePollerResponse{}, err + } + result := DevicesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return DevicesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &DevicesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a device. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, deviceName string, parameters Device, options *DevicesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deviceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DevicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deviceName string, parameters Device, options *DevicesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *DevicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the specified device. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) BeginDelete(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesBeginDeleteOptions) (DevicesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, deviceName, options) + if err != nil { + return DevicesDeletePollerResponse{}, err + } + result := DevicesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DevicesClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return DevicesDeletePollerResponse{}, err + } + result.Poller = &DevicesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the specified device. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) deleteOperation(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, deviceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DevicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *DevicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified device. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) Get(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesGetOptions) (DevicesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, deviceName, options) + if err != nil { + return DevicesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DevicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DevicesClient) getHandleResponse(resp *http.Response) (DevicesGetResponse, error) { + result := DevicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Device); err != nil { + return DevicesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *DevicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Lists all the device resource in a resource group. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) ListByResourceGroup(resourceGroupName string, options *DevicesListByResourceGroupOptions) *DevicesListByResourceGroupPager { + return &DevicesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp DevicesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DeviceListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DevicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DevicesListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DevicesClient) listByResourceGroupHandleResponse(resp *http.Response) (DevicesListByResourceGroupResponse, error) { + result := DevicesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DeviceListResult); err != nil { + return DevicesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *DevicesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Lists all the devices in a subscription. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) ListBySubscription(options *DevicesListBySubscriptionOptions) *DevicesListBySubscriptionPager { + return &DevicesListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp DevicesListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DeviceListResult.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DevicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DevicesListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices" + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DevicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DevicesListBySubscriptionResponse, error) { + result := DevicesListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DeviceListResult); err != nil { + return DevicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *DevicesClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListRegistrationKey - List the registration key for the device. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) ListRegistrationKey(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesListRegistrationKeyOptions) (DevicesListRegistrationKeyResponse, error) { + req, err := client.listRegistrationKeyCreateRequest(ctx, resourceGroupName, deviceName, options) + if err != nil { + return DevicesListRegistrationKeyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesListRegistrationKeyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesListRegistrationKeyResponse{}, client.listRegistrationKeyHandleError(resp) + } + return client.listRegistrationKeyHandleResponse(resp) +} + +// listRegistrationKeyCreateRequest creates the ListRegistrationKey request. +func (client *DevicesClient) listRegistrationKeyCreateRequest(ctx context.Context, resourceGroupName string, deviceName string, options *DevicesListRegistrationKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}/listRegistrationKey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listRegistrationKeyHandleResponse handles the ListRegistrationKey response. +func (client *DevicesClient) listRegistrationKeyHandleResponse(resp *http.Response) (DevicesListRegistrationKeyResponse, error) { + result := DevicesListRegistrationKeyResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DeviceRegistrationKey); err != nil { + return DevicesListRegistrationKeyResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listRegistrationKeyHandleError handles the ListRegistrationKey error response. +func (client *DevicesClient) listRegistrationKeyHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// UpdateTags - Updates device tags. +// If the operation fails it returns the *ErrorResponse error type. +func (client *DevicesClient) UpdateTags(ctx context.Context, resourceGroupName string, deviceName string, parameters TagsObject, options *DevicesUpdateTagsOptions) (DevicesUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, deviceName, parameters, options) + if err != nil { + return DevicesUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DevicesUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DevicesUpdateTagsResponse{}, client.updateTagsHandleError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *DevicesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, deviceName string, parameters TagsObject, options *DevicesUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deviceName == "" { + return nil, errors.New("parameter deviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deviceName}", url.PathEscape(deviceName)) + 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.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *DevicesClient) updateTagsHandleResponse(resp *http.Response) (DevicesUpdateTagsResponse, error) { + result := DevicesUpdateTagsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Device); err != nil { + return DevicesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateTagsHandleError handles the UpdateTags error response. +func (client *DevicesClient) updateTagsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_models.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_models.go new file mode 100644 index 000000000000..2e06079ac835 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_models.go @@ -0,0 +1,1610 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// AzureStackEdgeFormat - The reference to the Azure stack edge device. +type AzureStackEdgeFormat struct { + DevicePropertiesFormat + // REQUIRED; The reference to the Azure stack edge device. + AzureStackEdge *SubResource `json:"azureStackEdge,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureStackEdgeFormat. +func (a AzureStackEdgeFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.DevicePropertiesFormat.marshalInternal(objectMap, DeviceTypeAzureStackEdge) + populate(objectMap, "azureStackEdge", a.AzureStackEdge) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStackEdgeFormat. +func (a *AzureStackEdgeFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "azureStackEdge": + err = unpopulate(val, &a.AzureStackEdge) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.DevicePropertiesFormat.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CustomProfile - Specifies the custom settings for the virtual machine. +type CustomProfile struct { + // Path for metadata configuration. + MetadataConfigurationPath *string `json:"metadataConfigurationPath,omitempty"` +} + +// DataDisk - Specifies information about the operating system disk used by the virtual machine. +// For more information about disks, see About disks and VHDs for Azure virtual machines +// [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json]. +type DataDisk struct { + // Specifies how the virtual machine should be created. + CreateOption *DiskCreateOptionTypes `json:"createOption,omitempty"` + + // Specifies the size of an empty disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The name of data disk. + Name *string `json:"name,omitempty"` +} + +// Device resource. +type Device struct { + TrackedResource + // Device properties. + Properties DevicePropertiesFormatClassification `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Device. +func (d Device) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Device. +func (d *Device) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + d.Properties, err = unmarshalDevicePropertiesFormatClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &d.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.TrackedResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DeviceListResult - Response for devices API service call. +type DeviceListResult struct { + // A list of devices. + Value []*Device `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DeviceListResult. +func (d DeviceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// DevicePropertiesFormatClassification provides polymorphic access to related types. +// Call the interface's GetDevicePropertiesFormat() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureStackEdgeFormat, *DevicePropertiesFormat +type DevicePropertiesFormatClassification interface { + // GetDevicePropertiesFormat returns the DevicePropertiesFormat content of the underlying type. + GetDevicePropertiesFormat() *DevicePropertiesFormat +} + +// DevicePropertiesFormat - Device properties. +type DevicePropertiesFormat struct { + // REQUIRED; The type of the device. + DeviceType *DeviceType `json:"deviceType,omitempty"` + + // READ-ONLY; The list of network functions deployed on the device. + NetworkFunctions []*SubResource `json:"networkFunctions,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the device resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The current device status. + Status *Status `json:"status,omitempty" azure:"ro"` +} + +// GetDevicePropertiesFormat implements the DevicePropertiesFormatClassification interface for type DevicePropertiesFormat. +func (d *DevicePropertiesFormat) GetDevicePropertiesFormat() *DevicePropertiesFormat { return d } + +// UnmarshalJSON implements the json.Unmarshaller interface for type DevicePropertiesFormat. +func (d *DevicePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return d.unmarshalInternal(rawMsg) +} + +func (d DevicePropertiesFormat) marshalInternal(objectMap map[string]interface{}, discValue DeviceType) { + d.DeviceType = &discValue + objectMap["deviceType"] = d.DeviceType + populate(objectMap, "networkFunctions", d.NetworkFunctions) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "status", d.Status) +} + +func (d *DevicePropertiesFormat) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "deviceType": + err = unpopulate(val, &d.DeviceType) + delete(rawMsg, key) + case "networkFunctions": + err = unpopulate(val, &d.NetworkFunctions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &d.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &d.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// DeviceRegistrationKey - The device registration key. +type DeviceRegistrationKey struct { + // READ-ONLY; The registration key for the device. + RegistrationKey *string `json:"registrationKey,omitempty" azure:"ro"` +} + +// DevicesBeginCreateOrUpdateOptions contains the optional parameters for the Devices.BeginCreateOrUpdate method. +type DevicesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DevicesBeginDeleteOptions contains the optional parameters for the Devices.BeginDelete method. +type DevicesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// DevicesGetOptions contains the optional parameters for the Devices.Get method. +type DevicesGetOptions struct { + // placeholder for future optional parameters +} + +// DevicesListByResourceGroupOptions contains the optional parameters for the Devices.ListByResourceGroup method. +type DevicesListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DevicesListBySubscriptionOptions contains the optional parameters for the Devices.ListBySubscription method. +type DevicesListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// DevicesListRegistrationKeyOptions contains the optional parameters for the Devices.ListRegistrationKey method. +type DevicesListRegistrationKeyOptions struct { + // placeholder for future optional parameters +} + +// DevicesUpdateTagsOptions contains the optional parameters for the Devices.UpdateTags method. +type DevicesUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData +// error response format.). +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorResponse struct { + raw string + // The error object. + InnerError *ErrorDetail `json:"error,omitempty"` +} + +// Error implements the error interface for type ErrorResponse. +// The contents of the error text are not contractual and subject to change. +func (e ErrorResponse) Error() string { + return e.raw +} + +// ImageReference - The image reference properties. +type ImageReference struct { + // Specifies in decimal numbers, the exact version of image used to create the virtual machine. + ExactVersion *string `json:"exactVersion,omitempty"` + + // Specifies the offer of the image used to create the virtual machine. + Offer *string `json:"offer,omitempty"` + + // The image publisher. + Publisher *string `json:"publisher,omitempty"` + + // The image SKU. + SKU *string `json:"sku,omitempty"` + + // Specifies the version of the image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build + // are decimal numbers. Specify 'latest' to use the + // latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a + // new version becomes available. + Version *string `json:"version,omitempty"` +} + +// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. +type LinuxConfiguration struct { + // Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// NetworkFunction - Network function resource response. +type NetworkFunction struct { + TrackedResource + // A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + + // Network function properties. + Properties *NetworkFunctionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunction. +func (n NetworkFunction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + n.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "etag", n.Etag) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunction. +func (n *NetworkFunction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, &n.Etag) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &n.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := n.TrackedResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// NetworkFunctionListResult - Response for network function API service call. +type NetworkFunctionListResult struct { + // A list of network function resources in a subscription or resource group. + Value []*NetworkFunction `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionListResult. +func (n NetworkFunctionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NetworkFunctionPropertiesFormat - Network function properties. +type NetworkFunctionPropertiesFormat struct { + // The reference to the device resource. Once set, it cannot be updated. + Device *SubResource `json:"device,omitempty"` + + // The parameters for the managed application. + ManagedApplicationParameters map[string]interface{} `json:"managedApplicationParameters,omitempty"` + + // The network function container configurations from the user. + NetworkFunctionContainerConfigurations map[string]interface{} `json:"networkFunctionContainerConfigurations,omitempty"` + + // The network function configurations from the user. + NetworkFunctionUserConfigurations []*NetworkFunctionUserConfiguration `json:"networkFunctionUserConfigurations,omitempty"` + + // The sku name for the network function. Once set, it cannot be updated. + SKUName *string `json:"skuName,omitempty"` + + // The vendor name for the network function. Once set, it cannot be updated. + VendorName *string `json:"vendorName,omitempty"` + + // READ-ONLY; The resource URI of the managed application. + ManagedApplication *SubResource `json:"managedApplication,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the network function resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The sku type for the network function. + SKUType *SKUType `json:"skuType,omitempty" azure:"ro"` + + // READ-ONLY; The service key for the network function resource. + ServiceKey *string `json:"serviceKey,omitempty" azure:"ro"` + + // READ-ONLY; The vendor provisioning state for the network function resource. + VendorProvisioningState *VendorProvisioningState `json:"vendorProvisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionPropertiesFormat. +func (n NetworkFunctionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "device", n.Device) + populate(objectMap, "managedApplication", n.ManagedApplication) + populate(objectMap, "managedApplicationParameters", n.ManagedApplicationParameters) + populate(objectMap, "networkFunctionContainerConfigurations", n.NetworkFunctionContainerConfigurations) + populate(objectMap, "networkFunctionUserConfigurations", n.NetworkFunctionUserConfigurations) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "skuName", n.SKUName) + populate(objectMap, "skuType", n.SKUType) + populate(objectMap, "serviceKey", n.ServiceKey) + populate(objectMap, "vendorName", n.VendorName) + populate(objectMap, "vendorProvisioningState", n.VendorProvisioningState) + return json.Marshal(objectMap) +} + +// NetworkFunctionRoleConfiguration - Network function role configuration. +type NetworkFunctionRoleConfiguration struct { + // Specifies the custom settings for the virtual machine. + CustomProfile *CustomProfile `json:"customProfile,omitempty"` + + // The network interface configurations. + NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` + + // Specifies the operating system settings for the role instance. This value can be updated during the deployment of network function. + OSProfile *OsProfile `json:"osProfile,omitempty"` + + // The name of the network function role. + RoleName *string `json:"roleName,omitempty"` + + // Role type. + RoleType *NetworkFunctionRoleConfigurationType `json:"roleType,omitempty"` + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + + // The user parameters for customers. The format of user data parameters has to be matched with the provided user data template. + UserDataParameters map[string]interface{} `json:"userDataParameters,omitempty"` + + // The user data template for customers. This is a json schema template describing the format and data type of user data parameters. + UserDataTemplate map[string]interface{} `json:"userDataTemplate,omitempty"` + + // The size of the virtual machine. + VirtualMachineSize *VirtualMachineSizeTypes `json:"virtualMachineSize,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionRoleConfiguration. +func (n NetworkFunctionRoleConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customProfile", n.CustomProfile) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + populate(objectMap, "osProfile", n.OSProfile) + populate(objectMap, "roleName", n.RoleName) + populate(objectMap, "roleType", n.RoleType) + populate(objectMap, "storageProfile", n.StorageProfile) + populate(objectMap, "userDataParameters", n.UserDataParameters) + populate(objectMap, "userDataTemplate", n.UserDataTemplate) + populate(objectMap, "virtualMachineSize", n.VirtualMachineSize) + return json.Marshal(objectMap) +} + +// NetworkFunctionRoleInstanceListResult - List of role instances of vendor network function. +type NetworkFunctionRoleInstanceListResult struct { + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of role instances. + Value []*RoleInstance `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionRoleInstanceListResult. +func (n NetworkFunctionRoleInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NetworkFunctionSKUDetails - The network function sku details. +type NetworkFunctionSKUDetails struct { + // The network function sku type. + SKUType *SKUType `json:"skuType,omitempty"` + + // The network function sku role details. + Value []*NetworkFunctionSKURoleDetails `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionSKUDetails. +func (n NetworkFunctionSKUDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "skuType", n.SKUType) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NetworkFunctionSKUListResult - A list of available network function skus. +type NetworkFunctionSKUListResult struct { + // The network function vendor sku overview properties. + Value []*SKUOverview `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionSKUListResult. +func (n NetworkFunctionSKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NetworkFunctionSKURoleDetails - The network function user configuration. +type NetworkFunctionSKURoleDetails struct { + // The network interface configuration. + NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` + + // The name of the network function role. + RoleName *string `json:"roleName,omitempty"` + + // The user parameters for customers. + UserDataParameters map[string]interface{} `json:"userDataParameters,omitempty"` + + // The user data template for customers. + UserDataTemplate map[string]interface{} `json:"userDataTemplate,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionSKURoleDetails. +func (n NetworkFunctionSKURoleDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + populate(objectMap, "roleName", n.RoleName) + populate(objectMap, "userDataParameters", n.UserDataParameters) + populate(objectMap, "userDataTemplate", n.UserDataTemplate) + return json.Marshal(objectMap) +} + +// NetworkFunctionTemplate - The network function template. +type NetworkFunctionTemplate struct { + // An array of network function role definitions. + NetworkFunctionRoleConfigurations []*NetworkFunctionRoleConfiguration `json:"networkFunctionRoleConfigurations,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionTemplate. +func (n NetworkFunctionTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkFunctionRoleConfigurations", n.NetworkFunctionRoleConfigurations) + return json.Marshal(objectMap) +} + +// NetworkFunctionUserConfiguration - The network function user configuration. +type NetworkFunctionUserConfiguration struct { + // The network interface configuration. + NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` + + // Specifies the operating system settings for the role instance. + OSProfile *NetworkFunctionUserConfigurationOsProfile `json:"osProfile,omitempty"` + + // The name of the network function role. + RoleName *string `json:"roleName,omitempty"` + + // The user data parameters from the customer. + UserDataParameters map[string]interface{} `json:"userDataParameters,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionUserConfiguration. +func (n NetworkFunctionUserConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + populate(objectMap, "osProfile", n.OSProfile) + populate(objectMap, "roleName", n.RoleName) + populate(objectMap, "userDataParameters", n.UserDataParameters) + return json.Marshal(objectMap) +} + +// NetworkFunctionUserConfigurationOsProfile - Specifies the operating system settings for the role instance. +type NetworkFunctionUserConfigurationOsProfile struct { + // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the virtual machine. + // The maximum length of the binary array is + // 65535 bytes. + // Note: Do not pass any secrets or passwords in customData property + // This property cannot be updated after the VM is created. + // customData is passed to the VM to be saved as a file. For more information see Custom Data on Azure VMs [https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/] + // For using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json] + CustomData *string `json:"customData,omitempty"` +} + +// NetworkFunctionVendor - The network function vendor. +type NetworkFunctionVendor struct { + // Vendors of Hybrid Network service provider. + Properties *VendorDetails `json:"properties,omitempty"` +} + +// NetworkFunctionVendorConfiguration - Network function vendor configuration. +type NetworkFunctionVendorConfiguration struct { + // The network interface configurations. + NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` + + // Specifies the operating system settings for the role instance. + OSProfile *OsProfile `json:"osProfile,omitempty"` + + // The name of the vendor network function role. + RoleName *string `json:"roleName,omitempty"` + + // READ-ONLY; The user parameters from the customer. + UserDataParameters map[string]interface{} `json:"userDataParameters,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionVendorConfiguration. +func (n NetworkFunctionVendorConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + populate(objectMap, "osProfile", n.OSProfile) + populate(objectMap, "roleName", n.RoleName) + populate(objectMap, "userDataParameters", n.UserDataParameters) + return json.Marshal(objectMap) +} + +// NetworkFunctionVendorListResult - The network function vendor list result. +type NetworkFunctionVendorListResult struct { + // A list of available network function vendors and skus. + Value []*NetworkFunctionVendor `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionVendorListResult. +func (n NetworkFunctionVendorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NetworkFunctionVendorSKUsListBySKUOptions contains the optional parameters for the NetworkFunctionVendorSKUs.ListBySKU method. +type NetworkFunctionVendorSKUsListBySKUOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionVendorSKUsListByVendorOptions contains the optional parameters for the NetworkFunctionVendorSKUs.ListByVendor method. +type NetworkFunctionVendorSKUsListByVendorOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionVendorsListOptions contains the optional parameters for the NetworkFunctionVendors.List method. +type NetworkFunctionVendorsListOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsBeginCreateOrUpdateOptions contains the optional parameters for the NetworkFunctions.BeginCreateOrUpdate method. +type NetworkFunctionsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsBeginDeleteOptions contains the optional parameters for the NetworkFunctions.BeginDelete method. +type NetworkFunctionsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsGetOptions contains the optional parameters for the NetworkFunctions.Get method. +type NetworkFunctionsGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsListByResourceGroupOptions contains the optional parameters for the NetworkFunctions.ListByResourceGroup method. +type NetworkFunctionsListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsListBySubscriptionOptions contains the optional parameters for the NetworkFunctions.ListBySubscription method. +type NetworkFunctionsListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsUpdateTagsOptions contains the optional parameters for the NetworkFunctions.UpdateTags method. +type NetworkFunctionsUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// NetworkInterface - Network interface properties. +type NetworkInterface struct { + // A list of IP configurations of the network interface. + IPConfigurations []*NetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + + // The MAC address of the network interface. + MacAddress *string `json:"macAddress,omitempty"` + + // The name of the network interface. + NetworkInterfaceName *string `json:"networkInterfaceName,omitempty"` + + // The type of the VM switch. + VMSwitchType *VMSwitchType `json:"vmSwitchType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. +func (n NetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipConfigurations", n.IPConfigurations) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "networkInterfaceName", n.NetworkInterfaceName) + populate(objectMap, "vmSwitchType", n.VMSwitchType) + return json.Marshal(objectMap) +} + +// NetworkInterfaceIPConfiguration - Network interface IP configuration properties. +type NetworkInterfaceIPConfiguration struct { + // The list of DNS servers IP addresses. + DNSServers []*string `json:"dnsServers,omitempty"` + + // The value of the gateway. + Gateway *string `json:"gateway,omitempty"` + + // The value of the IP address. + IPAddress *string `json:"ipAddress,omitempty"` + + // IP address allocation method. + IPAllocationMethod *IPAllocationMethod `json:"ipAllocationMethod,omitempty"` + + // IP address version. + IPVersion *IPVersion `json:"ipVersion,omitempty"` + + // The value of the subnet. + Subnet *string `json:"subnet,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceIPConfiguration. +func (n NetworkInterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServers", n.DNSServers) + populate(objectMap, "gateway", n.Gateway) + populate(objectMap, "ipAddress", n.IPAddress) + populate(objectMap, "ipAllocationMethod", n.IPAllocationMethod) + populate(objectMap, "ipVersion", n.IPVersion) + populate(objectMap, "subnet", n.Subnet) + return json.Marshal(objectMap) +} + +// Operation - Object that describes a single Microsoft.HybridNetwork operation. +type Operation struct { + // READ-ONLY; The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + + // READ-ONLY; Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// OperationDisplay - The object that represents the operation. +type OperationDisplay struct { + // Description of the operation. + Description *string `json:"description,omitempty"` + + // Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + + // Service provider: Microsoft.HybridNetwork. + Provider *string `json:"provider,omitempty"` + + // Resource on which the operation is performed: Registration definition, registration assignment, etc. + Resource *string `json:"resource,omitempty"` +} + +// OperationList - A list of the operations. +type OperationList struct { + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of Microsoft.HybridNetwork operations. + Value []*Operation `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// OsDisk - Specifies information about the operating system disk used by the virtual machine. +// For more information about disks, see About disks and VHDs for Azure virtual machines +// [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json]. +type OsDisk struct { + // Specifies the size of os disk in gigabytes. This is the fully expanded disk size needed of the VHD image on the ASE. This disk size should be greater + // than the size of the VHD provided in vhdUri. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The VHD name. + Name *string `json:"name,omitempty"` + + // The OS type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` +} + +// OsProfile - Specifies the operating system settings for the role instance. +type OsProfile struct { + // Specifies the name of the administrator account. + // Windows-only restriction: Cannot end in "." + // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + // "aspnet", "backup", "console", "david", "guest", + // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + // Minimum-length (Linux): 1 character + // Max-length (Linux): 64 characters + // Max-length (Windows): 20 characters + // For root access to the Linux VM, see Using root privileges on Linux virtual machines in Azure + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json] + // For a list of built-in system users on Linux that should not be used in this field, see Selecting User Names for Linux on Azure + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json]. + AdminUsername *string `json:"adminUsername,omitempty"` + + // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the virtual machine. + // The maximum length of the binary array is + // 65535 bytes. + // Note: Do not pass any secrets or passwords in customData property + // This property cannot be updated after the VM is created. + // customData is passed to the VM to be saved as a file. For more information see Custom Data on Azure VMs [https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/] + // For using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json] + CustomData *string `json:"customData,omitempty"` + + // Indicates if custom data is required to deploy this role. + CustomDataRequired *bool `json:"customDataRequired,omitempty"` + + // Specifies the Linux operating system settings on the virtual machine. + // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json] + // For running non-endorsed distributions, see Information for Non-Endorsed Distributions + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json]. + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` +} + +// PreviewSubscription - Customer subscription which can use a sku. +type PreviewSubscription struct { + // The Preview Subscription properties. + Properties *PreviewSubscriptionProperties `json:"properties,omitempty"` + + // READ-ONLY; The ARM ID of the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The preview subscription ID. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PreviewSubscriptionProperties - PreviewSubscription properties +type PreviewSubscriptionProperties struct { + // READ-ONLY; The provisioning state of the PreviewSubscription resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PreviewSubscriptionsList - A list of customer subscriptions which can use a sku. +type PreviewSubscriptionsList struct { + // A list of preview subscriptions. + Value []*PreviewSubscription `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PreviewSubscriptionsList. +func (p PreviewSubscriptionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location +type ProxyResource struct { + Resource +} + +func (p ProxyResource) marshalInternal(objectMap map[string]interface{}) { + p.Resource.marshalInternal(objectMap) +} + +func (p *ProxyResource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + if err := p.Resource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + 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 err + } + return r.unmarshalInternal(rawMsg) +} + +func (r Resource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) +} + +func (r *Resource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &r.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// RoleInstance - The role instance sub resource. +type RoleInstance struct { + // The ARM ID of the resource. + ID *string `json:"id,omitempty"` + + // The role instance name. + Name *string `json:"name,omitempty"` + + // The role instance properties. + Properties *RoleInstanceProperties `json:"properties,omitempty"` + + // The type of the resource. + Type *string `json:"type,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// RoleInstanceProperties - The role instance properties of the network function. +type RoleInstanceProperties struct { + // The operational state of the role instance. + OperationalState *OperationalState `json:"operationalState,omitempty"` + + // READ-ONLY; The provisioning state of the RoleInstance resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RoleInstancesBeginRestartOptions contains the optional parameters for the RoleInstances.BeginRestart method. +type RoleInstancesBeginRestartOptions struct { + // placeholder for future optional parameters +} + +// RoleInstancesBeginStartOptions contains the optional parameters for the RoleInstances.BeginStart method. +type RoleInstancesBeginStartOptions struct { + // placeholder for future optional parameters +} + +// RoleInstancesBeginStopOptions contains the optional parameters for the RoleInstances.BeginStop method. +type RoleInstancesBeginStopOptions struct { + // placeholder for future optional parameters +} + +// RoleInstancesGetOptions contains the optional parameters for the RoleInstances.Get method. +type RoleInstancesGetOptions struct { + // placeholder for future optional parameters +} + +// RoleInstancesListOptions contains the optional parameters for the RoleInstances.List method. +type RoleInstancesListOptions struct { + // placeholder for future optional parameters +} + +// SKUOverview - The network function sku overview. +type SKUOverview struct { + // The vendor sku name. + SKUName *string `json:"skuName,omitempty"` + + // The vendor sku type. + SKUType *SKUType `json:"skuType,omitempty"` +} + +// SSHConfiguration - SSH configuration for Linux based VMs running on Azure +type SSHConfiguration struct { + // The list of SSH public keys used to authenticate with linux based VMs. + PublicKeys []*SSHPublicKey `json:"publicKeys,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SSHConfiguration. +func (s SSHConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicKeys", s.PublicKeys) + return json.Marshal(objectMap) +} + +// SSHPublicKey - Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. +type SSHPublicKey struct { + // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. + // For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure + // [https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json]. + KeyData *string `json:"keyData,omitempty"` + + // Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: + // /home/user/.ssh/authorized_keys + Path *string `json:"path,omitempty"` +} + +// StorageProfile - Specifies the storage settings for the virtual machine disks. +type StorageProfile struct { + // Specifies the parameters that are used to add a data disk to a virtual machine. + DataDisks []*DataDisk `json:"dataDisks,omitempty"` + + // The image reference properties. + ImageReference *ImageReference `json:"imageReference,omitempty"` + + // Specifies information about the operating system disk used by the virtual machine. + OSDisk *OsDisk `json:"osDisk,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfile. +func (s StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDisks", s.DataDisks) + populate(objectMap, "imageReference", s.ImageReference) + populate(objectMap, "osDisk", s.OSDisk) + return json.Marshal(objectMap) +} + +// SubResource - Reference to another sub resource. +type SubResource struct { + // Resource ID. + ID *string `json:"id,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TagsObject - Tags object for patch operations. +type TagsObject struct { + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TagsObject. +func (t TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' +type TrackedResource struct { + Resource + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return t.unmarshalInternal(rawMsg) +} + +func (t TrackedResource) marshalInternal(objectMap map[string]interface{}) { + t.Resource.marshalInternal(objectMap) + populate(objectMap, "location", t.Location) + populate(objectMap, "tags", t.Tags) +} + +func (t *TrackedResource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, &t.Location) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := t.Resource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// Vendor resource. +type Vendor struct { + ProxyResource + // Vendor properties. + Properties *VendorPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Vendor. +func (v Vendor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Vendor. +func (v *Vendor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &v.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VendorDetails - The network function vendor details. +type VendorDetails struct { + // The network function sku list. + SKUList []*SKUOverview `json:"skuList,omitempty"` + + // The network function vendor name. + VendorName *string `json:"vendorName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorDetails. +func (v VendorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skuList", v.SKUList) + populate(objectMap, "vendorName", v.VendorName) + return json.Marshal(objectMap) +} + +// VendorListResult - Response for vendors API service call. +type VendorListResult struct { + // A list of vendors. + Value []*Vendor `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorListResult. +func (v VendorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// VendorNetworkFunction - Vendor network function sub resource. +type VendorNetworkFunction struct { + ProxyResource + // Network function details. + Properties *VendorNetworkFunctionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorNetworkFunction. +func (v VendorNetworkFunction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VendorNetworkFunction. +func (v *VendorNetworkFunction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &v.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VendorNetworkFunctionListResult - Response for vendors API service call. +type VendorNetworkFunctionListResult struct { + // A list of vendor network functions. + Value []*VendorNetworkFunction `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorNetworkFunctionListResult. +func (v VendorNetworkFunctionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// VendorNetworkFunctionPropertiesFormat - Vendor network function properties. +type VendorNetworkFunctionPropertiesFormat struct { + // An array of network function vendor configurations. + NetworkFunctionVendorConfigurations []*NetworkFunctionVendorConfiguration `json:"networkFunctionVendorConfigurations,omitempty"` + + // The vendor controlled provisioning state of the vendor network function. + VendorProvisioningState *VendorProvisioningState `json:"vendorProvisioningState,omitempty"` + + // READ-ONLY; The provisioning state of the vendor network function sub resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The name of the sku. Once set, it cannot be updated. + SKUName *string `json:"skuName,omitempty" azure:"ro"` + + // READ-ONLY; The sku type. + SKUType *SKUType `json:"skuType,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorNetworkFunctionPropertiesFormat. +func (v VendorNetworkFunctionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkFunctionVendorConfigurations", v.NetworkFunctionVendorConfigurations) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "skuName", v.SKUName) + populate(objectMap, "skuType", v.SKUType) + populate(objectMap, "vendorProvisioningState", v.VendorProvisioningState) + return json.Marshal(objectMap) +} + +// VendorNetworkFunctionsBeginCreateOrUpdateOptions contains the optional parameters for the VendorNetworkFunctions.BeginCreateOrUpdate method. +type VendorNetworkFunctionsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VendorNetworkFunctionsGetOptions contains the optional parameters for the VendorNetworkFunctions.Get method. +type VendorNetworkFunctionsGetOptions struct { + // placeholder for future optional parameters +} + +// VendorNetworkFunctionsListOptions contains the optional parameters for the VendorNetworkFunctions.List method. +type VendorNetworkFunctionsListOptions struct { + // The filter to apply on the operation. The properties you can use for eq (equals) are: skuType, skuName and vendorProvisioningState. + Filter *string +} + +// VendorPropertiesFormat - Vendor properties. +type VendorPropertiesFormat struct { + // READ-ONLY; The provisioning state of the vendor resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; A list of IDs of the vendor skus offered by the vendor. + SKUs []*SubResource `json:"skus,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorPropertiesFormat. +func (v VendorPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "skus", v.SKUs) + return json.Marshal(objectMap) +} + +// VendorSKU - Sku sub resource. +type VendorSKU struct { + ProxyResource + // Vendor sku details. + Properties *VendorSKUPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorSKU. +func (v VendorSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VendorSKU. +func (v *VendorSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &v.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VendorSKUListResult - Response for list vendor sku API service call. +type VendorSKUListResult struct { + // A list of vendor skus offered by the vendor. + Value []*VendorSKU `json:"value,omitempty"` + + // READ-ONLY; The URI to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VendorSKUListResult. +func (v VendorSKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// VendorSKUPreviewBeginCreateOrUpdateOptions contains the optional parameters for the VendorSKUPreview.BeginCreateOrUpdate method. +type VendorSKUPreviewBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUPreviewBeginDeleteOptions contains the optional parameters for the VendorSKUPreview.BeginDelete method. +type VendorSKUPreviewBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUPreviewGetOptions contains the optional parameters for the VendorSKUPreview.Get method. +type VendorSKUPreviewGetOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUPreviewListOptions contains the optional parameters for the VendorSKUPreview.List method. +type VendorSKUPreviewListOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUPropertiesFormat - Sku properties +type VendorSKUPropertiesFormat struct { + // The sku deployment mode. + DeploymentMode *SKUDeploymentMode `json:"deploymentMode,omitempty"` + + // The parameters for the managed application to be supplied by the vendor. + ManagedApplicationParameters map[string]interface{} `json:"managedApplicationParameters,omitempty"` + + // The template for the managed application deployment. + ManagedApplicationTemplate map[string]interface{} `json:"managedApplicationTemplate,omitempty"` + + // The template definition of the network function. + NetworkFunctionTemplate *NetworkFunctionTemplate `json:"networkFunctionTemplate,omitempty"` + + // The network function type. + NetworkFunctionType *NetworkFunctionType `json:"networkFunctionType,omitempty"` + + // Indicates if the vendor sku is in preview mode. + Preview *bool `json:"preview,omitempty"` + + // The sku type. + SKUType *SKUType `json:"skuType,omitempty"` + + // READ-ONLY; The provisioning state of the vendor sku sub resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VendorSKUsBeginCreateOrUpdateOptions contains the optional parameters for the VendorSKUs.BeginCreateOrUpdate method. +type VendorSKUsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUsBeginDeleteOptions contains the optional parameters for the VendorSKUs.BeginDelete method. +type VendorSKUsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUsGetOptions contains the optional parameters for the VendorSKUs.Get method. +type VendorSKUsGetOptions struct { + // placeholder for future optional parameters +} + +// VendorSKUsListOptions contains the optional parameters for the VendorSKUs.List method. +type VendorSKUsListOptions struct { + // placeholder for future optional parameters +} + +// VendorsBeginCreateOrUpdateOptions contains the optional parameters for the Vendors.BeginCreateOrUpdate method. +type VendorsBeginCreateOrUpdateOptions struct { + // Parameters supplied to the create vendor operation. + Parameters *Vendor +} + +// VendorsBeginDeleteOptions contains the optional parameters for the Vendors.BeginDelete method. +type VendorsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// VendorsGetOptions contains the optional parameters for the Vendors.Get method. +type VendorsGetOptions struct { + // placeholder for future optional parameters +} + +// VendorsListBySubscriptionOptions contains the optional parameters for the Vendors.ListBySubscription method. +type VendorsListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// VirtualHardDisk - Describes the uri of a disk. +type VirtualHardDisk struct { + // Specifies the virtual hard disk's uri. + URI *string `json:"uri,omitempty"` +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctions_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctions_client.go new file mode 100644 index 000000000000..369edd34c5d2 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctions_client.go @@ -0,0 +1,437 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// NetworkFunctionsClient contains the methods for the NetworkFunctions group. +// Don't use this type directly, use NewNetworkFunctionsClient() instead. +type NetworkFunctionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNetworkFunctionsClient creates a new instance of NetworkFunctionsClient with the specified values. +func NewNetworkFunctionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkFunctionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkFunctionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a network function resource. This operation can take up to 6 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkFunctionName string, parameters NetworkFunction, options *NetworkFunctionsBeginCreateOrUpdateOptions) (NetworkFunctionsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkFunctionName, parameters, options) + if err != nil { + return NetworkFunctionsCreateOrUpdatePollerResponse{}, err + } + result := NetworkFunctionsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("NetworkFunctionsClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return NetworkFunctionsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &NetworkFunctionsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a network function resource. This operation can take up to 6 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkFunctionName string, parameters NetworkFunction, options *NetworkFunctionsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkFunctionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *NetworkFunctionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, parameters NetworkFunction, options *NetworkFunctionsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *NetworkFunctionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the specified network function resource. This operation can take up to 1 hour to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsBeginDeleteOptions) (NetworkFunctionsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkFunctionName, options) + if err != nil { + return NetworkFunctionsDeletePollerResponse{}, err + } + result := NetworkFunctionsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("NetworkFunctionsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return NetworkFunctionsDeletePollerResponse{}, err + } + result.Poller = &NetworkFunctionsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the specified network function resource. This operation can take up to 1 hour to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkFunctionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *NetworkFunctionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *NetworkFunctionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified network function resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) Get(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsGetOptions) (NetworkFunctionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkFunctionName, options) + if err != nil { + return NetworkFunctionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetworkFunctionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkFunctionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *NetworkFunctionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkFunctionsClient) getHandleResponse(resp *http.Response) (NetworkFunctionsGetResponse, error) { + result := NetworkFunctionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunction); err != nil { + return NetworkFunctionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *NetworkFunctionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Lists all the network function resources in a resource group. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) ListByResourceGroup(resourceGroupName string, options *NetworkFunctionsListByResourceGroupOptions) *NetworkFunctionsListByResourceGroupPager { + return &NetworkFunctionsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp NetworkFunctionsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetworkFunctionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *NetworkFunctionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NetworkFunctionsListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *NetworkFunctionsClient) listByResourceGroupHandleResponse(resp *http.Response) (NetworkFunctionsListByResourceGroupResponse, error) { + result := NetworkFunctionsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionListResult); err != nil { + return NetworkFunctionsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *NetworkFunctionsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Lists all the network functions in a subscription. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) ListBySubscription(options *NetworkFunctionsListBySubscriptionOptions) *NetworkFunctionsListBySubscriptionPager { + return &NetworkFunctionsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp NetworkFunctionsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetworkFunctionListResult.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *NetworkFunctionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *NetworkFunctionsListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions" + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *NetworkFunctionsClient) listBySubscriptionHandleResponse(resp *http.Response) (NetworkFunctionsListBySubscriptionResponse, error) { + result := NetworkFunctionsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionListResult); err != nil { + return NetworkFunctionsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *NetworkFunctionsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// UpdateTags - Updates the tags for the network function resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkFunctionName string, parameters TagsObject, options *NetworkFunctionsUpdateTagsOptions) (NetworkFunctionsUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkFunctionName, parameters, options) + if err != nil { + return NetworkFunctionsUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetworkFunctionsUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkFunctionsUpdateTagsResponse{}, client.updateTagsHandleError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *NetworkFunctionsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, parameters TagsObject, options *NetworkFunctionsUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *NetworkFunctionsClient) updateTagsHandleResponse(resp *http.Response) (NetworkFunctionsUpdateTagsResponse, error) { + result := NetworkFunctionsUpdateTagsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunction); err != nil { + return NetworkFunctionsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateTagsHandleError handles the UpdateTags error response. +func (client *NetworkFunctionsClient) updateTagsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendors_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendors_client.go new file mode 100644 index 000000000000..d40ec7258b9c --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendors_client.go @@ -0,0 +1,97 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// NetworkFunctionVendorsClient contains the methods for the NetworkFunctionVendors group. +// Don't use this type directly, use NewNetworkFunctionVendorsClient() instead. +type NetworkFunctionVendorsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNetworkFunctionVendorsClient creates a new instance of NetworkFunctionVendorsClient with the specified values. +func NewNetworkFunctionVendorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkFunctionVendorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkFunctionVendorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Lists all the available vendor and sku information. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionVendorsClient) List(options *NetworkFunctionVendorsListOptions) *NetworkFunctionVendorsListPager { + return &NetworkFunctionVendorsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp NetworkFunctionVendorsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetworkFunctionVendorListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *NetworkFunctionVendorsClient) listCreateRequest(ctx context.Context, options *NetworkFunctionVendorsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors" + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NetworkFunctionVendorsClient) listHandleResponse(resp *http.Response) (NetworkFunctionVendorsListResponse, error) { + result := NetworkFunctionVendorsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionVendorListResult); err != nil { + return NetworkFunctionVendorsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *NetworkFunctionVendorsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendorskus_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendorskus_client.go new file mode 100644 index 000000000000..380bd0ff6e0d --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_networkfunctionvendorskus_client.go @@ -0,0 +1,163 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// NetworkFunctionVendorSKUsClient contains the methods for the NetworkFunctionVendorSKUs group. +// Don't use this type directly, use NewNetworkFunctionVendorSKUsClient() instead. +type NetworkFunctionVendorSKUsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNetworkFunctionVendorSKUsClient creates a new instance of NetworkFunctionVendorSKUsClient with the specified values. +func NewNetworkFunctionVendorSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkFunctionVendorSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkFunctionVendorSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// ListBySKU - Lists information about network function vendor sku details. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionVendorSKUsClient) ListBySKU(vendorName string, vendorSKUName string, options *NetworkFunctionVendorSKUsListBySKUOptions) *NetworkFunctionVendorSKUsListBySKUPager { + return &NetworkFunctionVendorSKUsListBySKUPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySKUCreateRequest(ctx, vendorName, vendorSKUName, options) + }, + advancer: func(ctx context.Context, resp NetworkFunctionVendorSKUsListBySKUResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetworkFunctionSKUDetails.NextLink) + }, + } +} + +// listBySKUCreateRequest creates the ListBySKU request. +func (client *NetworkFunctionVendorSKUsClient) listBySKUCreateRequest(ctx context.Context, vendorName string, vendorSKUName string, options *NetworkFunctionVendorSKUsListBySKUOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus/{vendorSkuName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if vendorSKUName == "" { + return nil, errors.New("parameter vendorSKUName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorSkuName}", url.PathEscape(vendorSKUName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySKUHandleResponse handles the ListBySKU response. +func (client *NetworkFunctionVendorSKUsClient) listBySKUHandleResponse(resp *http.Response) (NetworkFunctionVendorSKUsListBySKUResponse, error) { + result := NetworkFunctionVendorSKUsListBySKUResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionSKUDetails); err != nil { + return NetworkFunctionVendorSKUsListBySKUResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySKUHandleError handles the ListBySKU error response. +func (client *NetworkFunctionVendorSKUsClient) listBySKUHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByVendor - Lists all network function vendor sku details in a vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NetworkFunctionVendorSKUsClient) ListByVendor(vendorName string, options *NetworkFunctionVendorSKUsListByVendorOptions) *NetworkFunctionVendorSKUsListByVendorPager { + return &NetworkFunctionVendorSKUsListByVendorPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByVendorCreateRequest(ctx, vendorName, options) + }, + advancer: func(ctx context.Context, resp NetworkFunctionVendorSKUsListByVendorResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetworkFunctionSKUListResult.NextLink) + }, + } +} + +// listByVendorCreateRequest creates the ListByVendor request. +func (client *NetworkFunctionVendorSKUsClient) listByVendorCreateRequest(ctx context.Context, vendorName string, options *NetworkFunctionVendorSKUsListByVendorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByVendorHandleResponse handles the ListByVendor response. +func (client *NetworkFunctionVendorSKUsClient) listByVendorHandleResponse(resp *http.Response) (NetworkFunctionVendorSKUsListByVendorResponse, error) { + result := NetworkFunctionVendorSKUsListByVendorResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionSKUListResult); err != nil { + return NetworkFunctionVendorSKUsListByVendorResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByVendorHandleError handles the ListByVendor error response. +func (client *NetworkFunctionVendorSKUsClient) listByVendorHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_operations_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_operations_client.go new file mode 100644 index 000000000000..6cb9d0315bce --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_operations_client.go @@ -0,0 +1,89 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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 { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Gets a list of the operations. +// If the operation fails it returns the *ErrorResponse error type. +func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager { + return &OperationsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HybridNetwork/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { + return OperationsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pagers.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pagers.go new file mode 100644 index 000000000000..7a4e6bbf4a43 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pagers.go @@ -0,0 +1,719 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// DevicesListByResourceGroupPager provides operations for iterating over paged responses. +type DevicesListByResourceGroupPager struct { + client *DevicesClient + current DevicesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DevicesListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *DevicesListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DevicesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DeviceListResult.NextLink == nil || len(*p.current.DeviceListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current DevicesListByResourceGroupResponse page. +func (p *DevicesListByResourceGroupPager) PageResponse() DevicesListByResourceGroupResponse { + return p.current +} + +// DevicesListBySubscriptionPager provides operations for iterating over paged responses. +type DevicesListBySubscriptionPager struct { + client *DevicesClient + current DevicesListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DevicesListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *DevicesListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DevicesListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DeviceListResult.NextLink == nil || len(*p.current.DeviceListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current DevicesListBySubscriptionResponse page. +func (p *DevicesListBySubscriptionPager) PageResponse() DevicesListBySubscriptionResponse { + return p.current +} + +// NetworkFunctionVendorSKUsListBySKUPager provides operations for iterating over paged responses. +type NetworkFunctionVendorSKUsListBySKUPager struct { + client *NetworkFunctionVendorSKUsClient + current NetworkFunctionVendorSKUsListBySKUResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NetworkFunctionVendorSKUsListBySKUResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NetworkFunctionVendorSKUsListBySKUPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *NetworkFunctionVendorSKUsListBySKUPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetworkFunctionSKUDetails.NextLink == nil || len(*p.current.NetworkFunctionSKUDetails.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySKUHandleError(resp) + return false + } + result, err := p.client.listBySKUHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NetworkFunctionVendorSKUsListBySKUResponse page. +func (p *NetworkFunctionVendorSKUsListBySKUPager) PageResponse() NetworkFunctionVendorSKUsListBySKUResponse { + return p.current +} + +// NetworkFunctionVendorSKUsListByVendorPager provides operations for iterating over paged responses. +type NetworkFunctionVendorSKUsListByVendorPager struct { + client *NetworkFunctionVendorSKUsClient + current NetworkFunctionVendorSKUsListByVendorResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NetworkFunctionVendorSKUsListByVendorResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NetworkFunctionVendorSKUsListByVendorPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *NetworkFunctionVendorSKUsListByVendorPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetworkFunctionSKUListResult.NextLink == nil || len(*p.current.NetworkFunctionSKUListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByVendorHandleError(resp) + return false + } + result, err := p.client.listByVendorHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NetworkFunctionVendorSKUsListByVendorResponse page. +func (p *NetworkFunctionVendorSKUsListByVendorPager) PageResponse() NetworkFunctionVendorSKUsListByVendorResponse { + return p.current +} + +// NetworkFunctionVendorsListPager provides operations for iterating over paged responses. +type NetworkFunctionVendorsListPager struct { + client *NetworkFunctionVendorsClient + current NetworkFunctionVendorsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NetworkFunctionVendorsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NetworkFunctionVendorsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *NetworkFunctionVendorsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetworkFunctionVendorListResult.NextLink == nil || len(*p.current.NetworkFunctionVendorListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NetworkFunctionVendorsListResponse page. +func (p *NetworkFunctionVendorsListPager) PageResponse() NetworkFunctionVendorsListResponse { + return p.current +} + +// NetworkFunctionsListByResourceGroupPager provides operations for iterating over paged responses. +type NetworkFunctionsListByResourceGroupPager struct { + client *NetworkFunctionsClient + current NetworkFunctionsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NetworkFunctionsListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NetworkFunctionsListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *NetworkFunctionsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetworkFunctionListResult.NextLink == nil || len(*p.current.NetworkFunctionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NetworkFunctionsListByResourceGroupResponse page. +func (p *NetworkFunctionsListByResourceGroupPager) PageResponse() NetworkFunctionsListByResourceGroupResponse { + return p.current +} + +// NetworkFunctionsListBySubscriptionPager provides operations for iterating over paged responses. +type NetworkFunctionsListBySubscriptionPager struct { + client *NetworkFunctionsClient + current NetworkFunctionsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NetworkFunctionsListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NetworkFunctionsListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *NetworkFunctionsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetworkFunctionListResult.NextLink == nil || len(*p.current.NetworkFunctionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NetworkFunctionsListBySubscriptionResponse page. +func (p *NetworkFunctionsListBySubscriptionPager) PageResponse() NetworkFunctionsListBySubscriptionResponse { + return p.current +} + +// OperationsListPager provides operations for iterating over paged responses. +type OperationsListPager struct { + client *OperationsClient + current OperationsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.OperationList.NextLink == nil || len(*p.current.OperationList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsListResponse page. +func (p *OperationsListPager) PageResponse() OperationsListResponse { + return p.current +} + +// RoleInstancesListPager provides operations for iterating over paged responses. +type RoleInstancesListPager struct { + client *RoleInstancesClient + current RoleInstancesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RoleInstancesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RoleInstancesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RoleInstancesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetworkFunctionRoleInstanceListResult.NextLink == nil || len(*p.current.NetworkFunctionRoleInstanceListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RoleInstancesListResponse page. +func (p *RoleInstancesListPager) PageResponse() RoleInstancesListResponse { + return p.current +} + +// VendorNetworkFunctionsListPager provides operations for iterating over paged responses. +type VendorNetworkFunctionsListPager struct { + client *VendorNetworkFunctionsClient + current VendorNetworkFunctionsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VendorNetworkFunctionsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *VendorNetworkFunctionsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VendorNetworkFunctionsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VendorNetworkFunctionListResult.NextLink == nil || len(*p.current.VendorNetworkFunctionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current VendorNetworkFunctionsListResponse page. +func (p *VendorNetworkFunctionsListPager) PageResponse() VendorNetworkFunctionsListResponse { + return p.current +} + +// VendorSKUPreviewListPager provides operations for iterating over paged responses. +type VendorSKUPreviewListPager struct { + client *VendorSKUPreviewClient + current VendorSKUPreviewListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VendorSKUPreviewListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *VendorSKUPreviewListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VendorSKUPreviewListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PreviewSubscriptionsList.NextLink == nil || len(*p.current.PreviewSubscriptionsList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current VendorSKUPreviewListResponse page. +func (p *VendorSKUPreviewListPager) PageResponse() VendorSKUPreviewListResponse { + return p.current +} + +// VendorSKUsListPager provides operations for iterating over paged responses. +type VendorSKUsListPager struct { + client *VendorSKUsClient + current VendorSKUsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VendorSKUsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *VendorSKUsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VendorSKUsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VendorSKUListResult.NextLink == nil || len(*p.current.VendorSKUListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current VendorSKUsListResponse page. +func (p *VendorSKUsListPager) PageResponse() VendorSKUsListResponse { + return p.current +} + +// VendorsListBySubscriptionPager provides operations for iterating over paged responses. +type VendorsListBySubscriptionPager struct { + client *VendorsClient + current VendorsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VendorsListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *VendorsListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VendorsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VendorListResult.NextLink == nil || len(*p.current.VendorListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current VendorsListBySubscriptionResponse page. +func (p *VendorsListBySubscriptionPager) PageResponse() VendorsListBySubscriptionResponse { + return p.current +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pollers.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pollers.go new file mode 100644 index 000000000000..b26a0f7852b8 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_pollers.go @@ -0,0 +1,617 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// DevicesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DevicesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesCreateOrUpdateResponse will be returned. +func (p *DevicesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DevicesCreateOrUpdateResponse, error) { + respType := DevicesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Device) + if err != nil { + return DevicesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DevicesDeletePoller provides polling facilities until the operation reaches a terminal state. +type DevicesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DevicesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DevicesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DevicesDeleteResponse will be returned. +func (p *DevicesDeletePoller) FinalResponse(ctx context.Context) (DevicesDeleteResponse, error) { + respType := DevicesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DevicesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DevicesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// NetworkFunctionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type NetworkFunctionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *NetworkFunctionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *NetworkFunctionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final NetworkFunctionsCreateOrUpdateResponse will be returned. +func (p *NetworkFunctionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (NetworkFunctionsCreateOrUpdateResponse, error) { + respType := NetworkFunctionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.NetworkFunction) + if err != nil { + return NetworkFunctionsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *NetworkFunctionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// NetworkFunctionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type NetworkFunctionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *NetworkFunctionsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *NetworkFunctionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final NetworkFunctionsDeleteResponse will be returned. +func (p *NetworkFunctionsDeletePoller) FinalResponse(ctx context.Context) (NetworkFunctionsDeleteResponse, error) { + respType := NetworkFunctionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return NetworkFunctionsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *NetworkFunctionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RoleInstancesRestartPoller provides polling facilities until the operation reaches a terminal state. +type RoleInstancesRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RoleInstancesRestartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RoleInstancesRestartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RoleInstancesRestartResponse will be returned. +func (p *RoleInstancesRestartPoller) FinalResponse(ctx context.Context) (RoleInstancesRestartResponse, error) { + respType := RoleInstancesRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RoleInstancesRestartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RoleInstancesRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RoleInstancesStartPoller provides polling facilities until the operation reaches a terminal state. +type RoleInstancesStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RoleInstancesStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RoleInstancesStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RoleInstancesStartResponse will be returned. +func (p *RoleInstancesStartPoller) FinalResponse(ctx context.Context) (RoleInstancesStartResponse, error) { + respType := RoleInstancesStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RoleInstancesStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RoleInstancesStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RoleInstancesStopPoller provides polling facilities until the operation reaches a terminal state. +type RoleInstancesStopPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RoleInstancesStopPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RoleInstancesStopPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RoleInstancesStopResponse will be returned. +func (p *RoleInstancesStopPoller) FinalResponse(ctx context.Context) (RoleInstancesStopResponse, error) { + respType := RoleInstancesStopResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RoleInstancesStopResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RoleInstancesStopPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorNetworkFunctionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VendorNetworkFunctionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorNetworkFunctionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorNetworkFunctionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorNetworkFunctionsCreateOrUpdateResponse will be returned. +func (p *VendorNetworkFunctionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VendorNetworkFunctionsCreateOrUpdateResponse, error) { + respType := VendorNetworkFunctionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VendorNetworkFunction) + if err != nil { + return VendorNetworkFunctionsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorNetworkFunctionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorSKUPreviewCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VendorSKUPreviewCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorSKUPreviewCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorSKUPreviewCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorSKUPreviewCreateOrUpdateResponse will be returned. +func (p *VendorSKUPreviewCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VendorSKUPreviewCreateOrUpdateResponse, error) { + respType := VendorSKUPreviewCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PreviewSubscription) + if err != nil { + return VendorSKUPreviewCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorSKUPreviewCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorSKUPreviewDeletePoller provides polling facilities until the operation reaches a terminal state. +type VendorSKUPreviewDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorSKUPreviewDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorSKUPreviewDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorSKUPreviewDeleteResponse will be returned. +func (p *VendorSKUPreviewDeletePoller) FinalResponse(ctx context.Context) (VendorSKUPreviewDeleteResponse, error) { + respType := VendorSKUPreviewDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VendorSKUPreviewDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorSKUPreviewDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorSKUsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VendorSKUsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorSKUsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorSKUsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorSKUsCreateOrUpdateResponse will be returned. +func (p *VendorSKUsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VendorSKUsCreateOrUpdateResponse, error) { + respType := VendorSKUsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VendorSKU) + if err != nil { + return VendorSKUsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorSKUsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorSKUsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VendorSKUsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorSKUsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorSKUsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorSKUsDeleteResponse will be returned. +func (p *VendorSKUsDeletePoller) FinalResponse(ctx context.Context) (VendorSKUsDeleteResponse, error) { + respType := VendorSKUsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VendorSKUsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorSKUsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VendorsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorsCreateOrUpdateResponse will be returned. +func (p *VendorsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VendorsCreateOrUpdateResponse, error) { + respType := VendorsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Vendor) + if err != nil { + return VendorsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VendorsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VendorsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VendorsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VendorsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VendorsDeleteResponse will be returned. +func (p *VendorsDeletePoller) FinalResponse(ctx context.Context) (VendorsDeleteResponse, error) { + respType := VendorsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VendorsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VendorsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..18d473b7c25a --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_polymorphic_helpers.go @@ -0,0 +1,67 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import "encoding/json" + +func unmarshalDevicePropertiesFormatClassification(rawMsg json.RawMessage) (DevicePropertiesFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b DevicePropertiesFormatClassification + switch m["deviceType"] { + case string(DeviceTypeAzureStackEdge): + b = &AzureStackEdgeFormat{} + default: + b = &DevicePropertiesFormat{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalDevicePropertiesFormatClassificationArray(rawMsg json.RawMessage) ([]DevicePropertiesFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]DevicePropertiesFormatClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalDevicePropertiesFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalDevicePropertiesFormatClassificationMap(rawMsg json.RawMessage) (map[string]DevicePropertiesFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]DevicePropertiesFormatClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalDevicePropertiesFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_response_types.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_response_types.go new file mode 100644 index 000000000000..438f7d2dd616 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_response_types.go @@ -0,0 +1,972 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// DevicesCreateOrUpdatePollerResponse contains the response from method Devices.CreateOrUpdate. +type DevicesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesCreateOrUpdateResponse, error) { + respType := DevicesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Device) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *DevicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &DevicesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesCreateOrUpdateResponse contains the response from method Devices.CreateOrUpdate. +type DevicesCreateOrUpdateResponse struct { + DevicesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesCreateOrUpdateResult contains the result from method Devices.CreateOrUpdate. +type DevicesCreateOrUpdateResult struct { + Device +} + +// DevicesDeletePollerResponse contains the response from method Devices.Delete. +type DevicesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *DevicesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DevicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DevicesDeleteResponse, error) { + respType := DevicesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DevicesDeletePollerResponse from the provided client and resume token. +func (l *DevicesDeletePollerResponse) Resume(ctx context.Context, client *DevicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DevicesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DevicesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DevicesDeleteResponse contains the response from method Devices.Delete. +type DevicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGetResponse contains the response from method Devices.Get. +type DevicesGetResponse struct { + DevicesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesGetResult contains the result from method Devices.Get. +type DevicesGetResult struct { + Device +} + +// DevicesListByResourceGroupResponse contains the response from method Devices.ListByResourceGroup. +type DevicesListByResourceGroupResponse struct { + DevicesListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesListByResourceGroupResult contains the result from method Devices.ListByResourceGroup. +type DevicesListByResourceGroupResult struct { + DeviceListResult +} + +// DevicesListBySubscriptionResponse contains the response from method Devices.ListBySubscription. +type DevicesListBySubscriptionResponse struct { + DevicesListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesListBySubscriptionResult contains the result from method Devices.ListBySubscription. +type DevicesListBySubscriptionResult struct { + DeviceListResult +} + +// DevicesListRegistrationKeyResponse contains the response from method Devices.ListRegistrationKey. +type DevicesListRegistrationKeyResponse struct { + DevicesListRegistrationKeyResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesListRegistrationKeyResult contains the result from method Devices.ListRegistrationKey. +type DevicesListRegistrationKeyResult struct { + DeviceRegistrationKey +} + +// DevicesUpdateTagsResponse contains the response from method Devices.UpdateTags. +type DevicesUpdateTagsResponse struct { + DevicesUpdateTagsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DevicesUpdateTagsResult contains the result from method Devices.UpdateTags. +type DevicesUpdateTagsResult struct { + Device +} + +// NetworkFunctionVendorSKUsListBySKUResponse contains the response from method NetworkFunctionVendorSKUs.ListBySKU. +type NetworkFunctionVendorSKUsListBySKUResponse struct { + NetworkFunctionVendorSKUsListBySKUResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionVendorSKUsListBySKUResult contains the result from method NetworkFunctionVendorSKUs.ListBySKU. +type NetworkFunctionVendorSKUsListBySKUResult struct { + NetworkFunctionSKUDetails +} + +// NetworkFunctionVendorSKUsListByVendorResponse contains the response from method NetworkFunctionVendorSKUs.ListByVendor. +type NetworkFunctionVendorSKUsListByVendorResponse struct { + NetworkFunctionVendorSKUsListByVendorResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionVendorSKUsListByVendorResult contains the result from method NetworkFunctionVendorSKUs.ListByVendor. +type NetworkFunctionVendorSKUsListByVendorResult struct { + NetworkFunctionSKUListResult +} + +// NetworkFunctionVendorsListResponse contains the response from method NetworkFunctionVendors.List. +type NetworkFunctionVendorsListResponse struct { + NetworkFunctionVendorsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionVendorsListResult contains the result from method NetworkFunctionVendors.List. +type NetworkFunctionVendorsListResult struct { + NetworkFunctionVendorListResult +} + +// NetworkFunctionsCreateOrUpdatePollerResponse contains the response from method NetworkFunctions.CreateOrUpdate. +type NetworkFunctionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *NetworkFunctionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l NetworkFunctionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkFunctionsCreateOrUpdateResponse, error) { + respType := NetworkFunctionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkFunction) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a NetworkFunctionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *NetworkFunctionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *NetworkFunctionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("NetworkFunctionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &NetworkFunctionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// NetworkFunctionsCreateOrUpdateResponse contains the response from method NetworkFunctions.CreateOrUpdate. +type NetworkFunctionsCreateOrUpdateResponse struct { + NetworkFunctionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionsCreateOrUpdateResult contains the result from method NetworkFunctions.CreateOrUpdate. +type NetworkFunctionsCreateOrUpdateResult struct { + NetworkFunction +} + +// NetworkFunctionsDeletePollerResponse contains the response from method NetworkFunctions.Delete. +type NetworkFunctionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *NetworkFunctionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l NetworkFunctionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkFunctionsDeleteResponse, error) { + respType := NetworkFunctionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a NetworkFunctionsDeletePollerResponse from the provided client and resume token. +func (l *NetworkFunctionsDeletePollerResponse) Resume(ctx context.Context, client *NetworkFunctionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("NetworkFunctionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &NetworkFunctionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// NetworkFunctionsDeleteResponse contains the response from method NetworkFunctions.Delete. +type NetworkFunctionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionsGetResponse contains the response from method NetworkFunctions.Get. +type NetworkFunctionsGetResponse struct { + NetworkFunctionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionsGetResult contains the result from method NetworkFunctions.Get. +type NetworkFunctionsGetResult struct { + NetworkFunction +} + +// NetworkFunctionsListByResourceGroupResponse contains the response from method NetworkFunctions.ListByResourceGroup. +type NetworkFunctionsListByResourceGroupResponse struct { + NetworkFunctionsListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionsListByResourceGroupResult contains the result from method NetworkFunctions.ListByResourceGroup. +type NetworkFunctionsListByResourceGroupResult struct { + NetworkFunctionListResult +} + +// NetworkFunctionsListBySubscriptionResponse contains the response from method NetworkFunctions.ListBySubscription. +type NetworkFunctionsListBySubscriptionResponse struct { + NetworkFunctionsListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionsListBySubscriptionResult contains the result from method NetworkFunctions.ListBySubscription. +type NetworkFunctionsListBySubscriptionResult struct { + NetworkFunctionListResult +} + +// NetworkFunctionsUpdateTagsResponse contains the response from method NetworkFunctions.UpdateTags. +type NetworkFunctionsUpdateTagsResponse struct { + NetworkFunctionsUpdateTagsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetworkFunctionsUpdateTagsResult contains the result from method NetworkFunctions.UpdateTags. +type NetworkFunctionsUpdateTagsResult struct { + NetworkFunction +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + OperationList +} + +// RoleInstancesGetResponse contains the response from method RoleInstances.Get. +type RoleInstancesGetResponse struct { + RoleInstancesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoleInstancesGetResult contains the result from method RoleInstances.Get. +type RoleInstancesGetResult struct { + RoleInstance +} + +// RoleInstancesListResponse contains the response from method RoleInstances.List. +type RoleInstancesListResponse struct { + RoleInstancesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoleInstancesListResult contains the result from method RoleInstances.List. +type RoleInstancesListResult struct { + NetworkFunctionRoleInstanceListResult +} + +// RoleInstancesRestartPollerResponse contains the response from method RoleInstances.Restart. +type RoleInstancesRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *RoleInstancesRestartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RoleInstancesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoleInstancesRestartResponse, error) { + respType := RoleInstancesRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RoleInstancesRestartPollerResponse from the provided client and resume token. +func (l *RoleInstancesRestartPollerResponse) Resume(ctx context.Context, client *RoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RoleInstancesClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &RoleInstancesRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RoleInstancesRestartResponse contains the response from method RoleInstances.Restart. +type RoleInstancesRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoleInstancesStartPollerResponse contains the response from method RoleInstances.Start. +type RoleInstancesStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *RoleInstancesStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RoleInstancesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoleInstancesStartResponse, error) { + respType := RoleInstancesStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RoleInstancesStartPollerResponse from the provided client and resume token. +func (l *RoleInstancesStartPollerResponse) Resume(ctx context.Context, client *RoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RoleInstancesClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &RoleInstancesStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RoleInstancesStartResponse contains the response from method RoleInstances.Start. +type RoleInstancesStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoleInstancesStopPollerResponse contains the response from method RoleInstances.Stop. +type RoleInstancesStopPollerResponse struct { + // Poller contains an initialized poller. + Poller *RoleInstancesStopPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RoleInstancesStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoleInstancesStopResponse, error) { + respType := RoleInstancesStopResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RoleInstancesStopPollerResponse from the provided client and resume token. +func (l *RoleInstancesStopPollerResponse) Resume(ctx context.Context, client *RoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RoleInstancesClient.Stop", token, client.pl, client.stopHandleError) + if err != nil { + return err + } + poller := &RoleInstancesStopPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RoleInstancesStopResponse contains the response from method RoleInstances.Stop. +type RoleInstancesStopResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorNetworkFunctionsCreateOrUpdatePollerResponse contains the response from method VendorNetworkFunctions.CreateOrUpdate. +type VendorNetworkFunctionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorNetworkFunctionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorNetworkFunctionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorNetworkFunctionsCreateOrUpdateResponse, error) { + respType := VendorNetworkFunctionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VendorNetworkFunction) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorNetworkFunctionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VendorNetworkFunctionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VendorNetworkFunctionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorNetworkFunctionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VendorNetworkFunctionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorNetworkFunctionsCreateOrUpdateResponse contains the response from method VendorNetworkFunctions.CreateOrUpdate. +type VendorNetworkFunctionsCreateOrUpdateResponse struct { + VendorNetworkFunctionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorNetworkFunctionsCreateOrUpdateResult contains the result from method VendorNetworkFunctions.CreateOrUpdate. +type VendorNetworkFunctionsCreateOrUpdateResult struct { + VendorNetworkFunction +} + +// VendorNetworkFunctionsGetResponse contains the response from method VendorNetworkFunctions.Get. +type VendorNetworkFunctionsGetResponse struct { + VendorNetworkFunctionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorNetworkFunctionsGetResult contains the result from method VendorNetworkFunctions.Get. +type VendorNetworkFunctionsGetResult struct { + VendorNetworkFunction +} + +// VendorNetworkFunctionsListResponse contains the response from method VendorNetworkFunctions.List. +type VendorNetworkFunctionsListResponse struct { + VendorNetworkFunctionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorNetworkFunctionsListResult contains the result from method VendorNetworkFunctions.List. +type VendorNetworkFunctionsListResult struct { + VendorNetworkFunctionListResult +} + +// VendorSKUPreviewCreateOrUpdatePollerResponse contains the response from method VendorSKUPreview.CreateOrUpdate. +type VendorSKUPreviewCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorSKUPreviewCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorSKUPreviewCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorSKUPreviewCreateOrUpdateResponse, error) { + respType := VendorSKUPreviewCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PreviewSubscription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorSKUPreviewCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VendorSKUPreviewCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VendorSKUPreviewClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorSKUPreviewClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VendorSKUPreviewCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorSKUPreviewCreateOrUpdateResponse contains the response from method VendorSKUPreview.CreateOrUpdate. +type VendorSKUPreviewCreateOrUpdateResponse struct { + VendorSKUPreviewCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUPreviewCreateOrUpdateResult contains the result from method VendorSKUPreview.CreateOrUpdate. +type VendorSKUPreviewCreateOrUpdateResult struct { + PreviewSubscription +} + +// VendorSKUPreviewDeletePollerResponse contains the response from method VendorSKUPreview.Delete. +type VendorSKUPreviewDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorSKUPreviewDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorSKUPreviewDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorSKUPreviewDeleteResponse, error) { + respType := VendorSKUPreviewDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorSKUPreviewDeletePollerResponse from the provided client and resume token. +func (l *VendorSKUPreviewDeletePollerResponse) Resume(ctx context.Context, client *VendorSKUPreviewClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorSKUPreviewClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VendorSKUPreviewDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorSKUPreviewDeleteResponse contains the response from method VendorSKUPreview.Delete. +type VendorSKUPreviewDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUPreviewGetResponse contains the response from method VendorSKUPreview.Get. +type VendorSKUPreviewGetResponse struct { + VendorSKUPreviewGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUPreviewGetResult contains the result from method VendorSKUPreview.Get. +type VendorSKUPreviewGetResult struct { + PreviewSubscription +} + +// VendorSKUPreviewListResponse contains the response from method VendorSKUPreview.List. +type VendorSKUPreviewListResponse struct { + VendorSKUPreviewListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUPreviewListResult contains the result from method VendorSKUPreview.List. +type VendorSKUPreviewListResult struct { + PreviewSubscriptionsList +} + +// VendorSKUsCreateOrUpdatePollerResponse contains the response from method VendorSKUs.CreateOrUpdate. +type VendorSKUsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorSKUsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorSKUsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorSKUsCreateOrUpdateResponse, error) { + respType := VendorSKUsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VendorSKU) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorSKUsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VendorSKUsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VendorSKUsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorSKUsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VendorSKUsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorSKUsCreateOrUpdateResponse contains the response from method VendorSKUs.CreateOrUpdate. +type VendorSKUsCreateOrUpdateResponse struct { + VendorSKUsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUsCreateOrUpdateResult contains the result from method VendorSKUs.CreateOrUpdate. +type VendorSKUsCreateOrUpdateResult struct { + VendorSKU +} + +// VendorSKUsDeletePollerResponse contains the response from method VendorSKUs.Delete. +type VendorSKUsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorSKUsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorSKUsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorSKUsDeleteResponse, error) { + respType := VendorSKUsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorSKUsDeletePollerResponse from the provided client and resume token. +func (l *VendorSKUsDeletePollerResponse) Resume(ctx context.Context, client *VendorSKUsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorSKUsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VendorSKUsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorSKUsDeleteResponse contains the response from method VendorSKUs.Delete. +type VendorSKUsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUsGetResponse contains the response from method VendorSKUs.Get. +type VendorSKUsGetResponse struct { + VendorSKUsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUsGetResult contains the result from method VendorSKUs.Get. +type VendorSKUsGetResult struct { + VendorSKU +} + +// VendorSKUsListResponse contains the response from method VendorSKUs.List. +type VendorSKUsListResponse struct { + VendorSKUsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorSKUsListResult contains the result from method VendorSKUs.List. +type VendorSKUsListResult struct { + VendorSKUListResult +} + +// VendorsCreateOrUpdatePollerResponse contains the response from method Vendors.CreateOrUpdate. +type VendorsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorsCreateOrUpdateResponse, error) { + respType := VendorsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Vendor) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VendorsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VendorsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VendorsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorsCreateOrUpdateResponse contains the response from method Vendors.CreateOrUpdate. +type VendorsCreateOrUpdateResponse struct { + VendorsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorsCreateOrUpdateResult contains the result from method Vendors.CreateOrUpdate. +type VendorsCreateOrUpdateResult struct { + Vendor +} + +// VendorsDeletePollerResponse contains the response from method Vendors.Delete. +type VendorsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VendorsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l VendorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VendorsDeleteResponse, error) { + respType := VendorsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VendorsDeletePollerResponse from the provided client and resume token. +func (l *VendorsDeletePollerResponse) Resume(ctx context.Context, client *VendorsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VendorsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VendorsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VendorsDeleteResponse contains the response from method Vendors.Delete. +type VendorsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorsGetResponse contains the response from method Vendors.Get. +type VendorsGetResponse struct { + VendorsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorsGetResult contains the result from method Vendors.Get. +type VendorsGetResult struct { + Vendor +} + +// VendorsListBySubscriptionResponse contains the response from method Vendors.ListBySubscription. +type VendorsListBySubscriptionResponse struct { + VendorsListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VendorsListBySubscriptionResult contains the result from method Vendors.ListBySubscription. +type VendorsListBySubscriptionResult struct { + VendorListResult +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_roleinstances_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_roleinstances_client.go new file mode 100644 index 000000000000..3ad687af21d2 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_roleinstances_client.go @@ -0,0 +1,434 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// RoleInstancesClient contains the methods for the RoleInstances group. +// Don't use this type directly, use NewRoleInstancesClient() instead. +type RoleInstancesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewRoleInstancesClient creates a new instance of RoleInstancesClient with the specified values. +func NewRoleInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RoleInstancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleInstancesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Gets the information of role instance of vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) Get(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesGetOptions) (RoleInstancesGetResponse, error) { + req, err := client.getCreateRequest(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return RoleInstancesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RoleInstancesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RoleInstancesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RoleInstancesClient) getCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleInstancesClient) getHandleResponse(resp *http.Response) (RoleInstancesGetResponse, error) { + result := RoleInstancesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstance); err != nil { + return RoleInstancesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *RoleInstancesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the information of role instances of vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) List(locationName string, vendorName string, serviceKey string, options *RoleInstancesListOptions) *RoleInstancesListPager { + return &RoleInstancesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, locationName, vendorName, serviceKey, options) + }, + advancer: func(ctx context.Context, resp RoleInstancesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetworkFunctionRoleInstanceListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *RoleInstancesClient) listCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, options *RoleInstancesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RoleInstancesClient) listHandleResponse(resp *http.Response) (RoleInstancesListResponse, error) { + result := RoleInstancesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionRoleInstanceListResult); err != nil { + return RoleInstancesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *RoleInstancesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginRestart - Restarts a role instance of a vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) BeginRestart(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginRestartOptions) (RoleInstancesRestartPollerResponse, error) { + resp, err := client.restart(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return RoleInstancesRestartPollerResponse{}, err + } + result := RoleInstancesRestartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RoleInstancesClient.Restart", "location", resp, client.pl, client.restartHandleError) + if err != nil { + return RoleInstancesRestartPollerResponse{}, err + } + result.Poller = &RoleInstancesRestartPoller{ + pt: pt, + } + return result, nil +} + +// Restart - Restarts a role instance of a vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) restart(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.restartHandleError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *RoleInstancesClient) restartCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// restartHandleError handles the Restart error response. +func (client *RoleInstancesClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStart - Starts a role instance of a vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) BeginStart(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginStartOptions) (RoleInstancesStartPollerResponse, error) { + resp, err := client.start(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return RoleInstancesStartPollerResponse{}, err + } + result := RoleInstancesStartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RoleInstancesClient.Start", "location", resp, client.pl, client.startHandleError) + if err != nil { + return RoleInstancesStartPollerResponse{}, err + } + result.Poller = &RoleInstancesStartPoller{ + pt: pt, + } + return result, nil +} + +// Start - Starts a role instance of a vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) start(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.startHandleError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *RoleInstancesClient) startCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// startHandleError handles the Start error response. +func (client *RoleInstancesClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStop - Powers off (stop) a role instance of a vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) BeginStop(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginStopOptions) (RoleInstancesStopPollerResponse, error) { + resp, err := client.stop(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return RoleInstancesStopPollerResponse{}, err + } + result := RoleInstancesStopPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RoleInstancesClient.Stop", "location", resp, client.pl, client.stopHandleError) + if err != nil { + return RoleInstancesStopPollerResponse{}, err + } + result.Poller = &RoleInstancesStopPoller{ + pt: pt, + } + return result, nil +} + +// Stop - Powers off (stop) a role instance of a vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *RoleInstancesClient) stop(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, locationName, vendorName, serviceKey, roleInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.stopHandleError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *RoleInstancesClient) stopCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, roleInstanceName string, options *RoleInstancesBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// stopHandleError handles the Stop error response. +func (client *RoleInstancesClient) stopHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_time_rfc3339.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..0c9da5a88fb8 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "encoding/json" + "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]interface{}, 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, 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 err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendornetworkfunctions_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendornetworkfunctions_client.go new file mode 100644 index 000000000000..0fa63e2bb126 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendornetworkfunctions_client.go @@ -0,0 +1,257 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// VendorNetworkFunctionsClient contains the methods for the VendorNetworkFunctions group. +// Don't use this type directly, use NewVendorNetworkFunctionsClient() instead. +type VendorNetworkFunctionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVendorNetworkFunctionsClient creates a new instance of VendorNetworkFunctionsClient with the specified values. +func NewVendorNetworkFunctionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VendorNetworkFunctionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VendorNetworkFunctionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a vendor network function. This operation can take up to 6 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorNetworkFunctionsClient) BeginCreateOrUpdate(ctx context.Context, locationName string, vendorName string, serviceKey string, parameters VendorNetworkFunction, options *VendorNetworkFunctionsBeginCreateOrUpdateOptions) (VendorNetworkFunctionsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, locationName, vendorName, serviceKey, parameters, options) + if err != nil { + return VendorNetworkFunctionsCreateOrUpdatePollerResponse{}, err + } + result := VendorNetworkFunctionsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorNetworkFunctionsClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return VendorNetworkFunctionsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &VendorNetworkFunctionsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a vendor network function. This operation can take up to 6 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorNetworkFunctionsClient) createOrUpdate(ctx context.Context, locationName string, vendorName string, serviceKey string, parameters VendorNetworkFunction, options *VendorNetworkFunctionsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, locationName, vendorName, serviceKey, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VendorNetworkFunctionsClient) createOrUpdateCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, parameters VendorNetworkFunction, options *VendorNetworkFunctionsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *VendorNetworkFunctionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified vendor network function. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorNetworkFunctionsClient) Get(ctx context.Context, locationName string, vendorName string, serviceKey string, options *VendorNetworkFunctionsGetOptions) (VendorNetworkFunctionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, locationName, vendorName, serviceKey, options) + if err != nil { + return VendorNetworkFunctionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VendorNetworkFunctionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VendorNetworkFunctionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VendorNetworkFunctionsClient) getCreateRequest(ctx context.Context, locationName string, vendorName string, serviceKey string, options *VendorNetworkFunctionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if serviceKey == "" { + return nil, errors.New("parameter serviceKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceKey}", url.PathEscape(serviceKey)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VendorNetworkFunctionsClient) getHandleResponse(resp *http.Response) (VendorNetworkFunctionsGetResponse, error) { + result := VendorNetworkFunctionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VendorNetworkFunction); err != nil { + return VendorNetworkFunctionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *VendorNetworkFunctionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all the vendor network function sub resources in an Azure region, filtered by skuType, skuName, vendorProvisioningState. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorNetworkFunctionsClient) List(locationName string, vendorName string, options *VendorNetworkFunctionsListOptions) *VendorNetworkFunctionsListPager { + return &VendorNetworkFunctionsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, locationName, vendorName, options) + }, + advancer: func(ctx context.Context, resp VendorNetworkFunctionsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VendorNetworkFunctionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *VendorNetworkFunctionsClient) listCreateRequest(ctx context.Context, locationName string, vendorName string, options *VendorNetworkFunctionsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions" + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VendorNetworkFunctionsClient) listHandleResponse(resp *http.Response) (VendorNetworkFunctionsListResponse, error) { + result := VendorNetworkFunctionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VendorNetworkFunctionListResult); err != nil { + return VendorNetworkFunctionsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *VendorNetworkFunctionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendors_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendors_client.go new file mode 100644 index 000000000000..edfdcbff8ce2 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendors_client.go @@ -0,0 +1,305 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// VendorsClient contains the methods for the Vendors group. +// Don't use this type directly, use NewVendorsClient() instead. +type VendorsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVendorsClient creates a new instance of VendorsClient with the specified values. +func NewVendorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VendorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VendorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorsClient) BeginCreateOrUpdate(ctx context.Context, vendorName string, options *VendorsBeginCreateOrUpdateOptions) (VendorsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, vendorName, options) + if err != nil { + return VendorsCreateOrUpdatePollerResponse{}, err + } + result := VendorsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorsClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return VendorsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &VendorsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorsClient) createOrUpdate(ctx context.Context, vendorName string, options *VendorsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, vendorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VendorsClient) createOrUpdateCreateRequest(ctx context.Context, vendorName string, options *VendorsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *VendorsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the specified vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorsClient) BeginDelete(ctx context.Context, vendorName string, options *VendorsBeginDeleteOptions) (VendorsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, vendorName, options) + if err != nil { + return VendorsDeletePollerResponse{}, err + } + result := VendorsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return VendorsDeletePollerResponse{}, err + } + result.Poller = &VendorsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the specified vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorsClient) deleteOperation(ctx context.Context, vendorName string, options *VendorsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, vendorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VendorsClient) deleteCreateRequest(ctx context.Context, vendorName string, options *VendorsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *VendorsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorsClient) Get(ctx context.Context, vendorName string, options *VendorsGetOptions) (VendorsGetResponse, error) { + req, err := client.getCreateRequest(ctx, vendorName, options) + if err != nil { + return VendorsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VendorsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VendorsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VendorsClient) getCreateRequest(ctx context.Context, vendorName string, options *VendorsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VendorsClient) getHandleResponse(resp *http.Response) (VendorsGetResponse, error) { + result := VendorsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Vendor); err != nil { + return VendorsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *VendorsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Lists all the vendors in a subscription. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorsClient) ListBySubscription(options *VendorsListBySubscriptionOptions) *VendorsListBySubscriptionPager { + return &VendorsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp VendorsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VendorListResult.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *VendorsClient) listBySubscriptionCreateRequest(ctx context.Context, options *VendorsListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors" + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *VendorsClient) listBySubscriptionHandleResponse(resp *http.Response) (VendorsListBySubscriptionResponse, error) { + result := VendorsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VendorListResult); err != nil { + return VendorsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *VendorsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskupreview_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskupreview_client.go new file mode 100644 index 000000000000..593f742fedc9 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskupreview_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// VendorSKUPreviewClient contains the methods for the VendorSKUPreview group. +// Don't use this type directly, use NewVendorSKUPreviewClient() instead. +type VendorSKUPreviewClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVendorSKUPreviewClient creates a new instance of VendorSKUPreviewClient with the specified values. +func NewVendorSKUPreviewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VendorSKUPreviewClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VendorSKUPreviewClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates preview information of a vendor sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUPreviewClient) BeginCreateOrUpdate(ctx context.Context, vendorName string, skuName string, previewSubscription string, parameters PreviewSubscription, options *VendorSKUPreviewBeginCreateOrUpdateOptions) (VendorSKUPreviewCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, vendorName, skuName, previewSubscription, parameters, options) + if err != nil { + return VendorSKUPreviewCreateOrUpdatePollerResponse{}, err + } + result := VendorSKUPreviewCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorSKUPreviewClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return VendorSKUPreviewCreateOrUpdatePollerResponse{}, err + } + result.Poller = &VendorSKUPreviewCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates preview information of a vendor sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUPreviewClient) createOrUpdate(ctx context.Context, vendorName string, skuName string, previewSubscription string, parameters PreviewSubscription, options *VendorSKUPreviewBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, vendorName, skuName, previewSubscription, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VendorSKUPreviewClient) createOrUpdateCreateRequest(ctx context.Context, vendorName string, skuName string, previewSubscription string, parameters PreviewSubscription, options *VendorSKUPreviewBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + if previewSubscription == "" { + return nil, errors.New("parameter previewSubscription cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{previewSubscription}", url.PathEscape(previewSubscription)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *VendorSKUPreviewClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the preview information of a vendor sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUPreviewClient) BeginDelete(ctx context.Context, vendorName string, skuName string, previewSubscription string, options *VendorSKUPreviewBeginDeleteOptions) (VendorSKUPreviewDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, vendorName, skuName, previewSubscription, options) + if err != nil { + return VendorSKUPreviewDeletePollerResponse{}, err + } + result := VendorSKUPreviewDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorSKUPreviewClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return VendorSKUPreviewDeletePollerResponse{}, err + } + result.Poller = &VendorSKUPreviewDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the preview information of a vendor sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUPreviewClient) deleteOperation(ctx context.Context, vendorName string, skuName string, previewSubscription string, options *VendorSKUPreviewBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, vendorName, skuName, previewSubscription, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VendorSKUPreviewClient) deleteCreateRequest(ctx context.Context, vendorName string, skuName string, previewSubscription string, options *VendorSKUPreviewBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + if previewSubscription == "" { + return nil, errors.New("parameter previewSubscription cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{previewSubscription}", url.PathEscape(previewSubscription)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *VendorSKUPreviewClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the preview information of a vendor sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUPreviewClient) Get(ctx context.Context, vendorName string, skuName string, previewSubscription string, options *VendorSKUPreviewGetOptions) (VendorSKUPreviewGetResponse, error) { + req, err := client.getCreateRequest(ctx, vendorName, skuName, previewSubscription, options) + if err != nil { + return VendorSKUPreviewGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VendorSKUPreviewGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VendorSKUPreviewGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VendorSKUPreviewClient) getCreateRequest(ctx context.Context, vendorName string, skuName string, previewSubscription string, options *VendorSKUPreviewGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + if previewSubscription == "" { + return nil, errors.New("parameter previewSubscription cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{previewSubscription}", url.PathEscape(previewSubscription)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VendorSKUPreviewClient) getHandleResponse(resp *http.Response) (VendorSKUPreviewGetResponse, error) { + result := VendorSKUPreviewGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PreviewSubscription); err != nil { + return VendorSKUPreviewGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *VendorSKUPreviewClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all the preview information of a vendor sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUPreviewClient) List(vendorName string, skuName string, options *VendorSKUPreviewListOptions) *VendorSKUPreviewListPager { + return &VendorSKUPreviewListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, vendorName, skuName, options) + }, + advancer: func(ctx context.Context, resp VendorSKUPreviewListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PreviewSubscriptionsList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *VendorSKUPreviewClient) listCreateRequest(ctx context.Context, vendorName string, skuName string, options *VendorSKUPreviewListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VendorSKUPreviewClient) listHandleResponse(resp *http.Response) (VendorSKUPreviewListResponse, error) { + result := VendorSKUPreviewListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PreviewSubscriptionsList); err != nil { + return VendorSKUPreviewListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *VendorSKUPreviewClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskus_client.go b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskus_client.go new file mode 100644 index 000000000000..90fe810e9f95 --- /dev/null +++ b/sdk/resourcemanager/hybridnetwork/armhybridnetwork/zz_generated_vendorskus_client.go @@ -0,0 +1,318 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhybridnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "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" +) + +// VendorSKUsClient contains the methods for the VendorSKUs group. +// Don't use this type directly, use NewVendorSKUsClient() instead. +type VendorSKUsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVendorSKUsClient creates a new instance of VendorSKUsClient with the specified values. +func NewVendorSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VendorSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VendorSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUsClient) BeginCreateOrUpdate(ctx context.Context, vendorName string, skuName string, parameters VendorSKU, options *VendorSKUsBeginCreateOrUpdateOptions) (VendorSKUsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, vendorName, skuName, parameters, options) + if err != nil { + return VendorSKUsCreateOrUpdatePollerResponse{}, err + } + result := VendorSKUsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorSKUsClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return VendorSKUsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &VendorSKUsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUsClient) createOrUpdate(ctx context.Context, vendorName string, skuName string, parameters VendorSKU, options *VendorSKUsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, vendorName, skuName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VendorSKUsClient) createOrUpdateCreateRequest(ctx context.Context, vendorName string, skuName string, parameters VendorSKU, options *VendorSKUsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *VendorSKUsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the specified sku. This operation can take up to 2 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUsClient) BeginDelete(ctx context.Context, vendorName string, skuName string, options *VendorSKUsBeginDeleteOptions) (VendorSKUsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, vendorName, skuName, options) + if err != nil { + return VendorSKUsDeletePollerResponse{}, err + } + result := VendorSKUsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VendorSKUsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return VendorSKUsDeletePollerResponse{}, err + } + result.Poller = &VendorSKUsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the specified sku. This operation can take up to 2 hours to complete. This is expected service behavior. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUsClient) deleteOperation(ctx context.Context, vendorName string, skuName string, options *VendorSKUsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, vendorName, skuName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VendorSKUsClient) deleteCreateRequest(ctx context.Context, vendorName string, skuName string, options *VendorSKUsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *VendorSKUsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified sku. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUsClient) Get(ctx context.Context, vendorName string, skuName string, options *VendorSKUsGetOptions) (VendorSKUsGetResponse, error) { + req, err := client.getCreateRequest(ctx, vendorName, skuName, options) + if err != nil { + return VendorSKUsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VendorSKUsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VendorSKUsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VendorSKUsClient) getCreateRequest(ctx context.Context, vendorName string, skuName string, options *VendorSKUsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VendorSKUsClient) getHandleResponse(resp *http.Response) (VendorSKUsGetResponse, error) { + result := VendorSKUsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VendorSKU); err != nil { + return VendorSKUsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *VendorSKUsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all the skus of a vendor. +// If the operation fails it returns the *ErrorResponse error type. +func (client *VendorSKUsClient) List(vendorName string, options *VendorSKUsListOptions) *VendorSKUsListPager { + return &VendorSKUsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, vendorName, options) + }, + advancer: func(ctx context.Context, resp VendorSKUsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VendorSKUListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *VendorSKUsClient) listCreateRequest(ctx context.Context, vendorName string, options *VendorSKUsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus" + if vendorName == "" { + return nil, errors.New("parameter vendorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vendorName}", url.PathEscape(vendorName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VendorSKUsClient) listHandleResponse(resp *http.Response) (VendorSKUsListResponse, error) { + result := VendorSKUsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VendorSKUListResult); err != nil { + return VendorSKUsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *VendorSKUsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +}