From 0862b281d60c434a64155357454adefb3ac65f02 Mon Sep 17 00:00:00 2001 From: 804873052 <804873052@qq.com> Date: Thu, 21 Oct 2021 13:09:40 +0800 Subject: [PATCH 1/3] [Release] sdk/resourcemanager/relay/armrelay/0.1.0 generation from spec commit: 769e09cac92c50b1f9fa6468775b7cb7de16bb06 --- .../relay/armrelay/CHANGELOG.md | 3 + .../relay/armrelay/LICENSE.txt | 21 + sdk/resourcemanager/relay/armrelay/README.md | 76 ++ .../relay/armrelay/autorest.md | 12 + sdk/resourcemanager/relay/armrelay/build.go | 7 + sdk/resourcemanager/relay/armrelay/ci.yml | 27 + sdk/resourcemanager/relay/armrelay/go.mod | 9 + sdk/resourcemanager/relay/armrelay/go.sum | 52 + .../relay/armrelay/go_mod_tidy_hack.go | 13 + .../relay/armrelay/zz_generated_constants.go | 135 +++ .../zz_generated_hybridconnections_client.go | 717 ++++++++++++++ .../relay/armrelay/zz_generated_models.go | 765 +++++++++++++++ .../zz_generated_namespaces_client.go | 885 ++++++++++++++++++ .../zz_generated_operations_client.go | 81 ++ .../relay/armrelay/zz_generated_pagers.go | 450 +++++++++ .../relay/armrelay/zz_generated_pollers.go | 102 ++ .../armrelay/zz_generated_response_types.go | 465 +++++++++ .../armrelay/zz_generated_time_rfc3339.go | 58 ++ .../armrelay/zz_generated_wcfrelays_client.go | 716 ++++++++++++++ 19 files changed, 4594 insertions(+) create mode 100644 sdk/resourcemanager/relay/armrelay/CHANGELOG.md create mode 100644 sdk/resourcemanager/relay/armrelay/LICENSE.txt create mode 100644 sdk/resourcemanager/relay/armrelay/README.md create mode 100644 sdk/resourcemanager/relay/armrelay/autorest.md create mode 100644 sdk/resourcemanager/relay/armrelay/build.go create mode 100644 sdk/resourcemanager/relay/armrelay/ci.yml create mode 100644 sdk/resourcemanager/relay/armrelay/go.mod create mode 100644 sdk/resourcemanager/relay/armrelay/go.sum create mode 100644 sdk/resourcemanager/relay/armrelay/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_constants.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_models.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go diff --git a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md new file mode 100644 index 000000000000..ddf2bd0380ad --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 0.1.0 (2021-10-21) diff --git a/sdk/resourcemanager/relay/armrelay/LICENSE.txt b/sdk/resourcemanager/relay/armrelay/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/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/relay/armrelay/README.md b/sdk/resourcemanager/relay/armrelay/README.md new file mode 100644 index 000000000000..670dba642153 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/README.md @@ -0,0 +1,76 @@ +# Azure Relay Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay) + +The `armrelay` module provides operations for working with Azure Relay. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/relay/armrelay) + +# 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 Relay module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Relay. 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). + +## Connecting to Azure Relay + +Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. + +```go +con := arm.NewDefaultConnection(cred, nil) +``` + +For more information on ARM connections, 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). + +## Clients + +Azure Relay 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 `arm.Connection`. + +```go +client := armrelay.NewHybridConnectionsClient(con, "") +``` + +## 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 `Relay` 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/relay/armrelay/autorest.md b/sdk/resourcemanager/relay/armrelay/autorest.md new file mode 100644 index 000000000000..e19e788c1c8b --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/autorest.md @@ -0,0 +1,12 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/769e09cac92c50b1f9fa6468775b7cb7de16bb06/specification/relay/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/769e09cac92c50b1f9fa6468775b7cb7de16bb06/specification/relay/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/relay/armrelay/build.go b/sdk/resourcemanager/relay/armrelay/build.go new file mode 100644 index 000000000000..f4674a1c5cbf --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/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/relay/armrelay + +package armrelay diff --git a/sdk/resourcemanager/relay/armrelay/ci.yml b/sdk/resourcemanager/relay/armrelay/ci.yml new file mode 100644 index 000000000000..cb68617afb49 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/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/relay/armrelay/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/relay/armrelay/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/relay/armrelay' diff --git a/sdk/resourcemanager/relay/armrelay/go.mod b/sdk/resourcemanager/relay/armrelay/go.mod new file mode 100644 index 000000000000..51d9543b78ac --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/go.mod @@ -0,0 +1,9 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v58.2.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + golang.org/x/tools v0.1.7 // indirect +) diff --git a/sdk/resourcemanager/relay/armrelay/go.sum b/sdk/resourcemanager/relay/armrelay/go.sum new file mode 100644 index 000000000000..b3b5161902ad --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/go.sum @@ -0,0 +1,52 @@ +github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= +github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +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.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +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= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +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/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +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-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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.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= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/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/relay/armrelay/go_mod_tidy_hack.go b/sdk/resourcemanager/relay/armrelay/go_mod_tidy_hack.go new file mode 100644 index 000000000000..7614ac160563 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/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 armrelay + +// 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/relay/armrelay/zz_generated_constants.go b/sdk/resourcemanager/relay/armrelay/zz_generated_constants.go new file mode 100644 index 000000000000..9ff81d033ca6 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_constants.go @@ -0,0 +1,135 @@ +//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 armrelay + +const ( + module = "armrelay" + version = "v0.1.0" +) + +type AccessRights string + +const ( + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" + AccessRightsListen AccessRights = "Listen" +) + +// PossibleAccessRightsValues returns the possible values for the AccessRights const type. +func PossibleAccessRightsValues() []AccessRights { + return []AccessRights{ + AccessRightsManage, + AccessRightsSend, + AccessRightsListen, + } +} + +// ToPtr returns a *AccessRights pointing to the current value. +func (c AccessRights) ToPtr() *AccessRights { + return &c +} + +// KeyType - The access key to regenerate. +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +// PossibleKeyTypeValues returns the possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{ + KeyTypePrimaryKey, + KeyTypeSecondaryKey, + } +} + +// ToPtr returns a *KeyType pointing to the current value. +func (c KeyType) ToPtr() *KeyType { + return &c +} + +type ProvisioningStateEnum string + +const ( + ProvisioningStateEnumCreated ProvisioningStateEnum = "Created" + ProvisioningStateEnumSucceeded ProvisioningStateEnum = "Succeeded" + ProvisioningStateEnumDeleted ProvisioningStateEnum = "Deleted" + ProvisioningStateEnumFailed ProvisioningStateEnum = "Failed" + ProvisioningStateEnumUpdating ProvisioningStateEnum = "Updating" + ProvisioningStateEnumUnknown ProvisioningStateEnum = "Unknown" +) + +// PossibleProvisioningStateEnumValues returns the possible values for the ProvisioningStateEnum const type. +func PossibleProvisioningStateEnumValues() []ProvisioningStateEnum { + return []ProvisioningStateEnum{ + ProvisioningStateEnumCreated, + ProvisioningStateEnumSucceeded, + ProvisioningStateEnumDeleted, + ProvisioningStateEnumFailed, + ProvisioningStateEnumUpdating, + ProvisioningStateEnumUnknown, + } +} + +// ToPtr returns a *ProvisioningStateEnum pointing to the current value. +func (c ProvisioningStateEnum) ToPtr() *ProvisioningStateEnum { + return &c +} + +// Relaytype - WCF relay type. +type Relaytype string + +const ( + RelaytypeNetTCP Relaytype = "NetTcp" + RelaytypeHTTP Relaytype = "Http" +) + +// PossibleRelaytypeValues returns the possible values for the Relaytype const type. +func PossibleRelaytypeValues() []Relaytype { + return []Relaytype{ + RelaytypeNetTCP, + RelaytypeHTTP, + } +} + +// ToPtr returns a *Relaytype pointing to the current value. +func (c Relaytype) ToPtr() *Relaytype { + return &c +} + +// UnavailableReason - Specifies the reason for the unavailability of the service. +type UnavailableReason string + +const ( + UnavailableReasonNone UnavailableReason = "None" + UnavailableReasonInvalidName UnavailableReason = "InvalidName" + UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + UnavailableReasonNameInUse UnavailableReason = "NameInUse" + UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" + UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// PossibleUnavailableReasonValues returns the possible values for the UnavailableReason const type. +func PossibleUnavailableReasonValues() []UnavailableReason { + return []UnavailableReason{ + UnavailableReasonNone, + UnavailableReasonInvalidName, + UnavailableReasonSubscriptionIsDisabled, + UnavailableReasonNameInUse, + UnavailableReasonNameInLockdown, + UnavailableReasonTooManyNamespaceInCurrentSubscription, + } +} + +// ToPtr returns a *UnavailableReason pointing to the current value. +func (c UnavailableReason) ToPtr() *UnavailableReason { + return &c +} diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go new file mode 100644 index 000000000000..2a2517582a44 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go @@ -0,0 +1,717 @@ +//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 armrelay + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// HybridConnectionsClient contains the methods for the HybridConnections group. +// Don't use this type directly, use NewHybridConnectionsClient() instead. +type HybridConnectionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewHybridConnectionsClient creates a new instance of HybridConnectionsClient with the specified values. +func NewHybridConnectionsClient(con *arm.Connection, subscriptionID string) *HybridConnectionsClient { + return &HybridConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates a service hybrid connection. This operation is idempotent. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, parameters HybridConnection, options *HybridConnectionsCreateOrUpdateOptions) (HybridConnectionsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, parameters, options) + if err != nil { + return HybridConnectionsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridConnectionsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *HybridConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, parameters HybridConnection, options *HybridConnectionsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *HybridConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (HybridConnectionsCreateOrUpdateResponse, error) { + result := HybridConnectionsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { + return HybridConnectionsCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *HybridConnectionsClient) 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) +} + +// CreateOrUpdateAuthorizationRule - Creates or updates an authorization rule for a hybrid connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters AuthorizationRule, options *HybridConnectionsCreateOrUpdateAuthorizationRuleOptions) (HybridConnectionsCreateOrUpdateAuthorizationRuleResponse, error) { + req, err := client.createOrUpdateAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters, options) + if err != nil { + return HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{}, client.createOrUpdateAuthorizationRuleHandleError(resp) + } + return client.createOrUpdateAuthorizationRuleHandleResponse(resp) +} + +// createOrUpdateAuthorizationRuleCreateRequest creates the CreateOrUpdateAuthorizationRule request. +func (client *HybridConnectionsClient) createOrUpdateAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters AuthorizationRule, options *HybridConnectionsCreateOrUpdateAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateAuthorizationRuleHandleResponse handles the CreateOrUpdateAuthorizationRule response. +func (client *HybridConnectionsClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (HybridConnectionsCreateOrUpdateAuthorizationRuleResponse, error) { + result := HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { + return HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{}, err + } + return result, nil +} + +// createOrUpdateAuthorizationRuleHandleError handles the CreateOrUpdateAuthorizationRule error response. +func (client *HybridConnectionsClient) createOrUpdateAuthorizationRuleHandleError(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) +} + +// Delete - Deletes a hybrid connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, options *HybridConnectionsDeleteOptions) (HybridConnectionsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, options) + if err != nil { + return HybridConnectionsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return HybridConnectionsDeleteResponse{}, client.deleteHandleError(resp) + } + return HybridConnectionsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HybridConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, options *HybridConnectionsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + 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", "2017-04-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 *HybridConnectionsClient) 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) +} + +// DeleteAuthorizationRule - Deletes a hybrid connection authorization rule. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, options *HybridConnectionsDeleteAuthorizationRuleOptions) (HybridConnectionsDeleteAuthorizationRuleResponse, error) { + req, err := client.deleteAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, options) + if err != nil { + return HybridConnectionsDeleteAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsDeleteAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return HybridConnectionsDeleteAuthorizationRuleResponse{}, client.deleteAuthorizationRuleHandleError(resp) + } + return HybridConnectionsDeleteAuthorizationRuleResponse{RawResponse: resp}, nil +} + +// deleteAuthorizationRuleCreateRequest creates the DeleteAuthorizationRule request. +func (client *HybridConnectionsClient) deleteAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, options *HybridConnectionsDeleteAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteAuthorizationRuleHandleError handles the DeleteAuthorizationRule error response. +func (client *HybridConnectionsClient) deleteAuthorizationRuleHandleError(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 - Returns the description for the specified hybrid connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, options *HybridConnectionsGetOptions) (HybridConnectionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, options) + if err != nil { + return HybridConnectionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridConnectionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *HybridConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, options *HybridConnectionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HybridConnectionsClient) getHandleResponse(resp *http.Response) (HybridConnectionsGetResponse, error) { + result := HybridConnectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { + return HybridConnectionsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *HybridConnectionsClient) 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) +} + +// GetAuthorizationRule - Hybrid connection authorization rule for a hybrid connection by name. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, options *HybridConnectionsGetAuthorizationRuleOptions) (HybridConnectionsGetAuthorizationRuleResponse, error) { + req, err := client.getAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, options) + if err != nil { + return HybridConnectionsGetAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsGetAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridConnectionsGetAuthorizationRuleResponse{}, client.getAuthorizationRuleHandleError(resp) + } + return client.getAuthorizationRuleHandleResponse(resp) +} + +// getAuthorizationRuleCreateRequest creates the GetAuthorizationRule request. +func (client *HybridConnectionsClient) getAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, options *HybridConnectionsGetAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getAuthorizationRuleHandleResponse handles the GetAuthorizationRule response. +func (client *HybridConnectionsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (HybridConnectionsGetAuthorizationRuleResponse, error) { + result := HybridConnectionsGetAuthorizationRuleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { + return HybridConnectionsGetAuthorizationRuleResponse{}, err + } + return result, nil +} + +// getAuthorizationRuleHandleError handles the GetAuthorizationRule error response. +func (client *HybridConnectionsClient) getAuthorizationRuleHandleError(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) +} + +// ListAuthorizationRules - Authorization rules for a hybrid connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, hybridConnectionName string, options *HybridConnectionsListAuthorizationRulesOptions) *HybridConnectionsListAuthorizationRulesPager { + return &HybridConnectionsListAuthorizationRulesPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listAuthorizationRulesCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, options) + }, + advancer: func(ctx context.Context, resp HybridConnectionsListAuthorizationRulesResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AuthorizationRuleListResult.NextLink) + }, + } +} + +// listAuthorizationRulesCreateRequest creates the ListAuthorizationRules request. +func (client *HybridConnectionsClient) listAuthorizationRulesCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, options *HybridConnectionsListAuthorizationRulesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listAuthorizationRulesHandleResponse handles the ListAuthorizationRules response. +func (client *HybridConnectionsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (HybridConnectionsListAuthorizationRulesResponse, error) { + result := HybridConnectionsListAuthorizationRulesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { + return HybridConnectionsListAuthorizationRulesResponse{}, err + } + return result, nil +} + +// listAuthorizationRulesHandleError handles the ListAuthorizationRules error response. +func (client *HybridConnectionsClient) listAuthorizationRulesHandleError(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) +} + +// ListByNamespace - Lists the hybrid connection within the namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) ListByNamespace(resourceGroupName string, namespaceName string, options *HybridConnectionsListByNamespaceOptions) *HybridConnectionsListByNamespacePager { + return &HybridConnectionsListByNamespacePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) + }, + advancer: func(ctx context.Context, resp HybridConnectionsListByNamespaceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.HybridConnectionListResult.NextLink) + }, + } +} + +// listByNamespaceCreateRequest creates the ListByNamespace request. +func (client *HybridConnectionsClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *HybridConnectionsListByNamespaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByNamespaceHandleResponse handles the ListByNamespace response. +func (client *HybridConnectionsClient) listByNamespaceHandleResponse(resp *http.Response) (HybridConnectionsListByNamespaceResponse, error) { + result := HybridConnectionsListByNamespaceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnectionListResult); err != nil { + return HybridConnectionsListByNamespaceResponse{}, err + } + return result, nil +} + +// listByNamespaceHandleError handles the ListByNamespace error response. +func (client *HybridConnectionsClient) listByNamespaceHandleError(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) +} + +// ListKeys - Primary and secondary connection strings to the hybrid connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, options *HybridConnectionsListKeysOptions) (HybridConnectionsListKeysResponse, error) { + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, options) + if err != nil { + return HybridConnectionsListKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsListKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridConnectionsListKeysResponse{}, client.listKeysHandleError(resp) + } + return client.listKeysHandleResponse(resp) +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *HybridConnectionsClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, options *HybridConnectionsListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/listKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *HybridConnectionsClient) listKeysHandleResponse(resp *http.Response) (HybridConnectionsListKeysResponse, error) { + result := HybridConnectionsListKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { + return HybridConnectionsListKeysResponse{}, err + } + return result, nil +} + +// listKeysHandleError handles the ListKeys error response. +func (client *HybridConnectionsClient) listKeysHandleError(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) +} + +// RegenerateKeys - Regenerates the primary or secondary connection strings to the hybrid connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *HybridConnectionsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *HybridConnectionsRegenerateKeysOptions) (HybridConnectionsRegenerateKeysResponse, error) { + req, err := client.regenerateKeysCreateRequest(ctx, resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters, options) + if err != nil { + return HybridConnectionsRegenerateKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HybridConnectionsRegenerateKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridConnectionsRegenerateKeysResponse{}, client.regenerateKeysHandleError(resp) + } + return client.regenerateKeysHandleResponse(resp) +} + +// regenerateKeysCreateRequest creates the RegenerateKeys request. +func (client *HybridConnectionsClient) regenerateKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *HybridConnectionsRegenerateKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if hybridConnectionName == "" { + return nil, errors.New("parameter hybridConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hybridConnectionName}", url.PathEscape(hybridConnectionName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// regenerateKeysHandleResponse handles the RegenerateKeys response. +func (client *HybridConnectionsClient) regenerateKeysHandleResponse(resp *http.Response) (HybridConnectionsRegenerateKeysResponse, error) { + result := HybridConnectionsRegenerateKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { + return HybridConnectionsRegenerateKeysResponse{}, err + } + return result, nil +} + +// regenerateKeysHandleError handles the RegenerateKeys error response. +func (client *HybridConnectionsClient) regenerateKeysHandleError(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/relay/armrelay/zz_generated_models.go b/sdk/resourcemanager/relay/armrelay/zz_generated_models.go new file mode 100644 index 000000000000..c03d73147dad --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_models.go @@ -0,0 +1,765 @@ +//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 armrelay + +import ( + "encoding/json" + "reflect" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) + +// AccessKeys - Namespace/Relay Connection String +type AccessKeys struct { + // A string that describes the authorization rule. + KeyName *string `json:"keyName,omitempty"` + + // Primary connection string of the created namespace authorization rule. + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + + // A base64-encoded 256-bit primary key for signing and validating the SAS token. + PrimaryKey *string `json:"primaryKey,omitempty"` + + // Secondary connection string of the created namespace authorization rule. + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + + // A base64-encoded 256-bit secondary key for signing and validating the SAS token. + SecondaryKey *string `json:"secondaryKey,omitempty"` +} + +// AuthorizationRule - Description of a namespace authorization rule. +type AuthorizationRule struct { + Resource + // REQUIRED; Authorization rule properties. + Properties *AuthorizationRuleProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationRule. +func (a AuthorizationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// AuthorizationRuleListResult - The response from the list namespace operation. +type AuthorizationRuleListResult struct { + // Link to the next set of results. Not empty if value contains incomplete list of authorization rules. + NextLink *string `json:"nextLink,omitempty"` + + // Result of the list authorization rules operation. + Value []*AuthorizationRule `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationRuleListResult. +func (a AuthorizationRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// AuthorizationRuleProperties - Authorization rule properties. +type AuthorizationRuleProperties struct { + // REQUIRED; The rights associated with the rule. + Rights []*AccessRights `json:"rights,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationRuleProperties. +func (a AuthorizationRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rights", a.Rights) + return json.Marshal(objectMap) +} + +// CheckNameAvailability - Description of the check name availability request properties. +type CheckNameAvailability struct { + // REQUIRED; The namespace name to check for availability. The namespace name can contain only letters, numbers, and hyphens. The namespace must start with + // a letter, and it must end with a letter or number. + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult - Description of the check name availability request properties. +type CheckNameAvailabilityResult struct { + // Value indicating namespace is available. Returns true if the namespace is available; otherwise, false. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // The reason for unavailability of a namespace. + Reason *UnavailableReason `json:"reason,omitempty"` + + // READ-ONLY; The detailed info regarding the reason associated with the namespace. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// ErrorResponse - Error reponse indicates Relay service is not able to process the incoming request. The reason is provided in the error message. +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorResponse struct { + raw string + // Error code. + Code *string `json:"code,omitempty"` + + // Error message indicating why the operation failed. + Message *string `json:"message,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 +} + +// HybridConnection - Description of hybrid connection resource. +type HybridConnection struct { + Resource + // Properties of the HybridConnection. + Properties *HybridConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type HybridConnection. +func (h HybridConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + h.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", h.Properties) + return json.Marshal(objectMap) +} + +// HybridConnectionListResult - The response of the list hybrid connection operation. +type HybridConnectionListResult struct { + // Link to the next set of results. Not empty if value contains incomplete list hybrid connection operation. + NextLink *string `json:"nextLink,omitempty"` + + // Result of the list hybrid connections. + Value []*HybridConnection `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type HybridConnectionListResult. +func (h HybridConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// HybridConnectionProperties - Properties of the HybridConnection. +type HybridConnectionProperties struct { + // Returns true if client authorization is needed for this hybrid connection; otherwise, false. + RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` + + // The usermetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive + // data, such as a list of teams and their contact + // information. Also, user-defined configuration settings can be stored. + UserMetadata *string `json:"userMetadata,omitempty"` + + // READ-ONLY; The time the hybrid connection was created. + CreatedAt *time.Time `json:"createdAt,omitempty" azure:"ro"` + + // READ-ONLY; The number of listeners for this hybrid connection. Note that min : 1 and max:25 are supported. + ListenerCount *int32 `json:"listenerCount,omitempty" azure:"ro"` + + // READ-ONLY; The time the namespace was updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type HybridConnectionProperties. +func (h HybridConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdAt", (*timeRFC3339)(h.CreatedAt)) + populate(objectMap, "listenerCount", h.ListenerCount) + populate(objectMap, "requiresClientAuthorization", h.RequiresClientAuthorization) + populate(objectMap, "updatedAt", (*timeRFC3339)(h.UpdatedAt)) + populate(objectMap, "userMetadata", h.UserMetadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridConnectionProperties. +func (h *HybridConnectionProperties) 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": + var aux timeRFC3339 + err = unpopulate(val, &aux) + h.CreatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "listenerCount": + err = unpopulate(val, &h.ListenerCount) + delete(rawMsg, key) + case "requiresClientAuthorization": + err = unpopulate(val, &h.RequiresClientAuthorization) + delete(rawMsg, key) + case "updatedAt": + var aux timeRFC3339 + err = unpopulate(val, &aux) + h.UpdatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "userMetadata": + err = unpopulate(val, &h.UserMetadata) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// HybridConnectionsCreateOrUpdateAuthorizationRuleOptions contains the optional parameters for the HybridConnections.CreateOrUpdateAuthorizationRule method. +type HybridConnectionsCreateOrUpdateAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsCreateOrUpdateOptions contains the optional parameters for the HybridConnections.CreateOrUpdate method. +type HybridConnectionsCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsDeleteAuthorizationRuleOptions contains the optional parameters for the HybridConnections.DeleteAuthorizationRule method. +type HybridConnectionsDeleteAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsDeleteOptions contains the optional parameters for the HybridConnections.Delete method. +type HybridConnectionsDeleteOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsGetAuthorizationRuleOptions contains the optional parameters for the HybridConnections.GetAuthorizationRule method. +type HybridConnectionsGetAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsGetOptions contains the optional parameters for the HybridConnections.Get method. +type HybridConnectionsGetOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsListAuthorizationRulesOptions contains the optional parameters for the HybridConnections.ListAuthorizationRules method. +type HybridConnectionsListAuthorizationRulesOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsListByNamespaceOptions contains the optional parameters for the HybridConnections.ListByNamespace method. +type HybridConnectionsListByNamespaceOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsListKeysOptions contains the optional parameters for the HybridConnections.ListKeys method. +type HybridConnectionsListKeysOptions struct { + // placeholder for future optional parameters +} + +// HybridConnectionsRegenerateKeysOptions contains the optional parameters for the HybridConnections.RegenerateKeys method. +type HybridConnectionsRegenerateKeysOptions struct { + // placeholder for future optional parameters +} + +// NamespacesBeginCreateOrUpdateOptions contains the optional parameters for the Namespaces.BeginCreateOrUpdate method. +type NamespacesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// NamespacesBeginDeleteOptions contains the optional parameters for the Namespaces.BeginDelete method. +type NamespacesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// NamespacesCheckNameAvailabilityOptions contains the optional parameters for the Namespaces.CheckNameAvailability method. +type NamespacesCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// NamespacesCreateOrUpdateAuthorizationRuleOptions contains the optional parameters for the Namespaces.CreateOrUpdateAuthorizationRule method. +type NamespacesCreateOrUpdateAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// NamespacesDeleteAuthorizationRuleOptions contains the optional parameters for the Namespaces.DeleteAuthorizationRule method. +type NamespacesDeleteAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// NamespacesGetAuthorizationRuleOptions contains the optional parameters for the Namespaces.GetAuthorizationRule method. +type NamespacesGetAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// NamespacesGetOptions contains the optional parameters for the Namespaces.Get method. +type NamespacesGetOptions struct { + // placeholder for future optional parameters +} + +// NamespacesListAuthorizationRulesOptions contains the optional parameters for the Namespaces.ListAuthorizationRules method. +type NamespacesListAuthorizationRulesOptions struct { + // placeholder for future optional parameters +} + +// NamespacesListByResourceGroupOptions contains the optional parameters for the Namespaces.ListByResourceGroup method. +type NamespacesListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// NamespacesListKeysOptions contains the optional parameters for the Namespaces.ListKeys method. +type NamespacesListKeysOptions struct { + // placeholder for future optional parameters +} + +// NamespacesListOptions contains the optional parameters for the Namespaces.List method. +type NamespacesListOptions struct { + // placeholder for future optional parameters +} + +// NamespacesRegenerateKeysOptions contains the optional parameters for the Namespaces.RegenerateKeys method. +type NamespacesRegenerateKeysOptions struct { + // placeholder for future optional parameters +} + +// NamespacesUpdateOptions contains the optional parameters for the Namespaces.Update method. +type NamespacesUpdateOptions struct { + // placeholder for future optional parameters +} + +// Operation - A Relay REST API operation. +type Operation struct { + // The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` + + // READ-ONLY; Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty" azure:"ro"` +} + +// OperationDisplay - The object that represents the operation. +type OperationDisplay struct { + // READ-ONLY; Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; Service provider: Relay. + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; Resource on which the operation is performed: Invoice, etc. + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationListResult - Result of the request to list Relay operations. It contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of Relay operations supported by resource provider. + Value []*Operation `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) 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 +} + +// RegenerateAccessKeyParameters - Parameters supplied to the regenerate authorization rule operation, specifies which key neeeds to be reset. +type RegenerateAccessKeyParameters struct { + // REQUIRED; The access key to regenerate. + KeyType *KeyType `json:"keyType,omitempty"` + + // Optional. If the key value is provided, this is set to key type, or autogenerated key value set for key type. + Key *string `json:"key,omitempty"` +} + +// RelayNamespace - Description of a namespace resource. +type RelayNamespace struct { + TrackedResource + // Description of Relay namespace + Properties *RelayNamespaceProperties `json:"properties,omitempty"` + + // SKU of the namespace. + SKU *SKU `json:"sku,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RelayNamespace. +func (r RelayNamespace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + return json.Marshal(objectMap) +} + +// RelayNamespaceListResult - The response from the list namespace operation. +type RelayNamespaceListResult struct { + // Link to the next set of results. Not empty if value contains incomplete list of namespaces. + NextLink *string `json:"nextLink,omitempty"` + + // Result of the list namespace operation. + Value []*RelayNamespace `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RelayNamespaceListResult. +func (r RelayNamespaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// RelayNamespaceProperties - Properties of the namespace. +type RelayNamespaceProperties struct { + // READ-ONLY; The time the namespace was created. + CreatedAt *time.Time `json:"createdAt,omitempty" azure:"ro"` + + // READ-ONLY; Identifier for Azure Insights metrics. + MetricID *string `json:"metricId,omitempty" azure:"ro"` + + // READ-ONLY + ProvisioningState *ProvisioningStateEnum `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Endpoint you can use to perform Service Bus operations. + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The time the namespace was updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type RelayNamespaceProperties. +func (r RelayNamespaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdAt", (*timeRFC3339)(r.CreatedAt)) + populate(objectMap, "metricId", r.MetricID) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "serviceBusEndpoint", r.ServiceBusEndpoint) + populate(objectMap, "updatedAt", (*timeRFC3339)(r.UpdatedAt)) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelayNamespaceProperties. +func (r *RelayNamespaceProperties) 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": + var aux timeRFC3339 + err = unpopulate(val, &aux) + r.CreatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "metricId": + err = unpopulate(val, &r.MetricID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &r.ProvisioningState) + delete(rawMsg, key) + case "serviceBusEndpoint": + err = unpopulate(val, &r.ServiceBusEndpoint) + delete(rawMsg, key) + case "updatedAt": + var aux timeRFC3339 + err = unpopulate(val, &aux) + r.UpdatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// RelayUpdateParameters - Description of a namespace resource. +type RelayUpdateParameters struct { + ResourceNamespacePatch + // Description of Relay namespace. + Properties *RelayNamespaceProperties `json:"properties,omitempty"` + + // SKU of the namespace. + SKU *SKU `json:"sku,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RelayUpdateParameters. +func (r RelayUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.ResourceNamespacePatch.marshalInternal(objectMap) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + return json.Marshal(objectMap) +} + +// Resource - The resource definition. +type Resource struct { + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + 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) +} + +func (r Resource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) +} + +// ResourceNamespacePatch - Definition of resource. +type ResourceNamespacePatch struct { + Resource + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceNamespacePatch. +func (r ResourceNamespacePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (r ResourceNamespacePatch) marshalInternal(objectMap map[string]interface{}) { + r.Resource.marshalInternal(objectMap) + populate(objectMap, "tags", r.Tags) +} + +// SKU of the namespace. +type SKU struct { + // REQUIRED; Name of this SKU. + Name *string `json:"name,omitempty"` + + // The tier of this SKU. + Tier *string `json:"tier,omitempty"` +} + +// TrackedResource - Definition of resource. +type TrackedResource struct { + Resource + // REQUIRED; Resource location. + 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) +} + +func (t TrackedResource) marshalInternal(objectMap map[string]interface{}) { + t.Resource.marshalInternal(objectMap) + populate(objectMap, "location", t.Location) + populate(objectMap, "tags", t.Tags) +} + +// WCFRelaysCreateOrUpdateAuthorizationRuleOptions contains the optional parameters for the WCFRelays.CreateOrUpdateAuthorizationRule method. +type WCFRelaysCreateOrUpdateAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysCreateOrUpdateOptions contains the optional parameters for the WCFRelays.CreateOrUpdate method. +type WCFRelaysCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysDeleteAuthorizationRuleOptions contains the optional parameters for the WCFRelays.DeleteAuthorizationRule method. +type WCFRelaysDeleteAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysDeleteOptions contains the optional parameters for the WCFRelays.Delete method. +type WCFRelaysDeleteOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysGetAuthorizationRuleOptions contains the optional parameters for the WCFRelays.GetAuthorizationRule method. +type WCFRelaysGetAuthorizationRuleOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysGetOptions contains the optional parameters for the WCFRelays.Get method. +type WCFRelaysGetOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysListAuthorizationRulesOptions contains the optional parameters for the WCFRelays.ListAuthorizationRules method. +type WCFRelaysListAuthorizationRulesOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysListByNamespaceOptions contains the optional parameters for the WCFRelays.ListByNamespace method. +type WCFRelaysListByNamespaceOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysListKeysOptions contains the optional parameters for the WCFRelays.ListKeys method. +type WCFRelaysListKeysOptions struct { + // placeholder for future optional parameters +} + +// WCFRelaysRegenerateKeysOptions contains the optional parameters for the WCFRelays.RegenerateKeys method. +type WCFRelaysRegenerateKeysOptions struct { + // placeholder for future optional parameters +} + +// WcfRelay - Description of the WCF relay resource. +type WcfRelay struct { + Resource + // Properties of the WCF relay. + Properties *WcfRelayProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type WcfRelay. +func (w WcfRelay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + w.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", w.Properties) + return json.Marshal(objectMap) +} + +// WcfRelayProperties - Properties of the WCF relay. +type WcfRelayProperties struct { + // WCF relay type. + RelayType *Relaytype `json:"relayType,omitempty"` + + // Returns true if client authorization is needed for this relay; otherwise, false. + RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` + + // Returns true if transport security is needed for this relay; otherwise, false. + RequiresTransportSecurity *bool `json:"requiresTransportSecurity,omitempty"` + + // The usermetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, + // such as list of teams and their contact + // information. Also, user-defined configuration settings can be stored. + UserMetadata *string `json:"userMetadata,omitempty"` + + // READ-ONLY; The time the WCF relay was created. + CreatedAt *time.Time `json:"createdAt,omitempty" azure:"ro"` + + // READ-ONLY; Returns true if the relay is dynamic; otherwise, false. + IsDynamic *bool `json:"isDynamic,omitempty" azure:"ro"` + + // READ-ONLY; The number of listeners for this relay. Note that min :1 and max:25 are supported. + ListenerCount *int32 `json:"listenerCount,omitempty" azure:"ro"` + + // READ-ONLY; The time the namespace was updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type WcfRelayProperties. +func (w WcfRelayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdAt", (*timeRFC3339)(w.CreatedAt)) + populate(objectMap, "isDynamic", w.IsDynamic) + populate(objectMap, "listenerCount", w.ListenerCount) + populate(objectMap, "relayType", w.RelayType) + populate(objectMap, "requiresClientAuthorization", w.RequiresClientAuthorization) + populate(objectMap, "requiresTransportSecurity", w.RequiresTransportSecurity) + populate(objectMap, "updatedAt", (*timeRFC3339)(w.UpdatedAt)) + populate(objectMap, "userMetadata", w.UserMetadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WcfRelayProperties. +func (w *WcfRelayProperties) 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": + var aux timeRFC3339 + err = unpopulate(val, &aux) + w.CreatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "isDynamic": + err = unpopulate(val, &w.IsDynamic) + delete(rawMsg, key) + case "listenerCount": + err = unpopulate(val, &w.ListenerCount) + delete(rawMsg, key) + case "relayType": + err = unpopulate(val, &w.RelayType) + delete(rawMsg, key) + case "requiresClientAuthorization": + err = unpopulate(val, &w.RequiresClientAuthorization) + delete(rawMsg, key) + case "requiresTransportSecurity": + err = unpopulate(val, &w.RequiresTransportSecurity) + delete(rawMsg, key) + case "updatedAt": + var aux timeRFC3339 + err = unpopulate(val, &aux) + w.UpdatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "userMetadata": + err = unpopulate(val, &w.UserMetadata) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// WcfRelaysListResult - The response of the list WCF relay operation. +type WcfRelaysListResult struct { + // Link to the next set of results. Not empty if value contains incomplete list of WCF relays. + NextLink *string `json:"nextLink,omitempty"` + + // Result of the list WCF relay operation. + Value []*WcfRelay `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type WcfRelaysListResult. +func (w WcfRelaysListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +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/relay/armrelay/zz_generated_namespaces_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go new file mode 100644 index 000000000000..486e770852b1 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go @@ -0,0 +1,885 @@ +//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 armrelay + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "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" +) + +// NamespacesClient contains the methods for the Namespaces group. +// Don't use this type directly, use NewNamespacesClient() instead. +type NamespacesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNamespacesClient creates a new instance of NamespacesClient with the specified values. +func NewNamespacesClient(con *arm.Connection, subscriptionID string) *NamespacesClient { + return &NamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CheckNameAvailability - Check the specified namespace name availability. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailability, options *NamespacesCheckNameAvailabilityOptions) (NamespacesCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, parameters, options) + if err != nil { + return NamespacesCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesCheckNameAvailabilityResponse{}, client.checkNameAvailabilityHandleError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.Context, parameters CheckNameAvailability, options *NamespacesCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *NamespacesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (NamespacesCheckNameAvailabilityResponse, error) { + result := NamespacesCheckNameAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { + return NamespacesCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// checkNameAvailabilityHandleError handles the CheckNameAvailability error response. +func (client *NamespacesClient) checkNameAvailabilityHandleError(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) +} + +// BeginCreateOrUpdate - Create Azure Relay namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, parameters RelayNamespace, options *NamespacesBeginCreateOrUpdateOptions) (NamespacesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, parameters, options) + if err != nil { + return NamespacesCreateOrUpdatePollerResponse{}, err + } + result := NamespacesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("NamespacesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return NamespacesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &NamespacesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create Azure Relay namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, parameters RelayNamespace, options *NamespacesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, 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 *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, parameters RelayNamespace, options *NamespacesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-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 *NamespacesClient) 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) +} + +// CreateOrUpdateAuthorizationRule - Creates or updates an authorization rule for a namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters AuthorizationRule, options *NamespacesCreateOrUpdateAuthorizationRuleOptions) (NamespacesCreateOrUpdateAuthorizationRuleResponse, error) { + req, err := client.createOrUpdateAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters, options) + if err != nil { + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, client.createOrUpdateAuthorizationRuleHandleError(resp) + } + return client.createOrUpdateAuthorizationRuleHandleResponse(resp) +} + +// createOrUpdateAuthorizationRuleCreateRequest creates the CreateOrUpdateAuthorizationRule request. +func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters AuthorizationRule, options *NamespacesCreateOrUpdateAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateAuthorizationRuleHandleResponse handles the CreateOrUpdateAuthorizationRule response. +func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateAuthorizationRuleResponse, error) { + result := NamespacesCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + } + return result, nil +} + +// createOrUpdateAuthorizationRuleHandleError handles the CreateOrUpdateAuthorizationRule error response. +func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleError(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 an existing namespace. This operation also removes all associated resources under the namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesBeginDeleteOptions) (NamespacesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, options) + if err != nil { + return NamespacesDeletePollerResponse{}, err + } + result := NamespacesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("NamespacesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return NamespacesDeletePollerResponse{}, err + } + result.Poller = &NamespacesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes an existing namespace. This operation also removes all associated resources under the namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, 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 *NamespacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-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 *NamespacesClient) 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) +} + +// DeleteAuthorizationRule - Deletes a namespace authorization rule. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *NamespacesDeleteAuthorizationRuleOptions) (NamespacesDeleteAuthorizationRuleResponse, error) { + req, err := client.deleteAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, authorizationRuleName, options) + if err != nil { + return NamespacesDeleteAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesDeleteAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return NamespacesDeleteAuthorizationRuleResponse{}, client.deleteAuthorizationRuleHandleError(resp) + } + return NamespacesDeleteAuthorizationRuleResponse{RawResponse: resp}, nil +} + +// deleteAuthorizationRuleCreateRequest creates the DeleteAuthorizationRule request. +func (client *NamespacesClient) deleteAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *NamespacesDeleteAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteAuthorizationRuleHandleError handles the DeleteAuthorizationRule error response. +func (client *NamespacesClient) deleteAuthorizationRuleHandleError(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 - Returns the description for the specified namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesGetOptions) (NamespacesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, options) + if err != nil { + return NamespacesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NamespacesClient) getHandleResponse(resp *http.Response) (NamespacesGetResponse, error) { + result := NamespacesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespace); err != nil { + return NamespacesGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *NamespacesClient) 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) +} + +// GetAuthorizationRule - Authorization rule for a namespace by name. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *NamespacesGetAuthorizationRuleOptions) (NamespacesGetAuthorizationRuleResponse, error) { + req, err := client.getAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, authorizationRuleName, options) + if err != nil { + return NamespacesGetAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesGetAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesGetAuthorizationRuleResponse{}, client.getAuthorizationRuleHandleError(resp) + } + return client.getAuthorizationRuleHandleResponse(resp) +} + +// getAuthorizationRuleCreateRequest creates the GetAuthorizationRule request. +func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *NamespacesGetAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getAuthorizationRuleHandleResponse handles the GetAuthorizationRule response. +func (client *NamespacesClient) getAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesGetAuthorizationRuleResponse, error) { + result := NamespacesGetAuthorizationRuleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { + return NamespacesGetAuthorizationRuleResponse{}, err + } + return result, nil +} + +// getAuthorizationRuleHandleError handles the GetAuthorizationRule error response. +func (client *NamespacesClient) getAuthorizationRuleHandleError(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 available namespaces within the subscription regardless of the resourceGroups. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) List(options *NamespacesListOptions) *NamespacesListPager { + return &NamespacesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp NamespacesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RelayNamespaceListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *NamespacesClient) listCreateRequest(ctx context.Context, options *NamespacesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Relay/namespaces" + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NamespacesClient) listHandleResponse(resp *http.Response) (NamespacesListResponse, error) { + result := NamespacesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespaceListResult); err != nil { + return NamespacesListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *NamespacesClient) 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) +} + +// ListAuthorizationRules - Authorization rules for a namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, options *NamespacesListAuthorizationRulesOptions) *NamespacesListAuthorizationRulesPager { + return &NamespacesListAuthorizationRulesPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listAuthorizationRulesCreateRequest(ctx, resourceGroupName, namespaceName, options) + }, + advancer: func(ctx context.Context, resp NamespacesListAuthorizationRulesResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AuthorizationRuleListResult.NextLink) + }, + } +} + +// listAuthorizationRulesCreateRequest creates the ListAuthorizationRules request. +func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesListAuthorizationRulesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listAuthorizationRulesHandleResponse handles the ListAuthorizationRules response. +func (client *NamespacesClient) listAuthorizationRulesHandleResponse(resp *http.Response) (NamespacesListAuthorizationRulesResponse, error) { + result := NamespacesListAuthorizationRulesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { + return NamespacesListAuthorizationRulesResponse{}, err + } + return result, nil +} + +// listAuthorizationRulesHandleError handles the ListAuthorizationRules error response. +func (client *NamespacesClient) listAuthorizationRulesHandleError(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 available namespaces within the ResourceGroup. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) ListByResourceGroup(resourceGroupName string, options *NamespacesListByResourceGroupOptions) *NamespacesListByResourceGroupPager { + return &NamespacesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp NamespacesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RelayNamespaceListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NamespacesListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces" + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (NamespacesListByResourceGroupResponse, error) { + result := NamespacesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespaceListResult); err != nil { + return NamespacesListByResourceGroupResponse{}, err + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *NamespacesClient) 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) +} + +// ListKeys - Primary and secondary connection strings to the namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *NamespacesListKeysOptions) (NamespacesListKeysResponse, error) { + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, namespaceName, authorizationRuleName, options) + if err != nil { + return NamespacesListKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesListKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesListKeysResponse{}, client.listKeysHandleError(resp) + } + return client.listKeysHandleResponse(resp) +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *NamespacesListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *NamespacesClient) listKeysHandleResponse(resp *http.Response) (NamespacesListKeysResponse, error) { + result := NamespacesListKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { + return NamespacesListKeysResponse{}, err + } + return result, nil +} + +// listKeysHandleError handles the ListKeys error response. +func (client *NamespacesClient) listKeysHandleError(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) +} + +// RegenerateKeys - Regenerates the primary or secondary connection strings to the namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *NamespacesRegenerateKeysOptions) (NamespacesRegenerateKeysResponse, error) { + req, err := client.regenerateKeysCreateRequest(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters, options) + if err != nil { + return NamespacesRegenerateKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesRegenerateKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesRegenerateKeysResponse{}, client.regenerateKeysHandleError(resp) + } + return client.regenerateKeysHandleResponse(resp) +} + +// regenerateKeysCreateRequest creates the RegenerateKeys request. +func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *NamespacesRegenerateKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// regenerateKeysHandleResponse handles the RegenerateKeys response. +func (client *NamespacesClient) regenerateKeysHandleResponse(resp *http.Response) (NamespacesRegenerateKeysResponse, error) { + result := NamespacesRegenerateKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { + return NamespacesRegenerateKeysResponse{}, err + } + return result, nil +} + +// regenerateKeysHandleError handles the RegenerateKeys error response. +func (client *NamespacesClient) regenerateKeysHandleError(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) +} + +// Update - Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) Update(ctx context.Context, resourceGroupName string, namespaceName string, parameters RelayUpdateParameters, options *NamespacesUpdateOptions) (NamespacesUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, namespaceName, parameters, options) + if err != nil { + return NamespacesUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return NamespacesUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, parameters RelayUpdateParameters, options *NamespacesUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *NamespacesClient) updateHandleResponse(resp *http.Response) (NamespacesUpdateResponse, error) { + result := NamespacesUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespace); err != nil { + return NamespacesUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *NamespacesClient) updateHandleError(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/relay/armrelay/zz_generated_operations_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go new file mode 100644 index 000000000000..52e80e8895c3 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go @@ -0,0 +1,81 @@ +//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 armrelay + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// 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(con *arm.Connection) *OperationsClient { + return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +} + +// List - Lists all available Relay REST API 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.OperationListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Relay/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", "2017-04-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.OperationListResult); err != nil { + return OperationsListResponse{}, err + } + 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/relay/armrelay/zz_generated_pagers.go b/sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go new file mode 100644 index 000000000000..4aa502153073 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go @@ -0,0 +1,450 @@ +//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 armrelay + +import ( + "context" + "net/http" + "reflect" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// HybridConnectionsListAuthorizationRulesPager provides operations for iterating over paged responses. +type HybridConnectionsListAuthorizationRulesPager struct { + client *HybridConnectionsClient + current HybridConnectionsListAuthorizationRulesResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, HybridConnectionsListAuthorizationRulesResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *HybridConnectionsListAuthorizationRulesPager) 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 *HybridConnectionsListAuthorizationRulesPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AuthorizationRuleListResult.NextLink == nil || len(*p.current.AuthorizationRuleListResult.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.listAuthorizationRulesHandleError(resp) + return false + } + result, err := p.client.listAuthorizationRulesHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current HybridConnectionsListAuthorizationRulesResponse page. +func (p *HybridConnectionsListAuthorizationRulesPager) PageResponse() HybridConnectionsListAuthorizationRulesResponse { + return p.current +} + +// HybridConnectionsListByNamespacePager provides operations for iterating over paged responses. +type HybridConnectionsListByNamespacePager struct { + client *HybridConnectionsClient + current HybridConnectionsListByNamespaceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, HybridConnectionsListByNamespaceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *HybridConnectionsListByNamespacePager) 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 *HybridConnectionsListByNamespacePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.HybridConnectionListResult.NextLink == nil || len(*p.current.HybridConnectionListResult.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.listByNamespaceHandleError(resp) + return false + } + result, err := p.client.listByNamespaceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current HybridConnectionsListByNamespaceResponse page. +func (p *HybridConnectionsListByNamespacePager) PageResponse() HybridConnectionsListByNamespaceResponse { + return p.current +} + +// NamespacesListAuthorizationRulesPager provides operations for iterating over paged responses. +type NamespacesListAuthorizationRulesPager struct { + client *NamespacesClient + current NamespacesListAuthorizationRulesResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NamespacesListAuthorizationRulesResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NamespacesListAuthorizationRulesPager) 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 *NamespacesListAuthorizationRulesPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AuthorizationRuleListResult.NextLink == nil || len(*p.current.AuthorizationRuleListResult.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.listAuthorizationRulesHandleError(resp) + return false + } + result, err := p.client.listAuthorizationRulesHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current NamespacesListAuthorizationRulesResponse page. +func (p *NamespacesListAuthorizationRulesPager) PageResponse() NamespacesListAuthorizationRulesResponse { + return p.current +} + +// NamespacesListByResourceGroupPager provides operations for iterating over paged responses. +type NamespacesListByResourceGroupPager struct { + client *NamespacesClient + current NamespacesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NamespacesListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NamespacesListByResourceGroupPager) 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 *NamespacesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RelayNamespaceListResult.NextLink == nil || len(*p.current.RelayNamespaceListResult.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 NamespacesListByResourceGroupResponse page. +func (p *NamespacesListByResourceGroupPager) PageResponse() NamespacesListByResourceGroupResponse { + return p.current +} + +// NamespacesListPager provides operations for iterating over paged responses. +type NamespacesListPager struct { + client *NamespacesClient + current NamespacesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, NamespacesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *NamespacesListPager) 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 *NamespacesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RelayNamespaceListResult.NextLink == nil || len(*p.current.RelayNamespaceListResult.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 NamespacesListResponse page. +func (p *NamespacesListPager) PageResponse() NamespacesListResponse { + 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.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.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 +} + +// WCFRelaysListAuthorizationRulesPager provides operations for iterating over paged responses. +type WCFRelaysListAuthorizationRulesPager struct { + client *WCFRelaysClient + current WCFRelaysListAuthorizationRulesResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WCFRelaysListAuthorizationRulesResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WCFRelaysListAuthorizationRulesPager) 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 *WCFRelaysListAuthorizationRulesPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AuthorizationRuleListResult.NextLink == nil || len(*p.current.AuthorizationRuleListResult.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.listAuthorizationRulesHandleError(resp) + return false + } + result, err := p.client.listAuthorizationRulesHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current WCFRelaysListAuthorizationRulesResponse page. +func (p *WCFRelaysListAuthorizationRulesPager) PageResponse() WCFRelaysListAuthorizationRulesResponse { + return p.current +} + +// WCFRelaysListByNamespacePager provides operations for iterating over paged responses. +type WCFRelaysListByNamespacePager struct { + client *WCFRelaysClient + current WCFRelaysListByNamespaceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WCFRelaysListByNamespaceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WCFRelaysListByNamespacePager) 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 *WCFRelaysListByNamespacePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.WcfRelaysListResult.NextLink == nil || len(*p.current.WcfRelaysListResult.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.listByNamespaceHandleError(resp) + return false + } + result, err := p.client.listByNamespaceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current WCFRelaysListByNamespaceResponse page. +func (p *WCFRelaysListByNamespacePager) PageResponse() WCFRelaysListByNamespaceResponse { + return p.current +} diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go b/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go new file mode 100644 index 000000000000..01cf5def6e74 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go @@ -0,0 +1,102 @@ +//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 armrelay + +import ( + "context" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) + +// NamespacesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type NamespacesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *NamespacesCreateOrUpdatePoller) 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 *NamespacesCreateOrUpdatePoller) 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 NamespacesCreateOrUpdateResponse will be returned. +func (p *NamespacesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (NamespacesCreateOrUpdateResponse, error) { + respType := NamespacesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.RelayNamespace) + if err != nil { + return NamespacesCreateOrUpdateResponse{}, 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 *NamespacesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// NamespacesDeletePoller provides polling facilities until the operation reaches a terminal state. +type NamespacesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *NamespacesDeletePoller) 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 *NamespacesDeletePoller) 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 NamespacesDeleteResponse will be returned. +func (p *NamespacesDeletePoller) FinalResponse(ctx context.Context) (NamespacesDeleteResponse, error) { + respType := NamespacesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return NamespacesDeleteResponse{}, 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 *NamespacesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go b/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go new file mode 100644 index 000000000000..c9342a41cce7 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go @@ -0,0 +1,465 @@ +//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 armrelay + +import ( + "context" + "net/http" + "time" + + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" +) + +// HybridConnectionsCreateOrUpdateAuthorizationRuleResponse contains the response from method HybridConnections.CreateOrUpdateAuthorizationRule. +type HybridConnectionsCreateOrUpdateAuthorizationRuleResponse struct { + HybridConnectionsCreateOrUpdateAuthorizationRuleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsCreateOrUpdateAuthorizationRuleResult contains the result from method HybridConnections.CreateOrUpdateAuthorizationRule. +type HybridConnectionsCreateOrUpdateAuthorizationRuleResult struct { + AuthorizationRule +} + +// HybridConnectionsCreateOrUpdateResponse contains the response from method HybridConnections.CreateOrUpdate. +type HybridConnectionsCreateOrUpdateResponse struct { + HybridConnectionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsCreateOrUpdateResult contains the result from method HybridConnections.CreateOrUpdate. +type HybridConnectionsCreateOrUpdateResult struct { + HybridConnection +} + +// HybridConnectionsDeleteAuthorizationRuleResponse contains the response from method HybridConnections.DeleteAuthorizationRule. +type HybridConnectionsDeleteAuthorizationRuleResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsDeleteResponse contains the response from method HybridConnections.Delete. +type HybridConnectionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsGetAuthorizationRuleResponse contains the response from method HybridConnections.GetAuthorizationRule. +type HybridConnectionsGetAuthorizationRuleResponse struct { + HybridConnectionsGetAuthorizationRuleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsGetAuthorizationRuleResult contains the result from method HybridConnections.GetAuthorizationRule. +type HybridConnectionsGetAuthorizationRuleResult struct { + AuthorizationRule +} + +// HybridConnectionsGetResponse contains the response from method HybridConnections.Get. +type HybridConnectionsGetResponse struct { + HybridConnectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsGetResult contains the result from method HybridConnections.Get. +type HybridConnectionsGetResult struct { + HybridConnection +} + +// HybridConnectionsListAuthorizationRulesResponse contains the response from method HybridConnections.ListAuthorizationRules. +type HybridConnectionsListAuthorizationRulesResponse struct { + HybridConnectionsListAuthorizationRulesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsListAuthorizationRulesResult contains the result from method HybridConnections.ListAuthorizationRules. +type HybridConnectionsListAuthorizationRulesResult struct { + AuthorizationRuleListResult +} + +// HybridConnectionsListByNamespaceResponse contains the response from method HybridConnections.ListByNamespace. +type HybridConnectionsListByNamespaceResponse struct { + HybridConnectionsListByNamespaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsListByNamespaceResult contains the result from method HybridConnections.ListByNamespace. +type HybridConnectionsListByNamespaceResult struct { + HybridConnectionListResult +} + +// HybridConnectionsListKeysResponse contains the response from method HybridConnections.ListKeys. +type HybridConnectionsListKeysResponse struct { + HybridConnectionsListKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsListKeysResult contains the result from method HybridConnections.ListKeys. +type HybridConnectionsListKeysResult struct { + AccessKeys +} + +// HybridConnectionsRegenerateKeysResponse contains the response from method HybridConnections.RegenerateKeys. +type HybridConnectionsRegenerateKeysResponse struct { + HybridConnectionsRegenerateKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// HybridConnectionsRegenerateKeysResult contains the result from method HybridConnections.RegenerateKeys. +type HybridConnectionsRegenerateKeysResult struct { + AccessKeys +} + +// NamespacesCheckNameAvailabilityResponse contains the response from method Namespaces.CheckNameAvailability. +type NamespacesCheckNameAvailabilityResponse struct { + NamespacesCheckNameAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesCheckNameAvailabilityResult contains the result from method Namespaces.CheckNameAvailability. +type NamespacesCheckNameAvailabilityResult struct { + CheckNameAvailabilityResult +} + +// NamespacesCreateOrUpdateAuthorizationRuleResponse contains the response from method Namespaces.CreateOrUpdateAuthorizationRule. +type NamespacesCreateOrUpdateAuthorizationRuleResponse struct { + NamespacesCreateOrUpdateAuthorizationRuleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesCreateOrUpdateAuthorizationRuleResult contains the result from method Namespaces.CreateOrUpdateAuthorizationRule. +type NamespacesCreateOrUpdateAuthorizationRuleResult struct { + AuthorizationRule +} + +// NamespacesCreateOrUpdatePollerResponse contains the response from method Namespaces.CreateOrUpdate. +type NamespacesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *NamespacesCreateOrUpdatePoller + + // 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. +func (l NamespacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesCreateOrUpdateResponse, error) { + respType := NamespacesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RelayNamespace) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a NamespacesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *NamespacesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *NamespacesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("NamespacesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &NamespacesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// NamespacesCreateOrUpdateResponse contains the response from method Namespaces.CreateOrUpdate. +type NamespacesCreateOrUpdateResponse struct { + NamespacesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesCreateOrUpdateResult contains the result from method Namespaces.CreateOrUpdate. +type NamespacesCreateOrUpdateResult struct { + RelayNamespace +} + +// NamespacesDeleteAuthorizationRuleResponse contains the response from method Namespaces.DeleteAuthorizationRule. +type NamespacesDeleteAuthorizationRuleResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesDeletePollerResponse contains the response from method Namespaces.Delete. +type NamespacesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *NamespacesDeletePoller + + // 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. +func (l NamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesDeleteResponse, error) { + respType := NamespacesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a NamespacesDeletePollerResponse from the provided client and resume token. +func (l *NamespacesDeletePollerResponse) Resume(ctx context.Context, client *NamespacesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("NamespacesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &NamespacesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// NamespacesDeleteResponse contains the response from method Namespaces.Delete. +type NamespacesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesGetAuthorizationRuleResponse contains the response from method Namespaces.GetAuthorizationRule. +type NamespacesGetAuthorizationRuleResponse struct { + NamespacesGetAuthorizationRuleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesGetAuthorizationRuleResult contains the result from method Namespaces.GetAuthorizationRule. +type NamespacesGetAuthorizationRuleResult struct { + AuthorizationRule +} + +// NamespacesGetResponse contains the response from method Namespaces.Get. +type NamespacesGetResponse struct { + NamespacesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesGetResult contains the result from method Namespaces.Get. +type NamespacesGetResult struct { + RelayNamespace +} + +// NamespacesListAuthorizationRulesResponse contains the response from method Namespaces.ListAuthorizationRules. +type NamespacesListAuthorizationRulesResponse struct { + NamespacesListAuthorizationRulesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesListAuthorizationRulesResult contains the result from method Namespaces.ListAuthorizationRules. +type NamespacesListAuthorizationRulesResult struct { + AuthorizationRuleListResult +} + +// NamespacesListByResourceGroupResponse contains the response from method Namespaces.ListByResourceGroup. +type NamespacesListByResourceGroupResponse struct { + NamespacesListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesListByResourceGroupResult contains the result from method Namespaces.ListByResourceGroup. +type NamespacesListByResourceGroupResult struct { + RelayNamespaceListResult +} + +// NamespacesListKeysResponse contains the response from method Namespaces.ListKeys. +type NamespacesListKeysResponse struct { + NamespacesListKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesListKeysResult contains the result from method Namespaces.ListKeys. +type NamespacesListKeysResult struct { + AccessKeys +} + +// NamespacesListResponse contains the response from method Namespaces.List. +type NamespacesListResponse struct { + NamespacesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesListResult contains the result from method Namespaces.List. +type NamespacesListResult struct { + RelayNamespaceListResult +} + +// NamespacesRegenerateKeysResponse contains the response from method Namespaces.RegenerateKeys. +type NamespacesRegenerateKeysResponse struct { + NamespacesRegenerateKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesRegenerateKeysResult contains the result from method Namespaces.RegenerateKeys. +type NamespacesRegenerateKeysResult struct { + AccessKeys +} + +// NamespacesUpdateResponse contains the response from method Namespaces.Update. +type NamespacesUpdateResponse struct { + NamespacesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesUpdateResult contains the result from method Namespaces.Update. +type NamespacesUpdateResult struct { + RelayNamespace +} + +// 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 { + OperationListResult +} + +// WCFRelaysCreateOrUpdateAuthorizationRuleResponse contains the response from method WCFRelays.CreateOrUpdateAuthorizationRule. +type WCFRelaysCreateOrUpdateAuthorizationRuleResponse struct { + WCFRelaysCreateOrUpdateAuthorizationRuleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysCreateOrUpdateAuthorizationRuleResult contains the result from method WCFRelays.CreateOrUpdateAuthorizationRule. +type WCFRelaysCreateOrUpdateAuthorizationRuleResult struct { + AuthorizationRule +} + +// WCFRelaysCreateOrUpdateResponse contains the response from method WCFRelays.CreateOrUpdate. +type WCFRelaysCreateOrUpdateResponse struct { + WCFRelaysCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysCreateOrUpdateResult contains the result from method WCFRelays.CreateOrUpdate. +type WCFRelaysCreateOrUpdateResult struct { + WcfRelay +} + +// WCFRelaysDeleteAuthorizationRuleResponse contains the response from method WCFRelays.DeleteAuthorizationRule. +type WCFRelaysDeleteAuthorizationRuleResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysDeleteResponse contains the response from method WCFRelays.Delete. +type WCFRelaysDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysGetAuthorizationRuleResponse contains the response from method WCFRelays.GetAuthorizationRule. +type WCFRelaysGetAuthorizationRuleResponse struct { + WCFRelaysGetAuthorizationRuleResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysGetAuthorizationRuleResult contains the result from method WCFRelays.GetAuthorizationRule. +type WCFRelaysGetAuthorizationRuleResult struct { + AuthorizationRule +} + +// WCFRelaysGetResponse contains the response from method WCFRelays.Get. +type WCFRelaysGetResponse struct { + WCFRelaysGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysGetResult contains the result from method WCFRelays.Get. +type WCFRelaysGetResult struct { + WcfRelay +} + +// WCFRelaysListAuthorizationRulesResponse contains the response from method WCFRelays.ListAuthorizationRules. +type WCFRelaysListAuthorizationRulesResponse struct { + WCFRelaysListAuthorizationRulesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysListAuthorizationRulesResult contains the result from method WCFRelays.ListAuthorizationRules. +type WCFRelaysListAuthorizationRulesResult struct { + AuthorizationRuleListResult +} + +// WCFRelaysListByNamespaceResponse contains the response from method WCFRelays.ListByNamespace. +type WCFRelaysListByNamespaceResponse struct { + WCFRelaysListByNamespaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysListByNamespaceResult contains the result from method WCFRelays.ListByNamespace. +type WCFRelaysListByNamespaceResult struct { + WcfRelaysListResult +} + +// WCFRelaysListKeysResponse contains the response from method WCFRelays.ListKeys. +type WCFRelaysListKeysResponse struct { + WCFRelaysListKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysListKeysResult contains the result from method WCFRelays.ListKeys. +type WCFRelaysListKeysResult struct { + AccessKeys +} + +// WCFRelaysRegenerateKeysResponse contains the response from method WCFRelays.RegenerateKeys. +type WCFRelaysRegenerateKeysResponse struct { + WCFRelaysRegenerateKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WCFRelaysRegenerateKeysResult contains the result from method WCFRelays.RegenerateKeys. +type WCFRelaysRegenerateKeysResult struct { + AccessKeys +} diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go b/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..27842fba2f8c --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go @@ -0,0 +1,58 @@ +//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 armrelay + +import ( + "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 +} diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go new file mode 100644 index 000000000000..c7a924f24341 --- /dev/null +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go @@ -0,0 +1,716 @@ +//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 armrelay + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// WCFRelaysClient contains the methods for the WCFRelays group. +// Don't use this type directly, use NewWCFRelaysClient() instead. +type WCFRelaysClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWCFRelaysClient creates a new instance of WCFRelaysClient with the specified values. +func NewWCFRelaysClient(con *arm.Connection, subscriptionID string) *WCFRelaysClient { + return &WCFRelaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates a WCF relay. This operation is idempotent. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, parameters WcfRelay, options *WCFRelaysCreateOrUpdateOptions) (WCFRelaysCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, relayName, parameters, options) + if err != nil { + return WCFRelaysCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WCFRelaysCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WCFRelaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, parameters WcfRelay, options *WCFRelaysCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WCFRelaysClient) createOrUpdateHandleResponse(resp *http.Response) (WCFRelaysCreateOrUpdateResponse, error) { + result := WCFRelaysCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WcfRelay); err != nil { + return WCFRelaysCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *WCFRelaysClient) 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) +} + +// CreateOrUpdateAuthorizationRule - Creates or updates an authorization rule for a WCF relay. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters AuthorizationRule, options *WCFRelaysCreateOrUpdateAuthorizationRuleOptions) (WCFRelaysCreateOrUpdateAuthorizationRuleResponse, error) { + req, err := client.createOrUpdateAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters, options) + if err != nil { + return WCFRelaysCreateOrUpdateAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysCreateOrUpdateAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WCFRelaysCreateOrUpdateAuthorizationRuleResponse{}, client.createOrUpdateAuthorizationRuleHandleError(resp) + } + return client.createOrUpdateAuthorizationRuleHandleResponse(resp) +} + +// createOrUpdateAuthorizationRuleCreateRequest creates the CreateOrUpdateAuthorizationRule request. +func (client *WCFRelaysClient) createOrUpdateAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters AuthorizationRule, options *WCFRelaysCreateOrUpdateAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateAuthorizationRuleHandleResponse handles the CreateOrUpdateAuthorizationRule response. +func (client *WCFRelaysClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (WCFRelaysCreateOrUpdateAuthorizationRuleResponse, error) { + result := WCFRelaysCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { + return WCFRelaysCreateOrUpdateAuthorizationRuleResponse{}, err + } + return result, nil +} + +// createOrUpdateAuthorizationRuleHandleError handles the CreateOrUpdateAuthorizationRule error response. +func (client *WCFRelaysClient) createOrUpdateAuthorizationRuleHandleError(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) +} + +// Delete - Deletes a WCF relay. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, options *WCFRelaysDeleteOptions) (WCFRelaysDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, relayName, options) + if err != nil { + return WCFRelaysDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WCFRelaysDeleteResponse{}, client.deleteHandleError(resp) + } + return WCFRelaysDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WCFRelaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, options *WCFRelaysDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + 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", "2017-04-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 *WCFRelaysClient) 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) +} + +// DeleteAuthorizationRule - Deletes a WCF relay authorization rule. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, options *WCFRelaysDeleteAuthorizationRuleOptions) (WCFRelaysDeleteAuthorizationRuleResponse, error) { + req, err := client.deleteAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, relayName, authorizationRuleName, options) + if err != nil { + return WCFRelaysDeleteAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysDeleteAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WCFRelaysDeleteAuthorizationRuleResponse{}, client.deleteAuthorizationRuleHandleError(resp) + } + return WCFRelaysDeleteAuthorizationRuleResponse{RawResponse: resp}, nil +} + +// deleteAuthorizationRuleCreateRequest creates the DeleteAuthorizationRule request. +func (client *WCFRelaysClient) deleteAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, options *WCFRelaysDeleteAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteAuthorizationRuleHandleError handles the DeleteAuthorizationRule error response. +func (client *WCFRelaysClient) deleteAuthorizationRuleHandleError(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 - Returns the description for the specified WCF relay. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, options *WCFRelaysGetOptions) (WCFRelaysGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, relayName, options) + if err != nil { + return WCFRelaysGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WCFRelaysGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WCFRelaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, options *WCFRelaysGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WCFRelaysClient) getHandleResponse(resp *http.Response) (WCFRelaysGetResponse, error) { + result := WCFRelaysGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WcfRelay); err != nil { + return WCFRelaysGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *WCFRelaysClient) 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) +} + +// GetAuthorizationRule - Get authorizationRule for a WCF relay by name. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, options *WCFRelaysGetAuthorizationRuleOptions) (WCFRelaysGetAuthorizationRuleResponse, error) { + req, err := client.getAuthorizationRuleCreateRequest(ctx, resourceGroupName, namespaceName, relayName, authorizationRuleName, options) + if err != nil { + return WCFRelaysGetAuthorizationRuleResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysGetAuthorizationRuleResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WCFRelaysGetAuthorizationRuleResponse{}, client.getAuthorizationRuleHandleError(resp) + } + return client.getAuthorizationRuleHandleResponse(resp) +} + +// getAuthorizationRuleCreateRequest creates the GetAuthorizationRule request. +func (client *WCFRelaysClient) getAuthorizationRuleCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, options *WCFRelaysGetAuthorizationRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getAuthorizationRuleHandleResponse handles the GetAuthorizationRule response. +func (client *WCFRelaysClient) getAuthorizationRuleHandleResponse(resp *http.Response) (WCFRelaysGetAuthorizationRuleResponse, error) { + result := WCFRelaysGetAuthorizationRuleResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { + return WCFRelaysGetAuthorizationRuleResponse{}, err + } + return result, nil +} + +// getAuthorizationRuleHandleError handles the GetAuthorizationRule error response. +func (client *WCFRelaysClient) getAuthorizationRuleHandleError(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) +} + +// ListAuthorizationRules - Authorization rules for a WCF relay. +// If the operation fails it returns a generic error. +func (client *WCFRelaysClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, relayName string, options *WCFRelaysListAuthorizationRulesOptions) *WCFRelaysListAuthorizationRulesPager { + return &WCFRelaysListAuthorizationRulesPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listAuthorizationRulesCreateRequest(ctx, resourceGroupName, namespaceName, relayName, options) + }, + advancer: func(ctx context.Context, resp WCFRelaysListAuthorizationRulesResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AuthorizationRuleListResult.NextLink) + }, + } +} + +// listAuthorizationRulesCreateRequest creates the ListAuthorizationRules request. +func (client *WCFRelaysClient) listAuthorizationRulesCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, options *WCFRelaysListAuthorizationRulesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listAuthorizationRulesHandleResponse handles the ListAuthorizationRules response. +func (client *WCFRelaysClient) listAuthorizationRulesHandleResponse(resp *http.Response) (WCFRelaysListAuthorizationRulesResponse, error) { + result := WCFRelaysListAuthorizationRulesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { + return WCFRelaysListAuthorizationRulesResponse{}, err + } + return result, nil +} + +// listAuthorizationRulesHandleError handles the ListAuthorizationRules error response. +func (client *WCFRelaysClient) listAuthorizationRulesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// ListByNamespace - Lists the WCF relays within the namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) ListByNamespace(resourceGroupName string, namespaceName string, options *WCFRelaysListByNamespaceOptions) *WCFRelaysListByNamespacePager { + return &WCFRelaysListByNamespacePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) + }, + advancer: func(ctx context.Context, resp WCFRelaysListByNamespaceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.WcfRelaysListResult.NextLink) + }, + } +} + +// listByNamespaceCreateRequest creates the ListByNamespace request. +func (client *WCFRelaysClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *WCFRelaysListByNamespaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByNamespaceHandleResponse handles the ListByNamespace response. +func (client *WCFRelaysClient) listByNamespaceHandleResponse(resp *http.Response) (WCFRelaysListByNamespaceResponse, error) { + result := WCFRelaysListByNamespaceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WcfRelaysListResult); err != nil { + return WCFRelaysListByNamespaceResponse{}, err + } + return result, nil +} + +// listByNamespaceHandleError handles the ListByNamespace error response. +func (client *WCFRelaysClient) listByNamespaceHandleError(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) +} + +// ListKeys - Primary and secondary connection strings to the WCF relay. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, options *WCFRelaysListKeysOptions) (WCFRelaysListKeysResponse, error) { + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, namespaceName, relayName, authorizationRuleName, options) + if err != nil { + return WCFRelaysListKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysListKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WCFRelaysListKeysResponse{}, client.listKeysHandleError(resp) + } + return client.listKeysHandleResponse(resp) +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *WCFRelaysClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, options *WCFRelaysListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/listKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *WCFRelaysClient) listKeysHandleResponse(resp *http.Response) (WCFRelaysListKeysResponse, error) { + result := WCFRelaysListKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { + return WCFRelaysListKeysResponse{}, err + } + return result, nil +} + +// listKeysHandleError handles the ListKeys error response. +func (client *WCFRelaysClient) listKeysHandleError(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) +} + +// RegenerateKeys - Regenerates the primary or secondary connection strings to the WCF relay. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WCFRelaysClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *WCFRelaysRegenerateKeysOptions) (WCFRelaysRegenerateKeysResponse, error) { + req, err := client.regenerateKeysCreateRequest(ctx, resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters, options) + if err != nil { + return WCFRelaysRegenerateKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WCFRelaysRegenerateKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WCFRelaysRegenerateKeysResponse{}, client.regenerateKeysHandleError(resp) + } + return client.regenerateKeysHandleResponse(resp) +} + +// regenerateKeysCreateRequest creates the RegenerateKeys request. +func (client *WCFRelaysClient) regenerateKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *WCFRelaysRegenerateKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/regenerateKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if relayName == "" { + return nil, errors.New("parameter relayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relayName}", url.PathEscape(relayName)) + if authorizationRuleName == "" { + return nil, errors.New("parameter authorizationRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationRuleName}", url.PathEscape(authorizationRuleName)) + 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", "2017-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// regenerateKeysHandleResponse handles the RegenerateKeys response. +func (client *WCFRelaysClient) regenerateKeysHandleResponse(resp *http.Response) (WCFRelaysRegenerateKeysResponse, error) { + result := WCFRelaysRegenerateKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { + return WCFRelaysRegenerateKeysResponse{}, err + } + return result, nil +} + +// regenerateKeysHandleError handles the RegenerateKeys error response. +func (client *WCFRelaysClient) regenerateKeysHandleError(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) +} From b18ac0582e1b9f457510868e2e3a84e7d531af7f Mon Sep 17 00:00:00 2001 From: 804873052 <804873052@qq.com> Date: Thu, 21 Oct 2021 13:15:43 +0800 Subject: [PATCH 2/3] fix --- .../relay/armrelay/CHANGELOG.md | 2 ++ sdk/resourcemanager/relay/armrelay/go.mod | 1 - sdk/resourcemanager/relay/armrelay/go.sum | 22 ------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md index ddf2bd0380ad..67a0a55aba72 100644 --- a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md +++ b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md @@ -1,3 +1,5 @@ # Release History ## 0.1.0 (2021-10-21) + +- Initial preview release. \ No newline at end of file diff --git a/sdk/resourcemanager/relay/armrelay/go.mod b/sdk/resourcemanager/relay/armrelay/go.mod index 51d9543b78ac..f4423119de30 100644 --- a/sdk/resourcemanager/relay/armrelay/go.mod +++ b/sdk/resourcemanager/relay/armrelay/go.mod @@ -5,5 +5,4 @@ go 1.16 require ( github.com/Azure/azure-sdk-for-go v58.2.0+incompatible github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 - golang.org/x/tools v0.1.7 // indirect ) diff --git a/sdk/resourcemanager/relay/armrelay/go.sum b/sdk/resourcemanager/relay/armrelay/go.sum index b3b5161902ad..c8ff7a2143ad 100644 --- a/sdk/resourcemanager/relay/armrelay/go.sum +++ b/sdk/resourcemanager/relay/armrelay/go.sum @@ -14,36 +14,14 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN 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= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -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-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.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= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= From 7e8b3f9bb6364f86c3123c439c269bdaa55e0e82 Mon Sep 17 00:00:00 2001 From: Dapeng Zhang Date: Tue, 26 Oct 2021 16:24:19 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- sdk/resourcemanager/relay/armrelay/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md index 67a0a55aba72..f3d80a0b8362 100644 --- a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md +++ b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md @@ -1,5 +1,5 @@ # Release History -## 0.1.0 (2021-10-21) +## 0.1.0 (2021-10-26) -- Initial preview release. \ No newline at end of file +- Initial preview release.