diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md new file mode 100644 index 000000000000..17b9dceace74 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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/webpubsub/armwebpubsub/LICENSE.txt b/sdk/resourcemanager/webpubsub/armwebpubsub/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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/webpubsub/armwebpubsub/README.md b/sdk/resourcemanager/webpubsub/armwebpubsub/README.md new file mode 100644 index 000000000000..4d63953736ad --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/README.md @@ -0,0 +1,75 @@ +# Azure Webpubsub Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub) + +The `armwebpubsub` module provides operations for working with Azure Webpubsub. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/webpubsub/armwebpubsub) + +# 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 Webpubsub module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Webpubsub. 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 Webpubsub 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 := armwebpubsub.NewWebPubSubSharedPrivateLinkResourcesClient(, 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 := armwebpubsub.NewWebPubSubSharedPrivateLinkResourcesClient(, 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 `Webpubsub` 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/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md new file mode 100644 index 000000000000..26944c342e33 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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/webpubsub/resource-manager/readme.md +- /home/vsts/work/1/s/azure-rest-api-specs/specification/webpubsub/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/webpubsub/armwebpubsub/build.go b/sdk/resourcemanager/webpubsub/armwebpubsub/build.go new file mode 100644 index 000000000000..65d71960560f --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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/webpubsub/armwebpubsub + +package armwebpubsub diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ci.yml b/sdk/resourcemanager/webpubsub/armwebpubsub/ci.yml new file mode 100644 index 000000000000..cb148f909338 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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/webpubsub/armwebpubsub/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/webpubsub/armwebpubsub/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/webpubsub/armwebpubsub' diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod new file mode 100644 index 000000000000..e8e6ebd76c5b --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub + +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/webpubsub/armwebpubsub/go.sum b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum new file mode 100644 index 000000000000..960c6c966a3f --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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/webpubsub/armwebpubsub/go_mod_tidy_hack.go b/sdk/resourcemanager/webpubsub/armwebpubsub/go_mod_tidy_hack.go new file mode 100644 index 000000000000..9ca5d0365fc7 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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 armwebpubsub + +// 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/webpubsub/armwebpubsub/zz_generated_constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_constants.go new file mode 100644 index 000000000000..0f45e8474df6 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_constants.go @@ -0,0 +1,288 @@ +//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 armwebpubsub + +const ( + module = "armwebpubsub" + 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// WebPubSubRequestType - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. +type WebPubSubRequestType string + +const ( + WebPubSubRequestTypeClientConnection WebPubSubRequestType = "ClientConnection" + WebPubSubRequestTypeRESTAPI WebPubSubRequestType = "RESTAPI" + WebPubSubRequestTypeServerConnection WebPubSubRequestType = "ServerConnection" + WebPubSubRequestTypeTrace WebPubSubRequestType = "Trace" +) + +// PossibleWebPubSubRequestTypeValues returns the possible values for the WebPubSubRequestType const type. +func PossibleWebPubSubRequestTypeValues() []WebPubSubRequestType { + return []WebPubSubRequestType{ + WebPubSubRequestTypeClientConnection, + WebPubSubRequestTypeRESTAPI, + WebPubSubRequestTypeServerConnection, + WebPubSubRequestTypeTrace, + } +} + +// ToPtr returns a *WebPubSubRequestType pointing to the current value. +func (c WebPubSubRequestType) ToPtr() *WebPubSubRequestType { + return &c +} + +// WebPubSubSKUTier - Optional tier of this particular SKU. 'Standard' or 'Free'. +// Basic is deprecated, use Standard instead. +type WebPubSubSKUTier string + +const ( + WebPubSubSKUTierBasic WebPubSubSKUTier = "Basic" + WebPubSubSKUTierFree WebPubSubSKUTier = "Free" + WebPubSubSKUTierPremium WebPubSubSKUTier = "Premium" + WebPubSubSKUTierStandard WebPubSubSKUTier = "Standard" +) + +// PossibleWebPubSubSKUTierValues returns the possible values for the WebPubSubSKUTier const type. +func PossibleWebPubSubSKUTierValues() []WebPubSubSKUTier { + return []WebPubSubSKUTier{ + WebPubSubSKUTierBasic, + WebPubSubSKUTierFree, + WebPubSubSKUTierPremium, + WebPubSubSKUTierStandard, + } +} + +// ToPtr returns a *WebPubSubSKUTier pointing to the current value. +func (c WebPubSubSKUTier) ToPtr() *WebPubSubSKUTier { + return &c +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go new file mode 100644 index 000000000000..c25a27e8b3e2 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go @@ -0,0 +1,1225 @@ +//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 armwebpubsub + +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 +} + +// EventHandler - Properties of event handler. +type EventHandler struct { + // REQUIRED; Gets or sets the EventHandler URL template. You can use a predefined parameter {hub} and {event} inside the template, the value of the EventHandler + // URL is dynamically calculated when the client + // request comes in. For example, UrlTemplate can be http://example.com/api/{hub}/{event}. The host part can't contains parameters. + URLTemplate *string `json:"urlTemplate,omitempty"` + + // Gets or sets the auth settings for an event handler. If not set, no auth is used. + Auth *UpstreamAuthSettings `json:"auth,omitempty"` + + // Gets ot sets the list of system events. + SystemEvents []*string `json:"systemEvents,omitempty"` + + // Gets or sets the matching pattern for event names. There are 3 kind of patterns supported: 1. "*", it to matches any event name 2. Combine multiple events + // with ",", for example "event1,event2", it + // matches event "event1" and "event2" 3. The single event name, for example, "event1", it matches "event1" + UserEventPattern *string `json:"userEventPattern,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHandler. +func (e EventHandler) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", e.Auth) + populate(objectMap, "systemEvents", e.SystemEvents) + populate(objectMap, "urlTemplate", e.URLTemplate) + populate(objectMap, "userEventPattern", e.UserEventPattern) + return json.Marshal(objectMap) +} + +// LiveTraceCategory - Live trace category configuration of a Microsoft.SignalRService resource. +type LiveTraceCategory struct { + // Indicates whether or the live trace category is enabled. Available values: true, false. Case insensitive. + Enabled *string `json:"enabled,omitempty"` + + // Gets or sets the live trace category's name. Available values: ConnectivityLogs, MessagingLogs. Case insensitive. + Name *string `json:"name,omitempty"` +} + +// LiveTraceConfiguration - Live trace configuration of a Microsoft.SignalRService resource. +type LiveTraceConfiguration struct { + // Gets or sets the list of category configurations. + Categories []*LiveTraceCategory `json:"categories,omitempty"` + + // Indicates whether or not enable live trace. When it's set to true, live trace client can connect to the service. Otherwise, live trace client can't connect + // to the service, so that you are unable to + // receive any log, no matter what you configure in "categories". Available values: true, false. Case insensitive. + Enabled *string `json:"enabled,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveTraceConfiguration. +func (l LiveTraceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "categories", l.Categories) + populate(objectMap, "enabled", l.Enabled) + return json.Marshal(objectMap) +} + +// 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 []*WebPubSubRequestType `json:"allow,omitempty"` + + // Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Deny []*WebPubSubRequestType `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 *WebPubSubSKUTier `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) +} + +// 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"` +} + +// SignalRServiceUsage - Object that describes a specific usage of the resources. +type SignalRServiceUsage 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 *SignalRServiceUsageName `json:"name,omitempty"` + + // Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + Unit *string `json:"unit,omitempty"` +} + +// SignalRServiceUsageList - Object that includes an array of the resource usages and a possible link for next set. +type SignalRServiceUsageList 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 []*SignalRServiceUsage `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRServiceUsageList. +func (s SignalRServiceUsageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SignalRServiceUsageName - Localizable String object containing the name and a localized value. +type SignalRServiceUsageName 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"` +} + +// 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"` +} + +// WebPubSubBeginCreateOrUpdateOptions contains the optional parameters for the WebPubSub.BeginCreateOrUpdate method. +type WebPubSubBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubBeginDeleteOptions contains the optional parameters for the WebPubSub.BeginDelete method. +type WebPubSubBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubBeginRegenerateKeyOptions contains the optional parameters for the WebPubSub.BeginRegenerateKey method. +type WebPubSubBeginRegenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubBeginRestartOptions contains the optional parameters for the WebPubSub.BeginRestart method. +type WebPubSubBeginRestartOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubBeginUpdateOptions contains the optional parameters for the WebPubSub.BeginUpdate method. +type WebPubSubBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubCheckNameAvailabilityOptions contains the optional parameters for the WebPubSub.CheckNameAvailability method. +type WebPubSubCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubGetOptions contains the optional parameters for the WebPubSub.Get method. +type WebPubSubGetOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubHub - A hub setting +type WebPubSubHub struct { + ProxyResource + // REQUIRED; Properties of the hub setting. + Properties *WebPubSubHubProperties `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 WebPubSubHub. +func (w WebPubSubHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + w.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + return json.Marshal(objectMap) +} + +// WebPubSubHubList - Hub setting list +type WebPubSubHubList struct { + // List of hub settings to this resource. + Value []*WebPubSubHub `json:"value,omitempty"` + + // 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"` +} + +// MarshalJSON implements the json.Marshaller interface for type WebPubSubHubList. +func (w WebPubSubHubList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// WebPubSubHubProperties - Properties of a hub. +type WebPubSubHubProperties struct { + // The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". + AnonymousConnectPolicy *string `json:"anonymousConnectPolicy,omitempty"` + + // Event handler of a hub. + EventHandlers []*EventHandler `json:"eventHandlers,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type WebPubSubHubProperties. +func (w WebPubSubHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "anonymousConnectPolicy", w.AnonymousConnectPolicy) + populate(objectMap, "eventHandlers", w.EventHandlers) + return json.Marshal(objectMap) +} + +// WebPubSubHubsBeginCreateOrUpdateOptions contains the optional parameters for the WebPubSubHubs.BeginCreateOrUpdate method. +type WebPubSubHubsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubHubsBeginDeleteOptions contains the optional parameters for the WebPubSubHubs.BeginDelete method. +type WebPubSubHubsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubHubsGetOptions contains the optional parameters for the WebPubSubHubs.Get method. +type WebPubSubHubsGetOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubHubsListOptions contains the optional parameters for the WebPubSubHubs.List method. +type WebPubSubHubsListOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubKeys - A class represents the access keys of the resource. +type WebPubSubKeys 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"` +} + +// WebPubSubListByResourceGroupOptions contains the optional parameters for the WebPubSub.ListByResourceGroup method. +type WebPubSubListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubListBySubscriptionOptions contains the optional parameters for the WebPubSub.ListBySubscription method. +type WebPubSubListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubListKeysOptions contains the optional parameters for the WebPubSub.ListKeys method. +type WebPubSubListKeysOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubListSKUsOptions contains the optional parameters for the WebPubSub.ListSKUs method. +type WebPubSubListSKUsOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubNetworkACLs - Network ACLs for the resource +type WebPubSubNetworkACLs 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 WebPubSubNetworkACLs. +func (w WebPubSubNetworkACLs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", w.DefaultAction) + populate(objectMap, "privateEndpoints", w.PrivateEndpoints) + populate(objectMap, "publicNetwork", w.PublicNetwork) + return json.Marshal(objectMap) +} + +// WebPubSubPrivateEndpointConnectionsBeginDeleteOptions contains the optional parameters for the WebPubSubPrivateEndpointConnections.BeginDelete method. +type WebPubSubPrivateEndpointConnectionsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubPrivateEndpointConnectionsGetOptions contains the optional parameters for the WebPubSubPrivateEndpointConnections.Get method. +type WebPubSubPrivateEndpointConnectionsGetOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubPrivateEndpointConnectionsListOptions contains the optional parameters for the WebPubSubPrivateEndpointConnections.List method. +type WebPubSubPrivateEndpointConnectionsListOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubPrivateEndpointConnectionsUpdateOptions contains the optional parameters for the WebPubSubPrivateEndpointConnections.Update method. +type WebPubSubPrivateEndpointConnectionsUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubPrivateLinkResourcesListOptions contains the optional parameters for the WebPubSubPrivateLinkResources.List method. +type WebPubSubPrivateLinkResourcesListOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubProperties - A class that describes the properties of the resource +type WebPubSubProperties struct { + // 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"` + + // Live trace configuration of a Microsoft.SignalRService resource. + LiveTraceConfiguration *LiveTraceConfiguration `json:"liveTraceConfiguration,omitempty"` + + // Network ACLs + NetworkACLs *WebPubSubNetworkACLs `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 *WebPubSubTLSSettings `json:"tls,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 WebPubSubProperties. +func (w WebPubSubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableAadAuth", w.DisableAADAuth) + populate(objectMap, "disableLocalAuth", w.DisableLocalAuth) + populate(objectMap, "externalIP", w.ExternalIP) + populate(objectMap, "hostName", w.HostName) + populate(objectMap, "hostNamePrefix", w.HostNamePrefix) + populate(objectMap, "liveTraceConfiguration", w.LiveTraceConfiguration) + populate(objectMap, "networkACLs", w.NetworkACLs) + populate(objectMap, "privateEndpointConnections", w.PrivateEndpointConnections) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "publicNetworkAccess", w.PublicNetworkAccess) + populate(objectMap, "publicPort", w.PublicPort) + populate(objectMap, "resourceLogConfiguration", w.ResourceLogConfiguration) + populate(objectMap, "serverPort", w.ServerPort) + populate(objectMap, "sharedPrivateLinkResources", w.SharedPrivateLinkResources) + populate(objectMap, "tls", w.TLS) + populate(objectMap, "version", w.Version) + return json.Marshal(objectMap) +} + +// WebPubSubResource - A class represent a resource. +type WebPubSubResource struct { + TrackedResource + // The managed identity response + Identity *ManagedIdentity `json:"identity,omitempty"` + + // Settings used to provision or configure the resource + Properties *WebPubSubProperties `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 WebPubSubResource. +func (w WebPubSubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + w.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "sku", w.SKU) + populate(objectMap, "systemData", w.SystemData) + return json.Marshal(objectMap) +} + +// WebPubSubResourceList - Object that includes an array of resources and a possible link for next set. +type WebPubSubResourceList 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 []*WebPubSubResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type WebPubSubResourceList. +func (w WebPubSubResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// WebPubSubSharedPrivateLinkResourcesBeginCreateOrUpdateOptions contains the optional parameters for the WebPubSubSharedPrivateLinkResources.BeginCreateOrUpdate +// method. +type WebPubSubSharedPrivateLinkResourcesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubSharedPrivateLinkResourcesBeginDeleteOptions contains the optional parameters for the WebPubSubSharedPrivateLinkResources.BeginDelete method. +type WebPubSubSharedPrivateLinkResourcesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubSharedPrivateLinkResourcesGetOptions contains the optional parameters for the WebPubSubSharedPrivateLinkResources.Get method. +type WebPubSubSharedPrivateLinkResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubSharedPrivateLinkResourcesListOptions contains the optional parameters for the WebPubSubSharedPrivateLinkResources.List method. +type WebPubSubSharedPrivateLinkResourcesListOptions struct { + // placeholder for future optional parameters +} + +// WebPubSubTLSSettings - TLS settings for the resource +type WebPubSubTLSSettings struct { + // Request client certificate during TLS handshake if enabled + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_operations_client.go new file mode 100644 index 000000000000..998ecf91148e --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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 armwebpubsub + +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/webpubsub/armwebpubsub/zz_generated_pagers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pagers.go new file mode 100644 index 000000000000..60401e2fe108 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pagers.go @@ -0,0 +1,449 @@ +//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 armwebpubsub + +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 +} + +// 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.SignalRServiceUsageList.NextLink == nil || len(*p.current.SignalRServiceUsageList.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 +} + +// WebPubSubHubsListPager provides operations for iterating over paged responses. +type WebPubSubHubsListPager struct { + client *WebPubSubHubsClient + current WebPubSubHubsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WebPubSubHubsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WebPubSubHubsListPager) 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 *WebPubSubHubsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.WebPubSubHubList.NextLink == nil || len(*p.current.WebPubSubHubList.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 WebPubSubHubsListResponse page. +func (p *WebPubSubHubsListPager) PageResponse() WebPubSubHubsListResponse { + return p.current +} + +// WebPubSubListByResourceGroupPager provides operations for iterating over paged responses. +type WebPubSubListByResourceGroupPager struct { + client *WebPubSubClient + current WebPubSubListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WebPubSubListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WebPubSubListByResourceGroupPager) 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 *WebPubSubListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.WebPubSubResourceList.NextLink == nil || len(*p.current.WebPubSubResourceList.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 WebPubSubListByResourceGroupResponse page. +func (p *WebPubSubListByResourceGroupPager) PageResponse() WebPubSubListByResourceGroupResponse { + return p.current +} + +// WebPubSubListBySubscriptionPager provides operations for iterating over paged responses. +type WebPubSubListBySubscriptionPager struct { + client *WebPubSubClient + current WebPubSubListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WebPubSubListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WebPubSubListBySubscriptionPager) 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 *WebPubSubListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.WebPubSubResourceList.NextLink == nil || len(*p.current.WebPubSubResourceList.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 WebPubSubListBySubscriptionResponse page. +func (p *WebPubSubListBySubscriptionPager) PageResponse() WebPubSubListBySubscriptionResponse { + return p.current +} + +// WebPubSubPrivateEndpointConnectionsListPager provides operations for iterating over paged responses. +type WebPubSubPrivateEndpointConnectionsListPager struct { + client *WebPubSubPrivateEndpointConnectionsClient + current WebPubSubPrivateEndpointConnectionsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WebPubSubPrivateEndpointConnectionsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WebPubSubPrivateEndpointConnectionsListPager) 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 *WebPubSubPrivateEndpointConnectionsListPager) 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 WebPubSubPrivateEndpointConnectionsListResponse page. +func (p *WebPubSubPrivateEndpointConnectionsListPager) PageResponse() WebPubSubPrivateEndpointConnectionsListResponse { + return p.current +} + +// WebPubSubPrivateLinkResourcesListPager provides operations for iterating over paged responses. +type WebPubSubPrivateLinkResourcesListPager struct { + client *WebPubSubPrivateLinkResourcesClient + current WebPubSubPrivateLinkResourcesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WebPubSubPrivateLinkResourcesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WebPubSubPrivateLinkResourcesListPager) 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 *WebPubSubPrivateLinkResourcesListPager) 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 WebPubSubPrivateLinkResourcesListResponse page. +func (p *WebPubSubPrivateLinkResourcesListPager) PageResponse() WebPubSubPrivateLinkResourcesListResponse { + return p.current +} + +// WebPubSubSharedPrivateLinkResourcesListPager provides operations for iterating over paged responses. +type WebPubSubSharedPrivateLinkResourcesListPager struct { + client *WebPubSubSharedPrivateLinkResourcesClient + current WebPubSubSharedPrivateLinkResourcesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WebPubSubSharedPrivateLinkResourcesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WebPubSubSharedPrivateLinkResourcesListPager) 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 *WebPubSubSharedPrivateLinkResourcesListPager) 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 WebPubSubSharedPrivateLinkResourcesListResponse page. +func (p *WebPubSubSharedPrivateLinkResourcesListPager) PageResponse() WebPubSubSharedPrivateLinkResourcesListResponse { + return p.current +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pollers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pollers.go new file mode 100644 index 000000000000..5ff115285b5f --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pollers.go @@ -0,0 +1,445 @@ +//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 armwebpubsub + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// WebPubSubCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubCreateOrUpdatePoller) 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 *WebPubSubCreateOrUpdatePoller) 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 WebPubSubCreateOrUpdateResponse will be returned. +func (p *WebPubSubCreateOrUpdatePoller) FinalResponse(ctx context.Context) (WebPubSubCreateOrUpdateResponse, error) { + respType := WebPubSubCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.WebPubSubResource) + if err != nil { + return WebPubSubCreateOrUpdateResponse{}, 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 *WebPubSubCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubDeletePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubDeletePoller) 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 *WebPubSubDeletePoller) 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 WebPubSubDeleteResponse will be returned. +func (p *WebPubSubDeletePoller) FinalResponse(ctx context.Context) (WebPubSubDeleteResponse, error) { + respType := WebPubSubDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return WebPubSubDeleteResponse{}, 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 *WebPubSubDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubHubsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubHubsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubHubsCreateOrUpdatePoller) 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 *WebPubSubHubsCreateOrUpdatePoller) 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 WebPubSubHubsCreateOrUpdateResponse will be returned. +func (p *WebPubSubHubsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (WebPubSubHubsCreateOrUpdateResponse, error) { + respType := WebPubSubHubsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.WebPubSubHub) + if err != nil { + return WebPubSubHubsCreateOrUpdateResponse{}, 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 *WebPubSubHubsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubHubsDeletePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubHubsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubHubsDeletePoller) 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 *WebPubSubHubsDeletePoller) 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 WebPubSubHubsDeleteResponse will be returned. +func (p *WebPubSubHubsDeletePoller) FinalResponse(ctx context.Context) (WebPubSubHubsDeleteResponse, error) { + respType := WebPubSubHubsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return WebPubSubHubsDeleteResponse{}, 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 *WebPubSubHubsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubPrivateEndpointConnectionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubPrivateEndpointConnectionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubPrivateEndpointConnectionsDeletePoller) 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 *WebPubSubPrivateEndpointConnectionsDeletePoller) 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 WebPubSubPrivateEndpointConnectionsDeleteResponse will be returned. +func (p *WebPubSubPrivateEndpointConnectionsDeletePoller) FinalResponse(ctx context.Context) (WebPubSubPrivateEndpointConnectionsDeleteResponse, error) { + respType := WebPubSubPrivateEndpointConnectionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return WebPubSubPrivateEndpointConnectionsDeleteResponse{}, 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 *WebPubSubPrivateEndpointConnectionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubRegenerateKeyPoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubRegenerateKeyPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubRegenerateKeyPoller) 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 *WebPubSubRegenerateKeyPoller) 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 WebPubSubRegenerateKeyResponse will be returned. +func (p *WebPubSubRegenerateKeyPoller) FinalResponse(ctx context.Context) (WebPubSubRegenerateKeyResponse, error) { + respType := WebPubSubRegenerateKeyResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.WebPubSubKeys) + if err != nil { + return WebPubSubRegenerateKeyResponse{}, 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 *WebPubSubRegenerateKeyPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubRestartPoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubRestartPoller) 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 *WebPubSubRestartPoller) 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 WebPubSubRestartResponse will be returned. +func (p *WebPubSubRestartPoller) FinalResponse(ctx context.Context) (WebPubSubRestartResponse, error) { + respType := WebPubSubRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return WebPubSubRestartResponse{}, 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 *WebPubSubRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller) 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 *WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller) 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 WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse will be returned. +func (p *WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse, error) { + respType := WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SharedPrivateLinkResource) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse{}, 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 *WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubSharedPrivateLinkResourcesDeletePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubSharedPrivateLinkResourcesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubSharedPrivateLinkResourcesDeletePoller) 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 *WebPubSubSharedPrivateLinkResourcesDeletePoller) 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 WebPubSubSharedPrivateLinkResourcesDeleteResponse will be returned. +func (p *WebPubSubSharedPrivateLinkResourcesDeletePoller) FinalResponse(ctx context.Context) (WebPubSubSharedPrivateLinkResourcesDeleteResponse, error) { + respType := WebPubSubSharedPrivateLinkResourcesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesDeleteResponse{}, 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 *WebPubSubSharedPrivateLinkResourcesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WebPubSubUpdatePoller provides polling facilities until the operation reaches a terminal state. +type WebPubSubUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WebPubSubUpdatePoller) 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 *WebPubSubUpdatePoller) 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 WebPubSubUpdateResponse will be returned. +func (p *WebPubSubUpdatePoller) FinalResponse(ctx context.Context) (WebPubSubUpdateResponse, error) { + respType := WebPubSubUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.WebPubSubResource) + if err != nil { + return WebPubSubUpdateResponse{}, 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 *WebPubSubUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go new file mode 100644 index 000000000000..5f143eb5d4c3 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go @@ -0,0 +1,698 @@ +//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 armwebpubsub + +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 +} + +// 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 { + SignalRServiceUsageList +} + +// WebPubSubCheckNameAvailabilityResponse contains the response from method WebPubSub.CheckNameAvailability. +type WebPubSubCheckNameAvailabilityResponse struct { + WebPubSubCheckNameAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubCheckNameAvailabilityResult contains the result from method WebPubSub.CheckNameAvailability. +type WebPubSubCheckNameAvailabilityResult struct { + NameAvailability +} + +// WebPubSubCreateOrUpdatePollerResponse contains the response from method WebPubSub.CreateOrUpdate. +type WebPubSubCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubCreateOrUpdatePoller + + // 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 WebPubSubCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubCreateOrUpdateResponse, error) { + respType := WebPubSubCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WebPubSubResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *WebPubSubCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WebPubSubClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &WebPubSubCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubCreateOrUpdateResponse contains the response from method WebPubSub.CreateOrUpdate. +type WebPubSubCreateOrUpdateResponse struct { + WebPubSubCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubCreateOrUpdateResult contains the result from method WebPubSub.CreateOrUpdate. +type WebPubSubCreateOrUpdateResult struct { + WebPubSubResource +} + +// WebPubSubDeletePollerResponse contains the response from method WebPubSub.Delete. +type WebPubSubDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubDeletePoller + + // 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 WebPubSubDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubDeleteResponse, error) { + respType := WebPubSubDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubDeletePollerResponse from the provided client and resume token. +func (l *WebPubSubDeletePollerResponse) Resume(ctx context.Context, client *WebPubSubClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &WebPubSubDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubDeleteResponse contains the response from method WebPubSub.Delete. +type WebPubSubDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubGetResponse contains the response from method WebPubSub.Get. +type WebPubSubGetResponse struct { + WebPubSubGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubGetResult contains the result from method WebPubSub.Get. +type WebPubSubGetResult struct { + WebPubSubResource +} + +// WebPubSubHubsCreateOrUpdatePollerResponse contains the response from method WebPubSubHubs.CreateOrUpdate. +type WebPubSubHubsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubHubsCreateOrUpdatePoller + + // 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 WebPubSubHubsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubHubsCreateOrUpdateResponse, error) { + respType := WebPubSubHubsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WebPubSubHub) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubHubsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *WebPubSubHubsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WebPubSubHubsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubHubsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &WebPubSubHubsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubHubsCreateOrUpdateResponse contains the response from method WebPubSubHubs.CreateOrUpdate. +type WebPubSubHubsCreateOrUpdateResponse struct { + WebPubSubHubsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubHubsCreateOrUpdateResult contains the result from method WebPubSubHubs.CreateOrUpdate. +type WebPubSubHubsCreateOrUpdateResult struct { + WebPubSubHub +} + +// WebPubSubHubsDeletePollerResponse contains the response from method WebPubSubHubs.Delete. +type WebPubSubHubsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubHubsDeletePoller + + // 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 WebPubSubHubsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubHubsDeleteResponse, error) { + respType := WebPubSubHubsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubHubsDeletePollerResponse from the provided client and resume token. +func (l *WebPubSubHubsDeletePollerResponse) Resume(ctx context.Context, client *WebPubSubHubsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubHubsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &WebPubSubHubsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubHubsDeleteResponse contains the response from method WebPubSubHubs.Delete. +type WebPubSubHubsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubHubsGetResponse contains the response from method WebPubSubHubs.Get. +type WebPubSubHubsGetResponse struct { + WebPubSubHubsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubHubsGetResult contains the result from method WebPubSubHubs.Get. +type WebPubSubHubsGetResult struct { + WebPubSubHub +} + +// WebPubSubHubsListResponse contains the response from method WebPubSubHubs.List. +type WebPubSubHubsListResponse struct { + WebPubSubHubsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubHubsListResult contains the result from method WebPubSubHubs.List. +type WebPubSubHubsListResult struct { + WebPubSubHubList +} + +// WebPubSubListByResourceGroupResponse contains the response from method WebPubSub.ListByResourceGroup. +type WebPubSubListByResourceGroupResponse struct { + WebPubSubListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubListByResourceGroupResult contains the result from method WebPubSub.ListByResourceGroup. +type WebPubSubListByResourceGroupResult struct { + WebPubSubResourceList +} + +// WebPubSubListBySubscriptionResponse contains the response from method WebPubSub.ListBySubscription. +type WebPubSubListBySubscriptionResponse struct { + WebPubSubListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubListBySubscriptionResult contains the result from method WebPubSub.ListBySubscription. +type WebPubSubListBySubscriptionResult struct { + WebPubSubResourceList +} + +// WebPubSubListKeysResponse contains the response from method WebPubSub.ListKeys. +type WebPubSubListKeysResponse struct { + WebPubSubListKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubListKeysResult contains the result from method WebPubSub.ListKeys. +type WebPubSubListKeysResult struct { + WebPubSubKeys +} + +// WebPubSubListSKUsResponse contains the response from method WebPubSub.ListSKUs. +type WebPubSubListSKUsResponse struct { + WebPubSubListSKUsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubListSKUsResult contains the result from method WebPubSub.ListSKUs. +type WebPubSubListSKUsResult struct { + SKUList +} + +// WebPubSubPrivateEndpointConnectionsDeletePollerResponse contains the response from method WebPubSubPrivateEndpointConnections.Delete. +type WebPubSubPrivateEndpointConnectionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubPrivateEndpointConnectionsDeletePoller + + // 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 WebPubSubPrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubPrivateEndpointConnectionsDeleteResponse, error) { + respType := WebPubSubPrivateEndpointConnectionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubPrivateEndpointConnectionsDeletePollerResponse from the provided client and resume token. +func (l *WebPubSubPrivateEndpointConnectionsDeletePollerResponse) Resume(ctx context.Context, client *WebPubSubPrivateEndpointConnectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubPrivateEndpointConnectionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &WebPubSubPrivateEndpointConnectionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubPrivateEndpointConnectionsDeleteResponse contains the response from method WebPubSubPrivateEndpointConnections.Delete. +type WebPubSubPrivateEndpointConnectionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubPrivateEndpointConnectionsGetResponse contains the response from method WebPubSubPrivateEndpointConnections.Get. +type WebPubSubPrivateEndpointConnectionsGetResponse struct { + WebPubSubPrivateEndpointConnectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubPrivateEndpointConnectionsGetResult contains the result from method WebPubSubPrivateEndpointConnections.Get. +type WebPubSubPrivateEndpointConnectionsGetResult struct { + PrivateEndpointConnection +} + +// WebPubSubPrivateEndpointConnectionsListResponse contains the response from method WebPubSubPrivateEndpointConnections.List. +type WebPubSubPrivateEndpointConnectionsListResponse struct { + WebPubSubPrivateEndpointConnectionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubPrivateEndpointConnectionsListResult contains the result from method WebPubSubPrivateEndpointConnections.List. +type WebPubSubPrivateEndpointConnectionsListResult struct { + PrivateEndpointConnectionList +} + +// WebPubSubPrivateEndpointConnectionsUpdateResponse contains the response from method WebPubSubPrivateEndpointConnections.Update. +type WebPubSubPrivateEndpointConnectionsUpdateResponse struct { + WebPubSubPrivateEndpointConnectionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubPrivateEndpointConnectionsUpdateResult contains the result from method WebPubSubPrivateEndpointConnections.Update. +type WebPubSubPrivateEndpointConnectionsUpdateResult struct { + PrivateEndpointConnection +} + +// WebPubSubPrivateLinkResourcesListResponse contains the response from method WebPubSubPrivateLinkResources.List. +type WebPubSubPrivateLinkResourcesListResponse struct { + WebPubSubPrivateLinkResourcesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubPrivateLinkResourcesListResult contains the result from method WebPubSubPrivateLinkResources.List. +type WebPubSubPrivateLinkResourcesListResult struct { + PrivateLinkResourceList +} + +// WebPubSubRegenerateKeyPollerResponse contains the response from method WebPubSub.RegenerateKey. +type WebPubSubRegenerateKeyPollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubRegenerateKeyPoller + + // 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 WebPubSubRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubRegenerateKeyResponse, error) { + respType := WebPubSubRegenerateKeyResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WebPubSubKeys) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubRegenerateKeyPollerResponse from the provided client and resume token. +func (l *WebPubSubRegenerateKeyPollerResponse) Resume(ctx context.Context, client *WebPubSubClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubClient.RegenerateKey", token, client.pl, client.regenerateKeyHandleError) + if err != nil { + return err + } + poller := &WebPubSubRegenerateKeyPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubRegenerateKeyResponse contains the response from method WebPubSub.RegenerateKey. +type WebPubSubRegenerateKeyResponse struct { + WebPubSubRegenerateKeyResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubRegenerateKeyResult contains the result from method WebPubSub.RegenerateKey. +type WebPubSubRegenerateKeyResult struct { + WebPubSubKeys +} + +// WebPubSubRestartPollerResponse contains the response from method WebPubSub.Restart. +type WebPubSubRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubRestartPoller + + // 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 WebPubSubRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubRestartResponse, error) { + respType := WebPubSubRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubRestartPollerResponse from the provided client and resume token. +func (l *WebPubSubRestartPollerResponse) Resume(ctx context.Context, client *WebPubSubClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &WebPubSubRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubRestartResponse contains the response from method WebPubSub.Restart. +type WebPubSubRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse contains the response from method WebPubSubSharedPrivateLinkResources.CreateOrUpdate. +type WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller + + // 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 WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse, error) { + respType := WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse{} + 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 WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WebPubSubSharedPrivateLinkResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubSharedPrivateLinkResourcesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse contains the response from method WebPubSubSharedPrivateLinkResources.CreateOrUpdate. +type WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResponse struct { + WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResult contains the result from method WebPubSubSharedPrivateLinkResources.CreateOrUpdate. +type WebPubSubSharedPrivateLinkResourcesCreateOrUpdateResult struct { + SharedPrivateLinkResource +} + +// WebPubSubSharedPrivateLinkResourcesDeletePollerResponse contains the response from method WebPubSubSharedPrivateLinkResources.Delete. +type WebPubSubSharedPrivateLinkResourcesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubSharedPrivateLinkResourcesDeletePoller + + // 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 WebPubSubSharedPrivateLinkResourcesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubSharedPrivateLinkResourcesDeleteResponse, error) { + respType := WebPubSubSharedPrivateLinkResourcesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubSharedPrivateLinkResourcesDeletePollerResponse from the provided client and resume token. +func (l *WebPubSubSharedPrivateLinkResourcesDeletePollerResponse) Resume(ctx context.Context, client *WebPubSubSharedPrivateLinkResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubSharedPrivateLinkResourcesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &WebPubSubSharedPrivateLinkResourcesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubSharedPrivateLinkResourcesDeleteResponse contains the response from method WebPubSubSharedPrivateLinkResources.Delete. +type WebPubSubSharedPrivateLinkResourcesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubSharedPrivateLinkResourcesGetResponse contains the response from method WebPubSubSharedPrivateLinkResources.Get. +type WebPubSubSharedPrivateLinkResourcesGetResponse struct { + WebPubSubSharedPrivateLinkResourcesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubSharedPrivateLinkResourcesGetResult contains the result from method WebPubSubSharedPrivateLinkResources.Get. +type WebPubSubSharedPrivateLinkResourcesGetResult struct { + SharedPrivateLinkResource +} + +// WebPubSubSharedPrivateLinkResourcesListResponse contains the response from method WebPubSubSharedPrivateLinkResources.List. +type WebPubSubSharedPrivateLinkResourcesListResponse struct { + WebPubSubSharedPrivateLinkResourcesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubSharedPrivateLinkResourcesListResult contains the result from method WebPubSubSharedPrivateLinkResources.List. +type WebPubSubSharedPrivateLinkResourcesListResult struct { + SharedPrivateLinkResourceList +} + +// WebPubSubUpdatePollerResponse contains the response from method WebPubSub.Update. +type WebPubSubUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *WebPubSubUpdatePoller + + // 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 WebPubSubUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebPubSubUpdateResponse, error) { + respType := WebPubSubUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WebPubSubResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WebPubSubUpdatePollerResponse from the provided client and resume token. +func (l *WebPubSubUpdatePollerResponse) Resume(ctx context.Context, client *WebPubSubClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WebPubSubClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &WebPubSubUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WebPubSubUpdateResponse contains the response from method WebPubSub.Update. +type WebPubSubUpdateResponse struct { + WebPubSubUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WebPubSubUpdateResult contains the result from method WebPubSub.Update. +type WebPubSubUpdateResult struct { + WebPubSubResource +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..9d49adab1b8c --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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 armwebpubsub + +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/webpubsub/armwebpubsub/zz_generated_usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_usages_client.go new file mode 100644 index 000000000000..82d5b16341d0 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/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 armwebpubsub + +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.SignalRServiceUsageList.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.SignalRServiceUsageList); 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) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsub_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsub_client.go new file mode 100644 index 000000000000..374557915070 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsub_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 armwebpubsub + +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" +) + +// WebPubSubClient contains the methods for the WebPubSub group. +// Don't use this type directly, use NewWebPubSubClient() instead. +type WebPubSubClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWebPubSubClient creates a new instance of WebPubSubClient with the specified values. +func NewWebPubSubClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebPubSubClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebPubSubClient{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 *WebPubSubClient) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityParameters, options *WebPubSubCheckNameAvailabilityOptions) (WebPubSubCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, location, parameters, options) + if err != nil { + return WebPubSubCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubCheckNameAvailabilityResponse{}, client.checkNameAvailabilityHandleError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *WebPubSubClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, parameters NameAvailabilityParameters, options *WebPubSubCheckNameAvailabilityOptions) (*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 *WebPubSubClient) checkNameAvailabilityHandleResponse(resp *http.Response) (WebPubSubCheckNameAvailabilityResponse, error) { + result := WebPubSubCheckNameAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { + return WebPubSubCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// checkNameAvailabilityHandleError handles the CheckNameAvailability error response. +func (client *WebPubSubClient) 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 *WebPubSubClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters WebPubSubResource, options *WebPubSubBeginCreateOrUpdateOptions) (WebPubSubCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return WebPubSubCreateOrUpdatePollerResponse{}, err + } + result := WebPubSubCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return WebPubSubCreateOrUpdatePollerResponse{}, err + } + result.Poller = &WebPubSubCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters WebPubSubResource, options *WebPubSubBeginCreateOrUpdateOptions) (*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 *WebPubSubClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters WebPubSubResource, options *WebPubSubBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) 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 *WebPubSubClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubBeginDeleteOptions) (WebPubSubDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubDeletePollerResponse{}, err + } + result := WebPubSubDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return WebPubSubDeletePollerResponse{}, err + } + result.Poller = &WebPubSubDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Operation to delete a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubBeginDeleteOptions) (*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 *WebPubSubClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) 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 *WebPubSubClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubGetOptions) (WebPubSubGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WebPubSubClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) getHandleResponse(resp *http.Response) (WebPubSubGetResponse, error) { + result := WebPubSubGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WebPubSubResource); err != nil { + return WebPubSubGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *WebPubSubClient) 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 *WebPubSubClient) ListByResourceGroup(resourceGroupName string, options *WebPubSubListByResourceGroupOptions) *WebPubSubListByResourceGroupPager { + return &WebPubSubListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp WebPubSubListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.WebPubSubResourceList.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *WebPubSubClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *WebPubSubListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub" + 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 *WebPubSubClient) listByResourceGroupHandleResponse(resp *http.Response) (WebPubSubListByResourceGroupResponse, error) { + result := WebPubSubListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WebPubSubResourceList); err != nil { + return WebPubSubListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *WebPubSubClient) 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 *WebPubSubClient) ListBySubscription(options *WebPubSubListBySubscriptionOptions) *WebPubSubListBySubscriptionPager { + return &WebPubSubListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp WebPubSubListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.WebPubSubResourceList.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *WebPubSubClient) listBySubscriptionCreateRequest(ctx context.Context, options *WebPubSubListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub" + 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 *WebPubSubClient) listBySubscriptionHandleResponse(resp *http.Response) (WebPubSubListBySubscriptionResponse, error) { + result := WebPubSubListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WebPubSubResourceList); err != nil { + return WebPubSubListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *WebPubSubClient) 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 *WebPubSubClient) ListKeys(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubListKeysOptions) (WebPubSubListKeysResponse, error) { + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubListKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubListKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubListKeysResponse{}, client.listKeysHandleError(resp) + } + return client.listKeysHandleResponse(resp) +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *WebPubSubClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) listKeysHandleResponse(resp *http.Response) (WebPubSubListKeysResponse, error) { + result := WebPubSubListKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WebPubSubKeys); err != nil { + return WebPubSubListKeysResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listKeysHandleError handles the ListKeys error response. +func (client *WebPubSubClient) 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 *WebPubSubClient) ListSKUs(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubListSKUsOptions) (WebPubSubListSKUsResponse, error) { + req, err := client.listSKUsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubListSKUsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubListSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubListSKUsResponse{}, client.listSKUsHandleError(resp) + } + return client.listSKUsHandleResponse(resp) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *WebPubSubClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) listSKUsHandleResponse(resp *http.Response) (WebPubSubListSKUsResponse, error) { + result := WebPubSubListSKUsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return WebPubSubListSKUsResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listSKUsHandleError handles the ListSKUs error response. +func (client *WebPubSubClient) 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 *WebPubSubClient) BeginRegenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *WebPubSubBeginRegenerateKeyOptions) (WebPubSubRegenerateKeyPollerResponse, error) { + resp, err := client.regenerateKey(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return WebPubSubRegenerateKeyPollerResponse{}, err + } + result := WebPubSubRegenerateKeyPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubClient.RegenerateKey", "azure-async-operation", resp, client.pl, client.regenerateKeyHandleError) + if err != nil { + return WebPubSubRegenerateKeyPollerResponse{}, err + } + result.Poller = &WebPubSubRegenerateKeyPoller{ + 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 *WebPubSubClient) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *WebPubSubBeginRegenerateKeyOptions) (*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 *WebPubSubClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *WebPubSubBeginRegenerateKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) 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 *WebPubSubClient) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubBeginRestartOptions) (WebPubSubRestartPollerResponse, error) { + resp, err := client.restart(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubRestartPollerResponse{}, err + } + result := WebPubSubRestartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubClient.Restart", "azure-async-operation", resp, client.pl, client.restartHandleError) + if err != nil { + return WebPubSubRestartPollerResponse{}, err + } + result.Poller = &WebPubSubRestartPoller{ + pt: pt, + } + return result, nil +} + +// Restart - Operation to restart a resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubClient) restart(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubBeginRestartOptions) (*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 *WebPubSubClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) 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 *WebPubSubClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters WebPubSubResource, options *WebPubSubBeginUpdateOptions) (WebPubSubUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return WebPubSubUpdatePollerResponse{}, err + } + result := WebPubSubUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return WebPubSubUpdatePollerResponse{}, err + } + result.Poller = &WebPubSubUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Operation to update an exiting resource. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubClient) update(ctx context.Context, resourceGroupName string, resourceName string, parameters WebPubSubResource, options *WebPubSubBeginUpdateOptions) (*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 *WebPubSubClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters WebPubSubResource, options *WebPubSubBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubClient) 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/webpubsub/armwebpubsub/zz_generated_webpubsubhubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubhubs_client.go new file mode 100644 index 000000000000..4550ed2dae88 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubhubs_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 armwebpubsub + +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" +) + +// WebPubSubHubsClient contains the methods for the WebPubSubHubs group. +// Don't use this type directly, use NewWebPubSubHubsClient() instead. +type WebPubSubHubsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWebPubSubHubsClient creates a new instance of WebPubSubHubsClient with the specified values. +func NewWebPubSubHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebPubSubHubsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebPubSubHubsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update a hub setting. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubHubsClient) BeginCreateOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters WebPubSubHub, options *WebPubSubHubsBeginCreateOrUpdateOptions) (WebPubSubHubsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, hubName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return WebPubSubHubsCreateOrUpdatePollerResponse{}, err + } + result := WebPubSubHubsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubHubsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return WebPubSubHubsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &WebPubSubHubsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update a hub setting. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubHubsClient) createOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters WebPubSubHub, options *WebPubSubHubsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, hubName, 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 *WebPubSubHubsClient) createOrUpdateCreateRequest(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters WebPubSubHub, options *WebPubSubHubsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}" + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) + 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 *WebPubSubHubsClient) 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 a hub setting. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubHubsClient) BeginDelete(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *WebPubSubHubsBeginDeleteOptions) (WebPubSubHubsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, hubName, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubHubsDeletePollerResponse{}, err + } + result := WebPubSubHubsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubHubsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return WebPubSubHubsDeletePollerResponse{}, err + } + result.Poller = &WebPubSubHubsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a hub setting. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubHubsClient) deleteOperation(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *WebPubSubHubsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, hubName, 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 *WebPubSubHubsClient) deleteCreateRequest(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *WebPubSubHubsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}" + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) + 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 *WebPubSubHubsClient) 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 a hub setting. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubHubsClient) Get(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *WebPubSubHubsGetOptions) (WebPubSubHubsGetResponse, error) { + req, err := client.getCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubHubsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubHubsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubHubsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WebPubSubHubsClient) getCreateRequest(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *WebPubSubHubsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}" + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) + 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 *WebPubSubHubsClient) getHandleResponse(resp *http.Response) (WebPubSubHubsGetResponse, error) { + result := WebPubSubHubsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WebPubSubHub); err != nil { + return WebPubSubHubsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *WebPubSubHubsClient) 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 hub settings. +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubHubsClient) List(resourceGroupName string, resourceName string, options *WebPubSubHubsListOptions) *WebPubSubHubsListPager { + return &WebPubSubHubsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp WebPubSubHubsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.WebPubSubHubList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *WebPubSubHubsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubHubsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs" + 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 *WebPubSubHubsClient) listHandleResponse(resp *http.Response) (WebPubSubHubsListResponse, error) { + result := WebPubSubHubsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WebPubSubHubList); err != nil { + return WebPubSubHubsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *WebPubSubHubsClient) 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/webpubsub/armwebpubsub/zz_generated_webpubsubprivateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubprivateendpointconnections_client.go new file mode 100644 index 000000000000..3e693b54839b --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubprivateendpointconnections_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 armwebpubsub + +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" +) + +// WebPubSubPrivateEndpointConnectionsClient contains the methods for the WebPubSubPrivateEndpointConnections group. +// Don't use this type directly, use NewWebPubSubPrivateEndpointConnectionsClient() instead. +type WebPubSubPrivateEndpointConnectionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWebPubSubPrivateEndpointConnectionsClient creates a new instance of WebPubSubPrivateEndpointConnectionsClient with the specified values. +func NewWebPubSubPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebPubSubPrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebPubSubPrivateEndpointConnectionsClient{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 *WebPubSubPrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsBeginDeleteOptions) (WebPubSubPrivateEndpointConnectionsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubPrivateEndpointConnectionsDeletePollerResponse{}, err + } + result := WebPubSubPrivateEndpointConnectionsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubPrivateEndpointConnectionsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return WebPubSubPrivateEndpointConnectionsDeletePollerResponse{}, err + } + result.Poller = &WebPubSubPrivateEndpointConnectionsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified private endpoint connection +// If the operation fails it returns the *ErrorResponse error type. +func (client *WebPubSubPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsBeginDeleteOptions) (*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 *WebPubSubPrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubPrivateEndpointConnectionsClient) 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 *WebPubSubPrivateEndpointConnectionsClient) Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsGetOptions) (WebPubSubPrivateEndpointConnectionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubPrivateEndpointConnectionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubPrivateEndpointConnectionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubPrivateEndpointConnectionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WebPubSubPrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubPrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (WebPubSubPrivateEndpointConnectionsGetResponse, error) { + result := WebPubSubPrivateEndpointConnectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return WebPubSubPrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *WebPubSubPrivateEndpointConnectionsClient) 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 *WebPubSubPrivateEndpointConnectionsClient) List(resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsListOptions) *WebPubSubPrivateEndpointConnectionsListPager { + return &WebPubSubPrivateEndpointConnectionsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp WebPubSubPrivateEndpointConnectionsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *WebPubSubPrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubPrivateEndpointConnectionsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubPrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (WebPubSubPrivateEndpointConnectionsListResponse, error) { + result := WebPubSubPrivateEndpointConnectionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionList); err != nil { + return WebPubSubPrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *WebPubSubPrivateEndpointConnectionsClient) 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 *WebPubSubPrivateEndpointConnectionsClient) Update(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *WebPubSubPrivateEndpointConnectionsUpdateOptions) (WebPubSubPrivateEndpointConnectionsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return WebPubSubPrivateEndpointConnectionsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubPrivateEndpointConnectionsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubPrivateEndpointConnectionsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *WebPubSubPrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *WebPubSubPrivateEndpointConnectionsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubPrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (WebPubSubPrivateEndpointConnectionsUpdateResponse, error) { + result := WebPubSubPrivateEndpointConnectionsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return WebPubSubPrivateEndpointConnectionsUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *WebPubSubPrivateEndpointConnectionsClient) 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/webpubsub/armwebpubsub/zz_generated_webpubsubprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubprivatelinkresources_client.go new file mode 100644 index 000000000000..0cbc1e0847f8 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubprivatelinkresources_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 armwebpubsub + +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" +) + +// WebPubSubPrivateLinkResourcesClient contains the methods for the WebPubSubPrivateLinkResources group. +// Don't use this type directly, use NewWebPubSubPrivateLinkResourcesClient() instead. +type WebPubSubPrivateLinkResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWebPubSubPrivateLinkResourcesClient creates a new instance of WebPubSubPrivateLinkResourcesClient with the specified values. +func NewWebPubSubPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebPubSubPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebPubSubPrivateLinkResourcesClient{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 *WebPubSubPrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *WebPubSubPrivateLinkResourcesListOptions) *WebPubSubPrivateLinkResourcesListPager { + return &WebPubSubPrivateLinkResourcesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp WebPubSubPrivateLinkResourcesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkResourceList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *WebPubSubPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubPrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (WebPubSubPrivateLinkResourcesListResponse, error) { + result := WebPubSubPrivateLinkResourcesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceList); err != nil { + return WebPubSubPrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *WebPubSubPrivateLinkResourcesClient) 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/webpubsub/armwebpubsub/zz_generated_webpubsubsharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubsharedprivatelinkresources_client.go new file mode 100644 index 000000000000..cd6f1df6ec69 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_webpubsubsharedprivatelinkresources_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 armwebpubsub + +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" +) + +// WebPubSubSharedPrivateLinkResourcesClient contains the methods for the WebPubSubSharedPrivateLinkResources group. +// Don't use this type directly, use NewWebPubSubSharedPrivateLinkResourcesClient() instead. +type WebPubSubSharedPrivateLinkResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWebPubSubSharedPrivateLinkResourcesClient creates a new instance of WebPubSubSharedPrivateLinkResourcesClient with the specified values. +func NewWebPubSubSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebPubSubSharedPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebPubSubSharedPrivateLinkResourcesClient{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 *WebPubSubSharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *WebPubSubSharedPrivateLinkResourcesBeginCreateOrUpdateOptions) (WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse{}, err + } + result := WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubSharedPrivateLinkResourcesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &WebPubSubSharedPrivateLinkResourcesCreateOrUpdatePoller{ + 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 *WebPubSubSharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *WebPubSubSharedPrivateLinkResourcesBeginCreateOrUpdateOptions) (*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 *WebPubSubSharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *WebPubSubSharedPrivateLinkResourcesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubSharedPrivateLinkResourcesClient) 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 *WebPubSubSharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesBeginDeleteOptions) (WebPubSubSharedPrivateLinkResourcesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesDeletePollerResponse{}, err + } + result := WebPubSubSharedPrivateLinkResourcesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WebPubSubSharedPrivateLinkResourcesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesDeletePollerResponse{}, err + } + result.Poller = &WebPubSubSharedPrivateLinkResourcesDeletePoller{ + 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 *WebPubSubSharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesBeginDeleteOptions) (*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 *WebPubSubSharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubSharedPrivateLinkResourcesClient) 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 *WebPubSubSharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesGetOptions) (WebPubSubSharedPrivateLinkResourcesGetResponse, error) { + req, err := client.getCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebPubSubSharedPrivateLinkResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebPubSubSharedPrivateLinkResourcesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WebPubSubSharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubSharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (WebPubSubSharedPrivateLinkResourcesGetResponse, error) { + result := WebPubSubSharedPrivateLinkResourcesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { + return WebPubSubSharedPrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *WebPubSubSharedPrivateLinkResourcesClient) 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 *WebPubSubSharedPrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesListOptions) *WebPubSubSharedPrivateLinkResourcesListPager { + return &WebPubSubSharedPrivateLinkResourcesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp WebPubSubSharedPrivateLinkResourcesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SharedPrivateLinkResourceList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *WebPubSubSharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WebPubSubSharedPrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{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 *WebPubSubSharedPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (WebPubSubSharedPrivateLinkResourcesListResponse, error) { + result := WebPubSubSharedPrivateLinkResourcesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceList); err != nil { + return WebPubSubSharedPrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *WebPubSubSharedPrivateLinkResourcesClient) 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) +}