From d6583a269c460f4a92aeb7e6ba539e1ecc3a1608 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 10 Dec 2021 02:57:16 +0000 Subject: [PATCH] CodeGen from PR 17000 in Azure/azure-rest-api-specs [Go] Track2 modify readme.go.md 9 (#17000) * [Go] Track2 modify readme.go.md 9 * fix --- .../signalr/armsignalr/CHANGELOG.md | 5 + .../signalr/armsignalr/LICENSE.txt | 21 + .../signalr/armsignalr/README.md | 75 ++ .../signalr/armsignalr/autorest.md | 13 + .../signalr/armsignalr/build.go | 7 + sdk/resourcemanager/signalr/armsignalr/ci.yml | 27 + sdk/resourcemanager/signalr/armsignalr/go.mod | 8 + sdk/resourcemanager/signalr/armsignalr/go.sum | 37 + .../signalr/armsignalr/go_mod_tidy_hack.go | 13 + .../armsignalr/zz_generated_constants.go | 344 +++++ .../signalr/armsignalr/zz_generated_models.go | 1199 +++++++++++++++++ .../zz_generated_operations_client.go | 89 ++ .../signalr/armsignalr/zz_generated_pagers.go | 395 ++++++ .../armsignalr/zz_generated_pollers.go | 359 +++++ .../armsignalr/zz_generated_response_types.go | 576 ++++++++ .../armsignalr/zz_generated_signalr_client.go | 791 +++++++++++ ...ignalrprivateendpointconnections_client.go | 323 +++++ ...ated_signalrprivatelinkresources_client.go | 105 ++ ...ignalrsharedprivatelinkresources_client.go | 334 +++++ .../armsignalr/zz_generated_time_rfc3339.go | 85 ++ .../armsignalr/zz_generated_usages_client.go | 101 ++ 21 files changed, 4907 insertions(+) create mode 100644 sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md create mode 100644 sdk/resourcemanager/signalr/armsignalr/LICENSE.txt create mode 100644 sdk/resourcemanager/signalr/armsignalr/README.md create mode 100644 sdk/resourcemanager/signalr/armsignalr/autorest.md create mode 100644 sdk/resourcemanager/signalr/armsignalr/build.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/ci.yml create mode 100644 sdk/resourcemanager/signalr/armsignalr/go.mod create mode 100644 sdk/resourcemanager/signalr/armsignalr/go.sum create mode 100644 sdk/resourcemanager/signalr/armsignalr/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_constants.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_models.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_signalr_client.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrprivateendpointconnections_client.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrprivatelinkresources_client.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrsharedprivatelinkresources_client.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/signalr/armsignalr/zz_generated_usages_client.go diff --git a/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md b/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md new file mode 100644 index 000000000000..17b9dceace74 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-10) + +- Init release. \ No newline at end of file diff --git a/sdk/resourcemanager/signalr/armsignalr/LICENSE.txt b/sdk/resourcemanager/signalr/armsignalr/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/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/signalr/armsignalr/README.md b/sdk/resourcemanager/signalr/armsignalr/README.md new file mode 100644 index 000000000000..ce29aeb07037 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/README.md @@ -0,0 +1,75 @@ +# Azure Signalr Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr) + +The `armsignalr` module provides operations for working with Azure Signalr. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/signalr/armsignalr) + +# 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 Signalr module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Signalr. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Signalr modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client := armsignalr.NewSignalRSharedPrivateLinkResourcesClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armsignalr.NewSignalRSharedPrivateLinkResourcesClient(, cred, &options) +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Signalr` 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/signalr/armsignalr/autorest.md b/sdk/resourcemanager/signalr/armsignalr/autorest.md new file mode 100644 index 000000000000..22a3f01f58f2 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /home/vsts/work/1/s/azure-rest-api-specs/specification/signalr/resource-manager/readme.md +- /home/vsts/work/1/s/azure-rest-api-specs/specification/signalr/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/signalr/armsignalr/build.go b/sdk/resourcemanager/signalr/armsignalr/build.go new file mode 100644 index 000000000000..200562814241 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/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/signalr/armsignalr + +package armsignalr diff --git a/sdk/resourcemanager/signalr/armsignalr/ci.yml b/sdk/resourcemanager/signalr/armsignalr/ci.yml new file mode 100644 index 000000000000..15bc95d328e0 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/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/signalr/armsignalr/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/signalr/armsignalr/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/signalr/armsignalr' diff --git a/sdk/resourcemanager/signalr/armsignalr/go.mod b/sdk/resourcemanager/signalr/armsignalr/go.mod new file mode 100644 index 000000000000..006ed2c276fa --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v60.1.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 +) diff --git a/sdk/resourcemanager/signalr/armsignalr/go.sum b/sdk/resourcemanager/signalr/armsignalr/go.sum new file mode 100644 index 000000000000..960c6c966a3f --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/go.sum @@ -0,0 +1,37 @@ +github.com/Azure/azure-sdk-for-go v60.1.0+incompatible h1:j6y8ddurcaiyLfwBwPmJFaunp6BDzyQTuAgMrm1r++o= +github.com/Azure/azure-sdk-for-go v60.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/signalr/armsignalr/go_mod_tidy_hack.go b/sdk/resourcemanager/signalr/armsignalr/go_mod_tidy_hack.go new file mode 100644 index 000000000000..76105ab9716c --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/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 armsignalr + +// 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/signalr/armsignalr/zz_generated_constants.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_constants.go new file mode 100644 index 000000000000..874dd6de3d78 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_constants.go @@ -0,0 +1,344 @@ +//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 armsignalr + +const ( + module = "armsignalr" + version = "v0.1.0" +) + +// ACLAction - Default action when no other rule matches +type ACLAction string + +const ( + ACLActionAllow ACLAction = "Allow" + ACLActionDeny ACLAction = "Deny" +) + +// PossibleACLActionValues returns the possible values for the ACLAction const type. +func PossibleACLActionValues() []ACLAction { + return []ACLAction{ + ACLActionAllow, + ACLActionDeny, + } +} + +// ToPtr returns a *ACLAction pointing to the current value. +func (c ACLAction) ToPtr() *ACLAction { + return &c +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// FeatureFlags - FeatureFlags is the supported features of Azure SignalR service. +// * ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have your own backend server; "Serverless": your application doesn't +// have a backend server; "Classic": for +// backward compatibility. Support both Default and Serverless mode but not recommended; "PredefinedOnly": for future use. +// * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category respectively. +// * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category respectively. +// * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR service, it will give you live traces in real time, it will be +// helpful when you developing your own Azure +// SignalR based web application or self-troubleshooting some issues. Please note that live traces are counted as outbound messages that will be charged. +// Values allowed: "true"/"false", to +// enable/disable live trace feature. +type FeatureFlags string + +const ( + FeatureFlagsEnableConnectivityLogs FeatureFlags = "EnableConnectivityLogs" + FeatureFlagsEnableLiveTrace FeatureFlags = "EnableLiveTrace" + FeatureFlagsEnableMessagingLogs FeatureFlags = "EnableMessagingLogs" + FeatureFlagsServiceMode FeatureFlags = "ServiceMode" +) + +// PossibleFeatureFlagsValues returns the possible values for the FeatureFlags const type. +func PossibleFeatureFlagsValues() []FeatureFlags { + return []FeatureFlags{ + FeatureFlagsEnableConnectivityLogs, + FeatureFlagsEnableLiveTrace, + FeatureFlagsEnableMessagingLogs, + FeatureFlagsServiceMode, + } +} + +// ToPtr returns a *FeatureFlags pointing to the current value. +func (c FeatureFlags) ToPtr() *FeatureFlags { + return &c +} + +// KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). +type KeyType string + +const ( + KeyTypePrimary KeyType = "Primary" + KeyTypeSalt KeyType = "Salt" + KeyTypeSecondary KeyType = "Secondary" +) + +// PossibleKeyTypeValues returns the possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{ + KeyTypePrimary, + KeyTypeSalt, + KeyTypeSecondary, + } +} + +// ToPtr returns a *KeyType pointing to the current value. +func (c KeyType) ToPtr() *KeyType { + return &c +} + +// ManagedIdentityType - Represent the identity type: systemAssigned, userAssigned, None +type ManagedIdentityType string + +const ( + ManagedIdentityTypeNone ManagedIdentityType = "None" + ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" + ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns the possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{ + ManagedIdentityTypeNone, + ManagedIdentityTypeSystemAssigned, + ManagedIdentityTypeUserAssigned, + } +} + +// ToPtr returns a *ManagedIdentityType pointing to the current value. +func (c ManagedIdentityType) ToPtr() *ManagedIdentityType { + return &c +} + +// PrivateLinkServiceConnectionStatus - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns the possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{ + PrivateLinkServiceConnectionStatusApproved, + PrivateLinkServiceConnectionStatusDisconnected, + PrivateLinkServiceConnectionStatusPending, + PrivateLinkServiceConnectionStatusRejected, + } +} + +// ToPtr returns a *PrivateLinkServiceConnectionStatus pointing to the current value. +func (c PrivateLinkServiceConnectionStatus) ToPtr() *PrivateLinkServiceConnectionStatus { + return &c +} + +// ProvisioningState - Provisioning state of the resource. +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateMoving, + ProvisioningStateRunning, + ProvisioningStateSucceeded, + ProvisioningStateUnknown, + ProvisioningStateUpdating, + } +} + +// ToPtr returns a *ProvisioningState pointing to the current value. +func (c ProvisioningState) ToPtr() *ProvisioningState { + return &c +} + +// ScaleType - The scale type applicable to the sku. +type ScaleType string + +const ( + ScaleTypeAutomatic ScaleType = "Automatic" + ScaleTypeManual ScaleType = "Manual" + ScaleTypeNone ScaleType = "None" +) + +// PossibleScaleTypeValues returns the possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{ + ScaleTypeAutomatic, + ScaleTypeManual, + ScaleTypeNone, + } +} + +// ToPtr returns a *ScaleType pointing to the current value. +func (c ScaleType) ToPtr() *ScaleType { + return &c +} + +// ServiceKind - The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR" +type ServiceKind string + +const ( + ServiceKindRawWebSockets ServiceKind = "RawWebSockets" + ServiceKindSignalR ServiceKind = "SignalR" +) + +// PossibleServiceKindValues returns the possible values for the ServiceKind const type. +func PossibleServiceKindValues() []ServiceKind { + return []ServiceKind{ + ServiceKindRawWebSockets, + ServiceKindSignalR, + } +} + +// ToPtr returns a *ServiceKind pointing to the current value. +func (c ServiceKind) ToPtr() *ServiceKind { + return &c +} + +// SharedPrivateLinkResourceStatus - Status of the shared private link resource +type SharedPrivateLinkResourceStatus string + +const ( + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" + SharedPrivateLinkResourceStatusTimeout SharedPrivateLinkResourceStatus = "Timeout" +) + +// PossibleSharedPrivateLinkResourceStatusValues returns the possible values for the SharedPrivateLinkResourceStatus const type. +func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { + return []SharedPrivateLinkResourceStatus{ + SharedPrivateLinkResourceStatusApproved, + SharedPrivateLinkResourceStatusDisconnected, + SharedPrivateLinkResourceStatusPending, + SharedPrivateLinkResourceStatusRejected, + SharedPrivateLinkResourceStatusTimeout, + } +} + +// ToPtr returns a *SharedPrivateLinkResourceStatus pointing to the current value. +func (c SharedPrivateLinkResourceStatus) ToPtr() *SharedPrivateLinkResourceStatus { + return &c +} + +// SignalRRequestType - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. +type SignalRRequestType string + +const ( + SignalRRequestTypeClientConnection SignalRRequestType = "ClientConnection" + SignalRRequestTypeRESTAPI SignalRRequestType = "RESTAPI" + SignalRRequestTypeServerConnection SignalRRequestType = "ServerConnection" + SignalRRequestTypeTrace SignalRRequestType = "Trace" +) + +// PossibleSignalRRequestTypeValues returns the possible values for the SignalRRequestType const type. +func PossibleSignalRRequestTypeValues() []SignalRRequestType { + return []SignalRRequestType{ + SignalRRequestTypeClientConnection, + SignalRRequestTypeRESTAPI, + SignalRRequestTypeServerConnection, + SignalRRequestTypeTrace, + } +} + +// ToPtr returns a *SignalRRequestType pointing to the current value. +func (c SignalRRequestType) ToPtr() *SignalRRequestType { + return &c +} + +// SignalRSKUTier - Optional tier of this particular SKU. 'Standard' or 'Free'. +// Basic is deprecated, use Standard instead. +type SignalRSKUTier string + +const ( + SignalRSKUTierBasic SignalRSKUTier = "Basic" + SignalRSKUTierFree SignalRSKUTier = "Free" + SignalRSKUTierPremium SignalRSKUTier = "Premium" + SignalRSKUTierStandard SignalRSKUTier = "Standard" +) + +// PossibleSignalRSKUTierValues returns the possible values for the SignalRSKUTier const type. +func PossibleSignalRSKUTierValues() []SignalRSKUTier { + return []SignalRSKUTier{ + SignalRSKUTierBasic, + SignalRSKUTierFree, + SignalRSKUTierPremium, + SignalRSKUTierStandard, + } +} + +// ToPtr returns a *SignalRSKUTier pointing to the current value. +func (c SignalRSKUTier) ToPtr() *SignalRSKUTier { + return &c +} + +// UpstreamAuthType - Gets or sets the type of auth. None or ManagedIdentity is supported now. +type UpstreamAuthType string + +const ( + UpstreamAuthTypeManagedIdentity UpstreamAuthType = "ManagedIdentity" + UpstreamAuthTypeNone UpstreamAuthType = "None" +) + +// PossibleUpstreamAuthTypeValues returns the possible values for the UpstreamAuthType const type. +func PossibleUpstreamAuthTypeValues() []UpstreamAuthType { + return []UpstreamAuthType{ + UpstreamAuthTypeManagedIdentity, + UpstreamAuthTypeNone, + } +} + +// ToPtr returns a *UpstreamAuthType pointing to the current value. +func (c UpstreamAuthType) ToPtr() *UpstreamAuthType { + return &c +} diff --git a/sdk/resourcemanager/signalr/armsignalr/zz_generated_models.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_models.go new file mode 100644 index 000000000000..f39b909447ae --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_models.go @@ -0,0 +1,1199 @@ +//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 armsignalr + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// Dimension - Specifications of the Dimension of metrics. +type Dimension struct { + // Localized friendly display name of the dimension. + DisplayName *string `json:"displayName,omitempty"` + + // Name of the dimension as it appears in MDM. + InternalName *string `json:"internalName,omitempty"` + + // The public facing name of the dimension. + Name *string `json:"name,omitempty"` + + // A Boolean flag indicating whether this dimension should be included for the shoebox export scenario. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData +// error response format.). +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorResponse struct { + raw string + // The error object. + InnerError *ErrorDetail `json:"error,omitempty"` +} + +// Error implements the error interface for type ErrorResponse. +// The contents of the error text are not contractual and subject to change. +func (e ErrorResponse) Error() string { + return e.raw +} + +// LogSpecification - Specifications of the Logs for Azure Monitoring. +type LogSpecification struct { + // Localized friendly display name of the log. + DisplayName *string `json:"displayName,omitempty"` + + // Name of the log. + Name *string `json:"name,omitempty"` +} + +// ManagedIdentity - A class represent managed identities used for request and response +type ManagedIdentity struct { + // Represent the identity type: systemAssigned, userAssigned, None + Type *ManagedIdentityType `json:"type,omitempty"` + + // Get or set the user assigned identities + UserAssignedIdentities map[string]*UserAssignedIdentityProperty `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; Get the principal id for the system assigned identity. Only be used in response. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; Get the tenant id for the system assigned identity. Only be used in response + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentity. +func (m ManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// ManagedIdentitySettings - Managed identity settings for upstream. +type ManagedIdentitySettings struct { + // The Resource indicating the App ID URI of the target resource. It also appears in the aud (audience) claim of the issued token. + Resource *string `json:"resource,omitempty"` +} + +// MetricSpecification - Specifications of the Metrics for Azure Monitoring. +type MetricSpecification struct { + // Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + + // The name of the metric category that the metric belongs to. A metric can only belong to a single category. + Category *string `json:"category,omitempty"` + + // The dimensions of the metrics. + Dimensions []*Dimension `json:"dimensions,omitempty"` + + // Localized friendly description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + + // Localized friendly display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + + // Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. Ex. a metric that returns the number of + // times a particular error code was emitted. The + // error code may not appear often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. + FillGapWithZero *string `json:"fillGapWithZero,omitempty"` + + // Name of the metric. + Name *string `json:"name,omitempty"` + + // The unit that makes sense for the metric. + Unit *string `json:"unit,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "name", m.Name) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// NameAvailability - Result of the request to check name availability. It contains a flag and possible reason of failure. +type NameAvailability struct { + // The message of the operation. + Message *string `json:"message,omitempty"` + + // Indicates whether the name is available or not. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // The reason of the availability. Required if name is not available. + Reason *string `json:"reason,omitempty"` +} + +// NameAvailabilityParameters - Data POST-ed to the nameAvailability action +type NameAvailabilityParameters struct { + // REQUIRED; The resource name to validate. e.g."my-resource-name" + Name *string `json:"name,omitempty"` + + // REQUIRED; The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" + Type *string `json:"type,omitempty"` +} + +// NetworkACL - Network ACL +type NetworkACL struct { + // Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Allow []*SignalRRequestType `json:"allow,omitempty"` + + // Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Deny []*SignalRRequestType `json:"deny,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkACL. +func (n NetworkACL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + n.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (n NetworkACL) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "allow", n.Allow) + populate(objectMap, "deny", n.Deny) +} + +// Operation - REST API operation supported by resource provider. +type Operation struct { + // The object that describes the operation. + Display *OperationDisplay `json:"display,omitempty"` + + // If the operation is a data action. (for data plane rbac) + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Name of the operation with format: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + + // Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. + Origin *string `json:"origin,omitempty"` + + // Extra properties for the operation. + Properties *OperationProperties `json:"properties,omitempty"` +} + +// OperationDisplay - The object that describes a operation. +type OperationDisplay struct { + // The localized friendly description for the operation + Description *string `json:"description,omitempty"` + + // The localized friendly name for the operation. + Operation *string `json:"operation,omitempty"` + + // Friendly name of the resource provider + Provider *string `json:"provider,omitempty"` + + // Resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationList - Result of the request to list REST API operations. It contains a list of operations. +type OperationList struct { + // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // List of operations supported by the resource provider. + Value []*Operation `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationProperties - Extra Operation properties. +type OperationProperties struct { + // The service specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpoint - Private endpoint +type PrivateEndpoint struct { + // Full qualified Id of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointACL - ACL for a private endpoint +type PrivateEndpointACL struct { + NetworkACL + // REQUIRED; Name of the private endpoint connection + Name *string `json:"name,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointACL. +func (p PrivateEndpointACL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.NetworkACL.marshalInternal(objectMap) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection - A private endpoint connection to an azure resource +type PrivateEndpointConnection struct { + ProxyResource + // Properties of the private endpoint connection + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionList - A list of private endpoint connections +type PrivateEndpointConnectionList struct { + // Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections + // exceed maximum page size. + NextLink *string `json:"nextLink,omitempty"` + + // The list of the private endpoint connections + Value []*PrivateEndpointConnection `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionList. +func (p PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionProperties - Private endpoint connection properties +type PrivateEndpointConnectionProperties struct { + // Private endpoint associated with the private endpoint connection + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + + // Connection state + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // READ-ONLY; Group IDs + GroupIDs []*string `json:"groupIds,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the private endpoint connection + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// PrivateLinkResource - Private link resource +type PrivateLinkResource struct { + ProxyResource + // Properties of a private link resource + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceList - Contains a list of PrivateLinkResource and a possible link to query more results +type PrivateLinkResourceList struct { + // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // List of PrivateLinkResource + Value []*PrivateLinkResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceList. +func (p PrivateLinkResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceProperties - Private link resource properties +type PrivateLinkResourceProperties struct { + // Group Id of the private link resource + GroupID *string `json:"groupId,omitempty"` + + // Required members of the private link resource + RequiredMembers []*string `json:"requiredMembers,omitempty"` + + // Required private DNS zone names + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + + // The list of resources that are onboarded to private link service + ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState - Connection state of the private endpoint connection +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateLinkServiceConnectionStatus `json:"status,omitempty"` +} + +// ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location and tags +type ProxyResource struct { + Resource +} + +func (p ProxyResource) marshalInternal(objectMap map[string]interface{}) { + p.Resource.marshalInternal(objectMap) +} + +// RegenerateKeyParameters - Parameters describes the request to regenerate access keys +type RegenerateKeyParameters struct { + // The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). + KeyType *KeyType `json:"keyType,omitempty"` +} + +// Resource - The core properties of ARM resources. +type Resource struct { + // READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + 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) +} + +// ResourceLogCategory - Resource log category configuration of a Microsoft.SignalRService resource. +type ResourceLogCategory struct { + // Indicates whether or the resource log category is enabled. Available values: true, false. Case insensitive. + Enabled *string `json:"enabled,omitempty"` + + // Gets or sets the resource log category's name. Available values: ConnectivityLogs, MessagingLogs. Case insensitive. + Name *string `json:"name,omitempty"` +} + +// ResourceLogConfiguration - Resource log configuration of a Microsoft.SignalRService resource. +type ResourceLogConfiguration struct { + // Gets or sets the list of category configurations. + Categories []*ResourceLogCategory `json:"categories,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceLogConfiguration. +func (r ResourceLogConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "categories", r.Categories) + return json.Marshal(objectMap) +} + +// ResourceSKU - The billing information of the resource. +type ResourceSKU struct { + // REQUIRED; The name of the SKU. Required. + // Allowed values: StandardS1, FreeF1 + Name *string `json:"name,omitempty"` + + // Optional, integer. The unit count of the resource. 1 by default. + // If present, following values are allowed: Free: 1 Standard: 1,2,5,10,20,50,100 + Capacity *int32 `json:"capacity,omitempty"` + + // Optional tier of this particular SKU. 'Standard' or 'Free'. + // Basic is deprecated, use Standard instead. + Tier *SignalRSKUTier `json:"tier,omitempty"` + + // READ-ONLY; Not used. Retained for future use. + Family *string `json:"family,omitempty" azure:"ro"` + + // READ-ONLY; Not used. Retained for future use. + Size *string `json:"size,omitempty" azure:"ro"` +} + +// SKU - Describes an available sku." +type SKU struct { + // READ-ONLY; Specifies the unit of the resource. + Capacity *SKUCapacity `json:"capacity,omitempty" azure:"ro"` + + // READ-ONLY; The resource type that this object applies to + ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + + // READ-ONLY; The exact set of keys that define this sku. + SKU *ResourceSKU `json:"sku,omitempty" azure:"ro"` +} + +// SKUCapacity - Describes scaling information of a sku. +type SKUCapacity struct { + // READ-ONLY; Allows capacity value list. + AllowedValues []*int32 `json:"allowedValues,omitempty" azure:"ro"` + + // READ-ONLY; The default capacity. + Default *int32 `json:"default,omitempty" azure:"ro"` + + // READ-ONLY; The highest permitted capacity for this resource + Maximum *int32 `json:"maximum,omitempty" azure:"ro"` + + // READ-ONLY; The lowest permitted capacity for this resource + Minimum *int32 `json:"minimum,omitempty" azure:"ro"` + + // READ-ONLY; The scale type applicable to the sku. + ScaleType *ScaleType `json:"scaleType,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SKUCapacity. +func (s SKUCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedValues", s.AllowedValues) + populate(objectMap, "default", s.Default) + populate(objectMap, "maximum", s.Maximum) + populate(objectMap, "minimum", s.Minimum) + populate(objectMap, "scaleType", s.ScaleType) + return json.Marshal(objectMap) +} + +// SKUList - The list skus operation response +type SKUList struct { + // READ-ONLY; The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of skus available for the resource. + Value []*SKU `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SKUList. +func (s SKUList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// ServerlessUpstreamSettings - The settings for the Upstream when the service is in server-less mode. +type ServerlessUpstreamSettings struct { + // Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. + Templates []*UpstreamTemplate `json:"templates,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServerlessUpstreamSettings. +func (s ServerlessUpstreamSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "templates", s.Templates) + return json.Marshal(objectMap) +} + +// ServiceSpecification - An object that describes a specification. +type ServiceSpecification struct { + // Specifications of the Logs for Azure Monitoring. + LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty"` + + // Specifications of the Metrics for Azure Monitoring. + MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// ShareablePrivateLinkResourceProperties - Describes the properties of a resource type that has been onboarded to private link service +type ShareablePrivateLinkResourceProperties struct { + // The description of the resource type that has been onboarded to private link service + Description *string `json:"description,omitempty"` + + // The resource provider group id for the resource that has been onboarded to private link service + GroupID *string `json:"groupId,omitempty"` + + // The resource provider type for the resource that has been onboarded to private link service + Type *string `json:"type,omitempty"` +} + +// ShareablePrivateLinkResourceType - Describes a resource type that has been onboarded to private link service +type ShareablePrivateLinkResourceType struct { + // The name of the resource type that has been onboarded to private link service + Name *string `json:"name,omitempty"` + + // Describes the properties of a resource type that has been onboarded to private link service + Properties *ShareablePrivateLinkResourceProperties `json:"properties,omitempty"` +} + +// SharedPrivateLinkResource - Describes a Shared Private Link Resource +type SharedPrivateLinkResource struct { + ProxyResource + // Describes the properties of a Shared Private Link Resource + Properties *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResource. +func (s SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// SharedPrivateLinkResourceList - A list of shared private link resources +type SharedPrivateLinkResourceList struct { + // Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections + // exceed maximum page size. + NextLink *string `json:"nextLink,omitempty"` + + // The list of the shared private link resources + Value []*SharedPrivateLinkResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceList. +func (s SharedPrivateLinkResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SharedPrivateLinkResourceProperties - Describes the properties of an existing Shared Private Link Resource +type SharedPrivateLinkResourceProperties struct { + // REQUIRED; The group id from the provider of resource the shared private link resource is for + GroupID *string `json:"groupId,omitempty"` + + // REQUIRED; The resource id of the resource the shared private link resource is for + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + + // The request message for requesting approval of the shared private link resource + RequestMessage *string `json:"requestMessage,omitempty"` + + // READ-ONLY; Provisioning state of the shared private link resource + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Status of the shared private link resource + Status *SharedPrivateLinkResourceStatus `json:"status,omitempty" azure:"ro"` +} + +// SignalRBeginCreateOrUpdateOptions contains the optional parameters for the SignalR.BeginCreateOrUpdate method. +type SignalRBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SignalRBeginDeleteOptions contains the optional parameters for the SignalR.BeginDelete method. +type SignalRBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// SignalRBeginRegenerateKeyOptions contains the optional parameters for the SignalR.BeginRegenerateKey method. +type SignalRBeginRegenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// SignalRBeginRestartOptions contains the optional parameters for the SignalR.BeginRestart method. +type SignalRBeginRestartOptions struct { + // placeholder for future optional parameters +} + +// SignalRBeginUpdateOptions contains the optional parameters for the SignalR.BeginUpdate method. +type SignalRBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// SignalRCheckNameAvailabilityOptions contains the optional parameters for the SignalR.CheckNameAvailability method. +type SignalRCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// SignalRCorsSettings - Cross-Origin Resource Sharing (CORS) settings. +type SignalRCorsSettings struct { + // Gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If + // omitted, allow all by default. + AllowedOrigins []*string `json:"allowedOrigins,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRCorsSettings. +func (s SignalRCorsSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedOrigins", s.AllowedOrigins) + return json.Marshal(objectMap) +} + +// SignalRFeature - Feature of a resource, which controls the runtime behavior. +type SignalRFeature struct { + // REQUIRED; FeatureFlags is the supported features of Azure SignalR service. + // * ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have your own backend server; "Serverless": your application doesn't + // have a backend server; "Classic": for + // backward compatibility. Support both Default and Serverless mode but not recommended; "PredefinedOnly": for future use. + // * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category respectively. + // * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category respectively. + // * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR service, it will give you live traces in real time, it will be + // helpful when you developing your own Azure + // SignalR based web application or self-troubleshooting some issues. Please note that live traces are counted as outbound messages that will be charged. + // Values allowed: "true"/"false", to + // enable/disable live trace feature. + Flag *FeatureFlags `json:"flag,omitempty"` + + // REQUIRED; Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. + Value *string `json:"value,omitempty"` + + // Optional properties related to this feature. + Properties map[string]*string `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRFeature. +func (s SignalRFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "flag", s.Flag) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SignalRGetOptions contains the optional parameters for the SignalR.Get method. +type SignalRGetOptions struct { + // placeholder for future optional parameters +} + +// SignalRKeys - A class represents the access keys of the resource. +type SignalRKeys struct { + // Connection string constructed via the primaryKey + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + + // The primary access key. + PrimaryKey *string `json:"primaryKey,omitempty"` + + // Connection string constructed via the secondaryKey + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + + // The secondary access key. + SecondaryKey *string `json:"secondaryKey,omitempty"` +} + +// SignalRListByResourceGroupOptions contains the optional parameters for the SignalR.ListByResourceGroup method. +type SignalRListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SignalRListBySubscriptionOptions contains the optional parameters for the SignalR.ListBySubscription method. +type SignalRListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SignalRListKeysOptions contains the optional parameters for the SignalR.ListKeys method. +type SignalRListKeysOptions struct { + // placeholder for future optional parameters +} + +// SignalRListSKUsOptions contains the optional parameters for the SignalR.ListSKUs method. +type SignalRListSKUsOptions struct { + // placeholder for future optional parameters +} + +// SignalRNetworkACLs - Network ACLs for the resource +type SignalRNetworkACLs struct { + // Default action when no other rule matches + DefaultAction *ACLAction `json:"defaultAction,omitempty"` + + // ACLs for requests from private endpoints + PrivateEndpoints []*PrivateEndpointACL `json:"privateEndpoints,omitempty"` + + // ACL for requests from public network + PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRNetworkACLs. +func (s SignalRNetworkACLs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", s.DefaultAction) + populate(objectMap, "privateEndpoints", s.PrivateEndpoints) + populate(objectMap, "publicNetwork", s.PublicNetwork) + return json.Marshal(objectMap) +} + +// SignalRPrivateEndpointConnectionsBeginDeleteOptions contains the optional parameters for the SignalRPrivateEndpointConnections.BeginDelete method. +type SignalRPrivateEndpointConnectionsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// SignalRPrivateEndpointConnectionsGetOptions contains the optional parameters for the SignalRPrivateEndpointConnections.Get method. +type SignalRPrivateEndpointConnectionsGetOptions struct { + // placeholder for future optional parameters +} + +// SignalRPrivateEndpointConnectionsListOptions contains the optional parameters for the SignalRPrivateEndpointConnections.List method. +type SignalRPrivateEndpointConnectionsListOptions struct { + // placeholder for future optional parameters +} + +// SignalRPrivateEndpointConnectionsUpdateOptions contains the optional parameters for the SignalRPrivateEndpointConnections.Update method. +type SignalRPrivateEndpointConnectionsUpdateOptions struct { + // placeholder for future optional parameters +} + +// SignalRPrivateLinkResourcesListOptions contains the optional parameters for the SignalRPrivateLinkResources.List method. +type SignalRPrivateLinkResourcesListOptions struct { + // placeholder for future optional parameters +} + +// SignalRProperties - A class that describes the properties of the resource +type SignalRProperties struct { + // Cross-Origin Resource Sharing (CORS) settings. + Cors *SignalRCorsSettings `json:"cors,omitempty"` + + // DisableLocalAuth Enable or disable aad auth When set as true, connection with AuthType=aad won't work. + DisableAADAuth *bool `json:"disableAadAuth,omitempty"` + + // DisableLocalAuth Enable or disable local auth with AccessKey When set as true, connection with AccessKey=xxx won't work. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + + // List of the featureFlags. + // FeatureFlags that are not included in the parameters for the update operation will not be modified. And the response will only include featureFlags that + // are explicitly set. When a featureFlag is not + // explicitly set, its globally default value will be used But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + Features []*SignalRFeature `json:"features,omitempty"` + + // Network ACLs + NetworkACLs *SignalRNetworkACLs `json:"networkACLs,omitempty"` + + // Enable or disable public network access. Default to "Enabled". When it's Enabled, network ACLs still apply. When it's Disabled, public network access + // is always disabled no matter what you set in + // network ACLs. + PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + + // Resource log configuration of a Microsoft.SignalRService resource. If resourceLogConfiguration isn't null or empty, it will override options "EnableConnectivityLog" + // and "EnableMessagingLogs" in + // features. Otherwise, use options "EnableConnectivityLog" and "EnableMessagingLogs" in features. + ResourceLogConfiguration *ResourceLogConfiguration `json:"resourceLogConfiguration,omitempty"` + + // TLS settings. + TLS *SignalRTLSSettings `json:"tls,omitempty"` + + // Upstream settings when the service is in server-less mode. + Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"` + + // READ-ONLY; The publicly accessible IP of the resource. + ExternalIP *string `json:"externalIP,omitempty" azure:"ro"` + + // READ-ONLY; FQDN of the service instance. + HostName *string `json:"hostName,omitempty" azure:"ro"` + + // READ-ONLY; Deprecated. + HostNamePrefix *string `json:"hostNamePrefix,omitempty" azure:"ro"` + + // READ-ONLY; Private endpoint connections to the resource. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The publicly accessible port of the resource which is designed for browser/client side usage. + PublicPort *int32 `json:"publicPort,omitempty" azure:"ro"` + + // READ-ONLY; The publicly accessible port of the resource which is designed for customer server side usage. + ServerPort *int32 `json:"serverPort,omitempty" azure:"ro"` + + // READ-ONLY; The list of shared private link resources. + SharedPrivateLinkResources []*SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty" azure:"ro"` + + // READ-ONLY; Version of the resource. Probably you need the same or higher version of client SDKs. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRProperties. +func (s SignalRProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cors", s.Cors) + populate(objectMap, "disableAadAuth", s.DisableAADAuth) + populate(objectMap, "disableLocalAuth", s.DisableLocalAuth) + populate(objectMap, "externalIP", s.ExternalIP) + populate(objectMap, "features", s.Features) + populate(objectMap, "hostName", s.HostName) + populate(objectMap, "hostNamePrefix", s.HostNamePrefix) + populate(objectMap, "networkACLs", s.NetworkACLs) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "publicPort", s.PublicPort) + populate(objectMap, "resourceLogConfiguration", s.ResourceLogConfiguration) + populate(objectMap, "serverPort", s.ServerPort) + populate(objectMap, "sharedPrivateLinkResources", s.SharedPrivateLinkResources) + populate(objectMap, "tls", s.TLS) + populate(objectMap, "upstream", s.Upstream) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// SignalRResource - A class represent a resource. +type SignalRResource struct { + TrackedResource + // The managed identity response + Identity *ManagedIdentity `json:"identity,omitempty"` + + // The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR" + Kind *ServiceKind `json:"kind,omitempty"` + + // Settings used to provision or configure the resource + Properties *SignalRProperties `json:"properties,omitempty"` + + // The billing information of the resource.(e.g. Free, Standard) + SKU *ResourceSKU `json:"sku,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRResource. +func (s SignalRResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// SignalRResourceList - Object that includes an array of resources and a possible link for next set. +type SignalRResourceList struct { + // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // List of the resources + Value []*SignalRResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRResourceList. +func (s SignalRResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SignalRSharedPrivateLinkResourcesBeginCreateOrUpdateOptions contains the optional parameters for the SignalRSharedPrivateLinkResources.BeginCreateOrUpdate +// method. +type SignalRSharedPrivateLinkResourcesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SignalRSharedPrivateLinkResourcesBeginDeleteOptions contains the optional parameters for the SignalRSharedPrivateLinkResources.BeginDelete method. +type SignalRSharedPrivateLinkResourcesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// SignalRSharedPrivateLinkResourcesGetOptions contains the optional parameters for the SignalRSharedPrivateLinkResources.Get method. +type SignalRSharedPrivateLinkResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// SignalRSharedPrivateLinkResourcesListOptions contains the optional parameters for the SignalRSharedPrivateLinkResources.List method. +type SignalRSharedPrivateLinkResourcesListOptions struct { + // placeholder for future optional parameters +} + +// SignalRTLSSettings - TLS settings for the resource +type SignalRTLSSettings struct { + // Request client certificate during TLS handshake if enabled + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` +} + +// SignalRUsage - Object that describes a specific usage of the resources. +type SignalRUsage struct { + // Current value for the usage quota. + CurrentValue *int64 `json:"currentValue,omitempty"` + + // Fully qualified ARM resource id + ID *string `json:"id,omitempty"` + + // The maximum permitted value for the usage quota. If there is no limit, this value will be -1. + Limit *int64 `json:"limit,omitempty"` + + // Localizable String object containing the name and a localized value. + Name *SignalRUsageName `json:"name,omitempty"` + + // Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + Unit *string `json:"unit,omitempty"` +} + +// SignalRUsageList - Object that includes an array of the resource usages and a possible link for next set. +type SignalRUsageList struct { + // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // List of the resource usages + Value []*SignalRUsage `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRUsageList. +func (s SignalRUsageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SignalRUsageName - Localizable String object containing the name and a localized value. +type SignalRUsageName struct { + // Localized name of the usage. + LocalizedValue *string `json:"localizedValue,omitempty"` + + // The identifier of the usage. + Value *string `json:"value,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TrackedResource - The resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + Resource + // The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. + Location *string `json:"location,omitempty"` + + // Tags of the service which is a list of key value pairs that describe the resource. + 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) +} + +// UpstreamAuthSettings - Upstream auth settings. +type UpstreamAuthSettings struct { + // Gets or sets the managed identity settings. It's required if the auth type is set to ManagedIdentity. + ManagedIdentity *ManagedIdentitySettings `json:"managedIdentity,omitempty"` + + // Gets or sets the type of auth. None or ManagedIdentity is supported now. + Type *UpstreamAuthType `json:"type,omitempty"` +} + +// UpstreamTemplate - Upstream template item settings. It defines the Upstream URL of the incoming requests. The template defines the pattern of the event, +// the hub or the category of the incoming request that matches +// current URL template. +type UpstreamTemplate struct { + // REQUIRED; Gets or sets the Upstream URL template. You can use 3 predefined parameters {hub}, {category} {event} inside the template, the value of the + // Upstream URL is dynamically calculated when the client + // request comes in. For example, if the urlTemplate is http://example.com/{hub}/api/{event}, with a client request from hub chat connects, it will first + // POST to this URL: + // http://example.com/chat/api/connect. + URLTemplate *string `json:"urlTemplate,omitempty"` + + // Gets or sets the auth settings for an upstream. If not set, no auth is used for upstream messages. + Auth *UpstreamAuthSettings `json:"auth,omitempty"` + + // Gets or sets the matching pattern for category names. If not set, it matches any category. There are 3 kind of patterns supported: 1. "*", it to matches + // any category name 2. Combine multiple + // categories with ",", for example "connections,messages", it matches category "connections" and "messages" 3. The single category name, for example, "connections", + // it matches the category "connections" + CategoryPattern *string `json:"categoryPattern,omitempty"` + + // Gets or sets the matching pattern for event names. If not set, it matches any event. There are 3 kind of patterns supported: 1. "*", it to matches any + // event name 2. Combine multiple events with ",", + // for example "connect,disconnect", it matches event "connect" and "disconnect" 3. The single event name, for example, "connect", it matches "connect" + EventPattern *string `json:"eventPattern,omitempty"` + + // Gets or sets the matching pattern for hub names. If not set, it matches any hub. There are 3 kind of patterns supported: 1. "*", it to matches any hub + // name 2. Combine multiple hubs with ",", for + // example "hub1,hub2", it matches "hub1" and "hub2" 3. The single hub name, for example, "hub1", it matches "hub1" + HubPattern *string `json:"hubPattern,omitempty"` +} + +// UsagesListOptions contains the optional parameters for the Usages.List method. +type UsagesListOptions struct { + // placeholder for future optional parameters +} + +// UserAssignedIdentityProperty - Properties of user assigned identity. +type UserAssignedIdentityProperty struct { + // READ-ONLY; Get the client id for the user assigned identity + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; Get the principal id for the user assigned identity + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + +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/signalr/armsignalr/zz_generated_operations_client.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_operations_client.go new file mode 100644 index 000000000000..4a2a1fda6852 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_operations_client.go @@ -0,0 +1,89 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsignalr + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Lists all of the available REST API operations of the Microsoft.SignalRService provider. +// If the operation fails it returns the *ErrorResponse error type. +func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager { + return &OperationsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.SignalRService/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { + return OperationsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/signalr/armsignalr/zz_generated_pagers.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_pagers.go new file mode 100644 index 000000000000..f416bb8869b3 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_pagers.go @@ -0,0 +1,395 @@ +//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 armsignalr + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// OperationsListPager provides operations for iterating over paged responses. +type OperationsListPager struct { + client *OperationsClient + current OperationsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.OperationList.NextLink == nil || len(*p.current.OperationList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsListResponse page. +func (p *OperationsListPager) PageResponse() OperationsListResponse { + return p.current +} + +// SignalRListByResourceGroupPager provides operations for iterating over paged responses. +type SignalRListByResourceGroupPager struct { + client *SignalRClient + current SignalRListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SignalRListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SignalRListByResourceGroupPager) 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 *SignalRListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SignalRResourceList.NextLink == nil || len(*p.current.SignalRResourceList.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 SignalRListByResourceGroupResponse page. +func (p *SignalRListByResourceGroupPager) PageResponse() SignalRListByResourceGroupResponse { + return p.current +} + +// SignalRListBySubscriptionPager provides operations for iterating over paged responses. +type SignalRListBySubscriptionPager struct { + client *SignalRClient + current SignalRListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SignalRListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SignalRListBySubscriptionPager) 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 *SignalRListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SignalRResourceList.NextLink == nil || len(*p.current.SignalRResourceList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SignalRListBySubscriptionResponse page. +func (p *SignalRListBySubscriptionPager) PageResponse() SignalRListBySubscriptionResponse { + return p.current +} + +// SignalRPrivateEndpointConnectionsListPager provides operations for iterating over paged responses. +type SignalRPrivateEndpointConnectionsListPager struct { + client *SignalRPrivateEndpointConnectionsClient + current SignalRPrivateEndpointConnectionsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SignalRPrivateEndpointConnectionsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SignalRPrivateEndpointConnectionsListPager) 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 *SignalRPrivateEndpointConnectionsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionList.NextLink == nil || len(*p.current.PrivateEndpointConnectionList.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 SignalRPrivateEndpointConnectionsListResponse page. +func (p *SignalRPrivateEndpointConnectionsListPager) PageResponse() SignalRPrivateEndpointConnectionsListResponse { + return p.current +} + +// SignalRPrivateLinkResourcesListPager provides operations for iterating over paged responses. +type SignalRPrivateLinkResourcesListPager struct { + client *SignalRPrivateLinkResourcesClient + current SignalRPrivateLinkResourcesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SignalRPrivateLinkResourcesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SignalRPrivateLinkResourcesListPager) 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 *SignalRPrivateLinkResourcesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkResourceList.NextLink == nil || len(*p.current.PrivateLinkResourceList.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 SignalRPrivateLinkResourcesListResponse page. +func (p *SignalRPrivateLinkResourcesListPager) PageResponse() SignalRPrivateLinkResourcesListResponse { + return p.current +} + +// SignalRSharedPrivateLinkResourcesListPager provides operations for iterating over paged responses. +type SignalRSharedPrivateLinkResourcesListPager struct { + client *SignalRSharedPrivateLinkResourcesClient + current SignalRSharedPrivateLinkResourcesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SignalRSharedPrivateLinkResourcesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SignalRSharedPrivateLinkResourcesListPager) 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 *SignalRSharedPrivateLinkResourcesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SharedPrivateLinkResourceList.NextLink == nil || len(*p.current.SharedPrivateLinkResourceList.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 SignalRSharedPrivateLinkResourcesListResponse page. +func (p *SignalRSharedPrivateLinkResourcesListPager) PageResponse() SignalRSharedPrivateLinkResourcesListResponse { + return p.current +} + +// UsagesListPager provides operations for iterating over paged responses. +type UsagesListPager struct { + client *UsagesClient + current UsagesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, UsagesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *UsagesListPager) 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 *UsagesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SignalRUsageList.NextLink == nil || len(*p.current.SignalRUsageList.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 UsagesListResponse page. +func (p *UsagesListPager) PageResponse() UsagesListResponse { + return p.current +} diff --git a/sdk/resourcemanager/signalr/armsignalr/zz_generated_pollers.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_pollers.go new file mode 100644 index 000000000000..08012aee1c2f --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_pollers.go @@ -0,0 +1,359 @@ +//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 armsignalr + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// SignalRCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SignalRCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRCreateOrUpdatePoller) 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 *SignalRCreateOrUpdatePoller) 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 SignalRCreateOrUpdateResponse will be returned. +func (p *SignalRCreateOrUpdatePoller) FinalResponse(ctx context.Context) (SignalRCreateOrUpdateResponse, error) { + respType := SignalRCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SignalRResource) + if err != nil { + return SignalRCreateOrUpdateResponse{}, 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 *SignalRCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRDeletePoller provides polling facilities until the operation reaches a terminal state. +type SignalRDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRDeletePoller) 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 *SignalRDeletePoller) 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 SignalRDeleteResponse will be returned. +func (p *SignalRDeletePoller) FinalResponse(ctx context.Context) (SignalRDeleteResponse, error) { + respType := SignalRDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SignalRDeleteResponse{}, 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 *SignalRDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRPrivateEndpointConnectionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type SignalRPrivateEndpointConnectionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRPrivateEndpointConnectionsDeletePoller) 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 *SignalRPrivateEndpointConnectionsDeletePoller) 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 SignalRPrivateEndpointConnectionsDeleteResponse will be returned. +func (p *SignalRPrivateEndpointConnectionsDeletePoller) FinalResponse(ctx context.Context) (SignalRPrivateEndpointConnectionsDeleteResponse, error) { + respType := SignalRPrivateEndpointConnectionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SignalRPrivateEndpointConnectionsDeleteResponse{}, 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 *SignalRPrivateEndpointConnectionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRRegenerateKeyPoller provides polling facilities until the operation reaches a terminal state. +type SignalRRegenerateKeyPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRRegenerateKeyPoller) 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 *SignalRRegenerateKeyPoller) 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 SignalRRegenerateKeyResponse will be returned. +func (p *SignalRRegenerateKeyPoller) FinalResponse(ctx context.Context) (SignalRRegenerateKeyResponse, error) { + respType := SignalRRegenerateKeyResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SignalRKeys) + if err != nil { + return SignalRRegenerateKeyResponse{}, 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 *SignalRRegenerateKeyPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRRestartPoller provides polling facilities until the operation reaches a terminal state. +type SignalRRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRRestartPoller) 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 *SignalRRestartPoller) 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 SignalRRestartResponse will be returned. +func (p *SignalRRestartPoller) FinalResponse(ctx context.Context) (SignalRRestartResponse, error) { + respType := SignalRRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SignalRRestartResponse{}, 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 *SignalRRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller) 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 *SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller) 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 SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse will be returned. +func (p *SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse, error) { + respType := SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SharedPrivateLinkResource) + if err != nil { + return SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse{}, 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 *SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRSharedPrivateLinkResourcesDeletePoller provides polling facilities until the operation reaches a terminal state. +type SignalRSharedPrivateLinkResourcesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRSharedPrivateLinkResourcesDeletePoller) 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 *SignalRSharedPrivateLinkResourcesDeletePoller) 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 SignalRSharedPrivateLinkResourcesDeleteResponse will be returned. +func (p *SignalRSharedPrivateLinkResourcesDeletePoller) FinalResponse(ctx context.Context) (SignalRSharedPrivateLinkResourcesDeleteResponse, error) { + respType := SignalRSharedPrivateLinkResourcesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SignalRSharedPrivateLinkResourcesDeleteResponse{}, 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 *SignalRSharedPrivateLinkResourcesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SignalRUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SignalRUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SignalRUpdatePoller) 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 *SignalRUpdatePoller) 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 SignalRUpdateResponse will be returned. +func (p *SignalRUpdatePoller) FinalResponse(ctx context.Context) (SignalRUpdateResponse, error) { + respType := SignalRUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SignalRResource) + if err != nil { + return SignalRUpdateResponse{}, 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 *SignalRUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/signalr/armsignalr/zz_generated_response_types.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_response_types.go new file mode 100644 index 000000000000..b8da2274883c --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_response_types.go @@ -0,0 +1,576 @@ +//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 armsignalr + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + OperationList +} + +// SignalRCheckNameAvailabilityResponse contains the response from method SignalR.CheckNameAvailability. +type SignalRCheckNameAvailabilityResponse struct { + SignalRCheckNameAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRCheckNameAvailabilityResult contains the result from method SignalR.CheckNameAvailability. +type SignalRCheckNameAvailabilityResult struct { + NameAvailability +} + +// SignalRCreateOrUpdatePollerResponse contains the response from method SignalR.CreateOrUpdate. +type SignalRCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRCreateOrUpdateResponse, error) { + respType := SignalRCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SignalRResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *SignalRCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *SignalRClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &SignalRCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRCreateOrUpdateResponse contains the response from method SignalR.CreateOrUpdate. +type SignalRCreateOrUpdateResponse struct { + SignalRCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRCreateOrUpdateResult contains the result from method SignalR.CreateOrUpdate. +type SignalRCreateOrUpdateResult struct { + SignalRResource +} + +// SignalRDeletePollerResponse contains the response from method SignalR.Delete. +type SignalRDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRDeleteResponse, error) { + respType := SignalRDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRDeletePollerResponse from the provided client and resume token. +func (l *SignalRDeletePollerResponse) Resume(ctx context.Context, client *SignalRClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SignalRDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRDeleteResponse contains the response from method SignalR.Delete. +type SignalRDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRGetResponse contains the response from method SignalR.Get. +type SignalRGetResponse struct { + SignalRGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRGetResult contains the result from method SignalR.Get. +type SignalRGetResult struct { + SignalRResource +} + +// SignalRListByResourceGroupResponse contains the response from method SignalR.ListByResourceGroup. +type SignalRListByResourceGroupResponse struct { + SignalRListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRListByResourceGroupResult contains the result from method SignalR.ListByResourceGroup. +type SignalRListByResourceGroupResult struct { + SignalRResourceList +} + +// SignalRListBySubscriptionResponse contains the response from method SignalR.ListBySubscription. +type SignalRListBySubscriptionResponse struct { + SignalRListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRListBySubscriptionResult contains the result from method SignalR.ListBySubscription. +type SignalRListBySubscriptionResult struct { + SignalRResourceList +} + +// SignalRListKeysResponse contains the response from method SignalR.ListKeys. +type SignalRListKeysResponse struct { + SignalRListKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRListKeysResult contains the result from method SignalR.ListKeys. +type SignalRListKeysResult struct { + SignalRKeys +} + +// SignalRListSKUsResponse contains the response from method SignalR.ListSKUs. +type SignalRListSKUsResponse struct { + SignalRListSKUsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRListSKUsResult contains the result from method SignalR.ListSKUs. +type SignalRListSKUsResult struct { + SKUList +} + +// SignalRPrivateEndpointConnectionsDeletePollerResponse contains the response from method SignalRPrivateEndpointConnections.Delete. +type SignalRPrivateEndpointConnectionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRPrivateEndpointConnectionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRPrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRPrivateEndpointConnectionsDeleteResponse, error) { + respType := SignalRPrivateEndpointConnectionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRPrivateEndpointConnectionsDeletePollerResponse from the provided client and resume token. +func (l *SignalRPrivateEndpointConnectionsDeletePollerResponse) Resume(ctx context.Context, client *SignalRPrivateEndpointConnectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRPrivateEndpointConnectionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SignalRPrivateEndpointConnectionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRPrivateEndpointConnectionsDeleteResponse contains the response from method SignalRPrivateEndpointConnections.Delete. +type SignalRPrivateEndpointConnectionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRPrivateEndpointConnectionsGetResponse contains the response from method SignalRPrivateEndpointConnections.Get. +type SignalRPrivateEndpointConnectionsGetResponse struct { + SignalRPrivateEndpointConnectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRPrivateEndpointConnectionsGetResult contains the result from method SignalRPrivateEndpointConnections.Get. +type SignalRPrivateEndpointConnectionsGetResult struct { + PrivateEndpointConnection +} + +// SignalRPrivateEndpointConnectionsListResponse contains the response from method SignalRPrivateEndpointConnections.List. +type SignalRPrivateEndpointConnectionsListResponse struct { + SignalRPrivateEndpointConnectionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRPrivateEndpointConnectionsListResult contains the result from method SignalRPrivateEndpointConnections.List. +type SignalRPrivateEndpointConnectionsListResult struct { + PrivateEndpointConnectionList +} + +// SignalRPrivateEndpointConnectionsUpdateResponse contains the response from method SignalRPrivateEndpointConnections.Update. +type SignalRPrivateEndpointConnectionsUpdateResponse struct { + SignalRPrivateEndpointConnectionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRPrivateEndpointConnectionsUpdateResult contains the result from method SignalRPrivateEndpointConnections.Update. +type SignalRPrivateEndpointConnectionsUpdateResult struct { + PrivateEndpointConnection +} + +// SignalRPrivateLinkResourcesListResponse contains the response from method SignalRPrivateLinkResources.List. +type SignalRPrivateLinkResourcesListResponse struct { + SignalRPrivateLinkResourcesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRPrivateLinkResourcesListResult contains the result from method SignalRPrivateLinkResources.List. +type SignalRPrivateLinkResourcesListResult struct { + PrivateLinkResourceList +} + +// SignalRRegenerateKeyPollerResponse contains the response from method SignalR.RegenerateKey. +type SignalRRegenerateKeyPollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRRegenerateKeyPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRRegenerateKeyResponse, error) { + respType := SignalRRegenerateKeyResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SignalRKeys) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRRegenerateKeyPollerResponse from the provided client and resume token. +func (l *SignalRRegenerateKeyPollerResponse) Resume(ctx context.Context, client *SignalRClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRClient.RegenerateKey", token, client.pl, client.regenerateKeyHandleError) + if err != nil { + return err + } + poller := &SignalRRegenerateKeyPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRRegenerateKeyResponse contains the response from method SignalR.RegenerateKey. +type SignalRRegenerateKeyResponse struct { + SignalRRegenerateKeyResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRRegenerateKeyResult contains the result from method SignalR.RegenerateKey. +type SignalRRegenerateKeyResult struct { + SignalRKeys +} + +// SignalRRestartPollerResponse contains the response from method SignalR.Restart. +type SignalRRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRRestartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRRestartResponse, error) { + respType := SignalRRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRRestartPollerResponse from the provided client and resume token. +func (l *SignalRRestartPollerResponse) Resume(ctx context.Context, client *SignalRClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &SignalRRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRRestartResponse contains the response from method SignalR.Restart. +type SignalRRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse contains the response from method SignalRSharedPrivateLinkResources.CreateOrUpdate. +type SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse, error) { + respType := SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SharedPrivateLinkResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *SignalRSharedPrivateLinkResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRSharedPrivateLinkResourcesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse contains the response from method SignalRSharedPrivateLinkResources.CreateOrUpdate. +type SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse struct { + SignalRSharedPrivateLinkResourcesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRSharedPrivateLinkResourcesCreateOrUpdateResult contains the result from method SignalRSharedPrivateLinkResources.CreateOrUpdate. +type SignalRSharedPrivateLinkResourcesCreateOrUpdateResult struct { + SharedPrivateLinkResource +} + +// SignalRSharedPrivateLinkResourcesDeletePollerResponse contains the response from method SignalRSharedPrivateLinkResources.Delete. +type SignalRSharedPrivateLinkResourcesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRSharedPrivateLinkResourcesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRSharedPrivateLinkResourcesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRSharedPrivateLinkResourcesDeleteResponse, error) { + respType := SignalRSharedPrivateLinkResourcesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRSharedPrivateLinkResourcesDeletePollerResponse from the provided client and resume token. +func (l *SignalRSharedPrivateLinkResourcesDeletePollerResponse) Resume(ctx context.Context, client *SignalRSharedPrivateLinkResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRSharedPrivateLinkResourcesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SignalRSharedPrivateLinkResourcesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRSharedPrivateLinkResourcesDeleteResponse contains the response from method SignalRSharedPrivateLinkResources.Delete. +type SignalRSharedPrivateLinkResourcesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRSharedPrivateLinkResourcesGetResponse contains the response from method SignalRSharedPrivateLinkResources.Get. +type SignalRSharedPrivateLinkResourcesGetResponse struct { + SignalRSharedPrivateLinkResourcesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRSharedPrivateLinkResourcesGetResult contains the result from method SignalRSharedPrivateLinkResources.Get. +type SignalRSharedPrivateLinkResourcesGetResult struct { + SharedPrivateLinkResource +} + +// SignalRSharedPrivateLinkResourcesListResponse contains the response from method SignalRSharedPrivateLinkResources.List. +type SignalRSharedPrivateLinkResourcesListResponse struct { + SignalRSharedPrivateLinkResourcesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRSharedPrivateLinkResourcesListResult contains the result from method SignalRSharedPrivateLinkResources.List. +type SignalRSharedPrivateLinkResourcesListResult struct { + SharedPrivateLinkResourceList +} + +// SignalRUpdatePollerResponse contains the response from method SignalR.Update. +type SignalRUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SignalRUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l SignalRUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SignalRUpdateResponse, error) { + respType := SignalRUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SignalRResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SignalRUpdatePollerResponse from the provided client and resume token. +func (l *SignalRUpdatePollerResponse) Resume(ctx context.Context, client *SignalRClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SignalRClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &SignalRUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SignalRUpdateResponse contains the response from method SignalR.Update. +type SignalRUpdateResponse struct { + SignalRUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SignalRUpdateResult contains the result from method SignalR.Update. +type SignalRUpdateResult struct { + SignalRResource +} + +// UsagesListResponse contains the response from method Usages.List. +type UsagesListResponse struct { + UsagesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UsagesListResult contains the result from method Usages.List. +type UsagesListResult struct { + SignalRUsageList +} diff --git a/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalr_client.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalr_client.go new file mode 100644 index 000000000000..d0d440a2e40f --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalr_client.go @@ -0,0 +1,791 @@ +//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 armsignalr + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SignalRClient contains the methods for the SignalR group. +// Don't use this type directly, use NewSignalRClient() instead. +type SignalRClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSignalRClient creates a new instance of SignalRClient with the specified values. +func NewSignalRClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SignalRClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SignalRClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// CheckNameAvailability - Checks that the resource name is valid and is not already in use. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityParameters, options *SignalRCheckNameAvailabilityOptions) (SignalRCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, location, parameters, options) + if err != nil { + return SignalRCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRCheckNameAvailabilityResponse{}, client.checkNameAvailabilityHandleError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *SignalRClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, parameters NameAvailabilityParameters, options *SignalRCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRClient) checkNameAvailabilityHandleResponse(resp *http.Response) (SignalRCheckNameAvailabilityResponse, error) { + result := SignalRCheckNameAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { + return SignalRCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// checkNameAvailabilityHandleError handles the CheckNameAvailability error response. +func (client *SignalRClient) 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 or update a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters SignalRResource, options *SignalRBeginCreateOrUpdateOptions) (SignalRCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SignalRCreateOrUpdatePollerResponse{}, err + } + result := SignalRCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return SignalRCreateOrUpdatePollerResponse{}, err + } + result.Poller = &SignalRCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters SignalRResource, options *SignalRBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, 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, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SignalRClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters SignalRResource, options *SignalRBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Operation to delete a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRBeginDeleteOptions) (SignalRDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SignalRDeletePollerResponse{}, err + } + result := SignalRDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return SignalRDeletePollerResponse{}, err + } + result.Poller = &SignalRDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Operation to delete a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, 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 *SignalRClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the resource and its properties. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRGetOptions) (SignalRGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SignalRGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SignalRClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SignalRClient) getHandleResponse(resp *http.Response) (SignalRGetResponse, error) { + result := SignalRGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignalRResource); err != nil { + return SignalRGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SignalRClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Handles requests to list all resources in a resource group. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) ListByResourceGroup(resourceGroupName string, options *SignalRListByResourceGroupOptions) *SignalRListByResourceGroupPager { + return &SignalRListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp SignalRListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SignalRResourceList.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SignalRClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SignalRListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SignalRClient) listByResourceGroupHandleResponse(resp *http.Response) (SignalRListByResourceGroupResponse, error) { + result := SignalRListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignalRResourceList); err != nil { + return SignalRListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *SignalRClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Handles requests to list all resources in a subscription. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) ListBySubscription(options *SignalRListBySubscriptionOptions) *SignalRListBySubscriptionPager { + return &SignalRListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp SignalRListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SignalRResourceList.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SignalRClient) listBySubscriptionCreateRequest(ctx context.Context, options *SignalRListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SignalRClient) listBySubscriptionHandleResponse(resp *http.Response) (SignalRListBySubscriptionResponse, error) { + result := SignalRListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignalRResourceList); err != nil { + return SignalRListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *SignalRClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListKeys - Get the access keys of the resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) ListKeys(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRListKeysOptions) (SignalRListKeysResponse, error) { + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SignalRListKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRListKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRListKeysResponse{}, client.listKeysHandleError(resp) + } + return client.listKeysHandleResponse(resp) +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *SignalRClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *SignalRClient) listKeysHandleResponse(resp *http.Response) (SignalRListKeysResponse, error) { + result := SignalRListKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignalRKeys); err != nil { + return SignalRListKeysResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listKeysHandleError handles the ListKeys error response. +func (client *SignalRClient) 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) +} + +// ListSKUs - List all available skus of the resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) ListSKUs(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRListSKUsOptions) (SignalRListSKUsResponse, error) { + req, err := client.listSKUsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SignalRListSKUsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRListSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRListSKUsResponse{}, client.listSKUsHandleError(resp) + } + return client.listSKUsHandleResponse(resp) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *SignalRClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listSKUsHandleResponse handles the ListSKUs response. +func (client *SignalRClient) listSKUsHandleResponse(resp *http.Response) (SignalRListSKUsResponse, error) { + result := SignalRListSKUsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return SignalRListSKUsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listSKUsHandleError handles the ListSKUs error response. +func (client *SignalRClient) listSKUsHandleError(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) +} + +// BeginRegenerateKey - Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) BeginRegenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *SignalRBeginRegenerateKeyOptions) (SignalRRegenerateKeyPollerResponse, error) { + resp, err := client.regenerateKey(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SignalRRegenerateKeyPollerResponse{}, err + } + result := SignalRRegenerateKeyPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRClient.RegenerateKey", "azure-async-operation", resp, client.pl, client.regenerateKeyHandleError) + if err != nil { + return SignalRRegenerateKeyPollerResponse{}, err + } + result.Poller = &SignalRRegenerateKeyPoller{ + pt: pt, + } + return result, nil +} + +// RegenerateKey - Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *SignalRBeginRegenerateKeyOptions) (*http.Response, error) { + req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, resourceName, 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.StatusAccepted) { + return nil, client.regenerateKeyHandleError(resp) + } + return resp, nil +} + +// regenerateKeyCreateRequest creates the RegenerateKey request. +func (client *SignalRClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *SignalRBeginRegenerateKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// regenerateKeyHandleError handles the RegenerateKey error response. +func (client *SignalRClient) regenerateKeyHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginRestart - Operation to restart a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRBeginRestartOptions) (SignalRRestartPollerResponse, error) { + resp, err := client.restart(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SignalRRestartPollerResponse{}, err + } + result := SignalRRestartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRClient.Restart", "azure-async-operation", resp, client.pl, client.restartHandleError) + if err != nil { + return SignalRRestartPollerResponse{}, err + } + result.Poller = &SignalRRestartPoller{ + pt: pt, + } + return result, nil +} + +// Restart - Operation to restart a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) restart(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.restartHandleError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *SignalRClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// restartHandleError handles the Restart error response. +func (client *SignalRClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Operation to update an exiting resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters SignalRResource, options *SignalRBeginUpdateOptions) (SignalRUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SignalRUpdatePollerResponse{}, err + } + result := SignalRUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return SignalRUpdatePollerResponse{}, err + } + result.Poller = &SignalRUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Operation to update an exiting resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRClient) update(ctx context.Context, resourceGroupName string, resourceName string, parameters SignalRResource, options *SignalRBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, 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.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SignalRClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters SignalRResource, options *SignalRBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleError handles the Update error response. +func (client *SignalRClient) 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/signalr/armsignalr/zz_generated_signalrprivateendpointconnections_client.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrprivateendpointconnections_client.go new file mode 100644 index 000000000000..1a798c923efd --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrprivateendpointconnections_client.go @@ -0,0 +1,323 @@ +//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 armsignalr + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SignalRPrivateEndpointConnectionsClient contains the methods for the SignalRPrivateEndpointConnections group. +// Don't use this type directly, use NewSignalRPrivateEndpointConnectionsClient() instead. +type SignalRPrivateEndpointConnectionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSignalRPrivateEndpointConnectionsClient creates a new instance of SignalRPrivateEndpointConnectionsClient with the specified values. +func NewSignalRPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SignalRPrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SignalRPrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginDelete - Delete the specified private endpoint connection +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRPrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsBeginDeleteOptions) (SignalRPrivateEndpointConnectionsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + if err != nil { + return SignalRPrivateEndpointConnectionsDeletePollerResponse{}, err + } + result := SignalRPrivateEndpointConnectionsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRPrivateEndpointConnectionsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return SignalRPrivateEndpointConnectionsDeletePollerResponse{}, err + } + result.Poller = &SignalRPrivateEndpointConnectionsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified private endpoint connection +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, 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 *SignalRPrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRPrivateEndpointConnectionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the specified private endpoint connection +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRPrivateEndpointConnectionsClient) Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsGetOptions) (SignalRPrivateEndpointConnectionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + if err != nil { + return SignalRPrivateEndpointConnectionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRPrivateEndpointConnectionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRPrivateEndpointConnectionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SignalRPrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SignalRPrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (SignalRPrivateEndpointConnectionsGetResponse, error) { + result := SignalRPrivateEndpointConnectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return SignalRPrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SignalRPrivateEndpointConnectionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - List private endpoint connections +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRPrivateEndpointConnectionsClient) List(resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsListOptions) *SignalRPrivateEndpointConnectionsListPager { + return &SignalRPrivateEndpointConnectionsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp SignalRPrivateEndpointConnectionsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *SignalRPrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRPrivateEndpointConnectionsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SignalRPrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (SignalRPrivateEndpointConnectionsListResponse, error) { + result := SignalRPrivateEndpointConnectionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionList); err != nil { + return SignalRPrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *SignalRPrivateEndpointConnectionsClient) 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) +} + +// Update - Update the state of specified private endpoint connection +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRPrivateEndpointConnectionsClient) Update(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *SignalRPrivateEndpointConnectionsUpdateOptions) (SignalRPrivateEndpointConnectionsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SignalRPrivateEndpointConnectionsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRPrivateEndpointConnectionsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRPrivateEndpointConnectionsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SignalRPrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *SignalRPrivateEndpointConnectionsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRPrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (SignalRPrivateEndpointConnectionsUpdateResponse, error) { + result := SignalRPrivateEndpointConnectionsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return SignalRPrivateEndpointConnectionsUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *SignalRPrivateEndpointConnectionsClient) 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/signalr/armsignalr/zz_generated_signalrprivatelinkresources_client.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrprivatelinkresources_client.go new file mode 100644 index 000000000000..601b009a557d --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrprivatelinkresources_client.go @@ -0,0 +1,105 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsignalr + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SignalRPrivateLinkResourcesClient contains the methods for the SignalRPrivateLinkResources group. +// Don't use this type directly, use NewSignalRPrivateLinkResourcesClient() instead. +type SignalRPrivateLinkResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSignalRPrivateLinkResourcesClient creates a new instance of SignalRPrivateLinkResourcesClient with the specified values. +func NewSignalRPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SignalRPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SignalRPrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Get the private link resources that need to be created for a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRPrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *SignalRPrivateLinkResourcesListOptions) *SignalRPrivateLinkResourcesListPager { + return &SignalRPrivateLinkResourcesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp SignalRPrivateLinkResourcesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkResourceList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *SignalRPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRPrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SignalRPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (SignalRPrivateLinkResourcesListResponse, error) { + result := SignalRPrivateLinkResourcesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceList); err != nil { + return SignalRPrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *SignalRPrivateLinkResourcesClient) 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/signalr/armsignalr/zz_generated_signalrsharedprivatelinkresources_client.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrsharedprivatelinkresources_client.go new file mode 100644 index 000000000000..43ccac21b62d --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_signalrsharedprivatelinkresources_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsignalr + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SignalRSharedPrivateLinkResourcesClient contains the methods for the SignalRSharedPrivateLinkResources group. +// Don't use this type directly, use NewSignalRSharedPrivateLinkResourcesClient() instead. +type SignalRSharedPrivateLinkResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSignalRSharedPrivateLinkResourcesClient creates a new instance of SignalRSharedPrivateLinkResourcesClient with the specified values. +func NewSignalRSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SignalRSharedPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SignalRSharedPrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update a shared private link resource +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRSharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SignalRSharedPrivateLinkResourcesBeginCreateOrUpdateOptions) (SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse{}, err + } + result := SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRSharedPrivateLinkResourcesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return SignalRSharedPrivateLinkResourcesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &SignalRSharedPrivateLinkResourcesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update a shared private link resource +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRSharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SignalRSharedPrivateLinkResourcesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, 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 *SignalRSharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SignalRSharedPrivateLinkResourcesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRSharedPrivateLinkResourcesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Delete the specified shared private link resource +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRSharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesBeginDeleteOptions) (SignalRSharedPrivateLinkResourcesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + if err != nil { + return SignalRSharedPrivateLinkResourcesDeletePollerResponse{}, err + } + result := SignalRSharedPrivateLinkResourcesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SignalRSharedPrivateLinkResourcesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return SignalRSharedPrivateLinkResourcesDeletePollerResponse{}, err + } + result.Poller = &SignalRSharedPrivateLinkResourcesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified shared private link resource +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRSharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, 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 *SignalRSharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-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 *SignalRSharedPrivateLinkResourcesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the specified shared private link resource +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRSharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesGetOptions) (SignalRSharedPrivateLinkResourcesGetResponse, error) { + req, err := client.getCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + if err != nil { + return SignalRSharedPrivateLinkResourcesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SignalRSharedPrivateLinkResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SignalRSharedPrivateLinkResourcesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SignalRSharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SignalRSharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (SignalRSharedPrivateLinkResourcesGetResponse, error) { + result := SignalRSharedPrivateLinkResourcesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { + return SignalRSharedPrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SignalRSharedPrivateLinkResourcesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - List shared private link resources +// If the operation fails it returns the *ErrorResponse error type. +func (client *SignalRSharedPrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesListOptions) *SignalRSharedPrivateLinkResourcesListPager { + return &SignalRSharedPrivateLinkResourcesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp SignalRSharedPrivateLinkResourcesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SharedPrivateLinkResourceList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *SignalRSharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SignalRSharedPrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SignalRSharedPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (SignalRSharedPrivateLinkResourcesListResponse, error) { + result := SignalRSharedPrivateLinkResourcesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceList); err != nil { + return SignalRSharedPrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *SignalRSharedPrivateLinkResourcesClient) 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/signalr/armsignalr/zz_generated_time_rfc3339.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..37e34933d75d --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsignalr + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/signalr/armsignalr/zz_generated_usages_client.go b/sdk/resourcemanager/signalr/armsignalr/zz_generated_usages_client.go new file mode 100644 index 000000000000..2ea7d3920d59 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/zz_generated_usages_client.go @@ -0,0 +1,101 @@ +//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 armsignalr + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsagesClient contains the methods for the Usages group. +// Don't use this type directly, use NewUsagesClient() instead. +type UsagesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewUsagesClient creates a new instance of UsagesClient with the specified values. +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - List resource usage quotas by location. +// If the operation fails it returns the *ErrorResponse error type. +func (client *UsagesClient) List(location string, options *UsagesListOptions) *UsagesListPager { + return &UsagesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, + advancer: func(ctx context.Context, resp UsagesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SignalRUsageList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *UsagesClient) listCreateRequest(ctx context.Context, location string, options *UsagesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesListResponse, error) { + result := UsagesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignalRUsageList); err != nil { + return UsagesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *UsagesClient) 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) +}