From c713fd6ae984f27eff82fbcf8d7d54524ee43628 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 26 Oct 2021 05:15:39 +0000 Subject: [PATCH] CodeGen from PR 16044 in Azure/azure-rest-api-specs [SignalR] Add stable version 2021-10-01 (#16044) * init * remove * Add 2021-10-01 * Minor update --- .../2018-03-01-preview/signalr/CHANGELOG.md | 2 +- .../2018-03-01-preview/signalr/_meta.json | 2 +- .../2020-07-01-preview/signalr/CHANGELOG.md | 7 +- .../2020-07-01-preview/signalr/_meta.json | 2 +- .../mgmt/2020-07-01-preview/signalr/models.go | 70 +- .../2020-07-01-preview/signalr/signalr.go | 18 +- .../signalr/signalrapi/interfaces.go | 16 +- .../mgmt/2020-07-01-preview/signalr/usages.go | 2 +- .../2021-04-01-preview/signalr/CHANGELOG.md | 2 +- .../2021-04-01-preview/signalr/_meta.json | 2 +- .../2021-06-01-preview/signalr/CHANGELOG.md | 2 +- .../2021-06-01-preview/signalr/_meta.json | 2 +- .../mgmt/2021-06-01-preview/signalr/models.go | 2 +- .../2021-09-01-preview/signalr/CHANGELOG.md | 2 + .../2021-09-01-preview/signalr/_meta.json | 11 + .../mgmt/2021-09-01-preview/signalr/client.go | 41 + .../mgmt/2021-09-01-preview/signalr/enums.go | 248 ++ .../mgmt/2021-09-01-preview/signalr/models.go | 2377 ++++++++++++++++ .../2021-09-01-preview/signalr/operations.go | 140 + .../signalr/privateendpointconnections.go | 394 +++ .../signalr/privatelinkresources.go | 151 ++ .../signalr/sharedprivatelinkresources.go | 407 +++ .../2021-09-01-preview/signalr/signalr.go | 994 +++++++ .../signalr/signalrapi/interfaces.go | 77 + .../mgmt/2021-09-01-preview/signalr/usages.go | 147 + .../2021-09-01-preview/signalr/version.go | 19 + .../mgmt/2018-10-01/signalr/CHANGELOG.md | 2 +- .../mgmt/2018-10-01/signalr/_meta.json | 2 +- .../mgmt/2020-05-01/signalr/CHANGELOG.md | 12 +- .../mgmt/2020-05-01/signalr/_meta.json | 2 +- .../signalr/mgmt/2020-05-01/signalr/enums.go | 4 +- .../signalr/mgmt/2020-05-01/signalr/models.go | 44 +- .../mgmt/2021-10-01/signalr/CHANGELOG.md | 2 + .../mgmt/2021-10-01/signalr/_meta.json | 11 + .../signalr/mgmt/2021-10-01/signalr/client.go | 41 + .../signalr/mgmt/2021-10-01/signalr/enums.go | 248 ++ .../signalr/mgmt/2021-10-01/signalr/models.go | 2404 +++++++++++++++++ .../mgmt/2021-10-01/signalr/operations.go | 140 + .../signalr/privateendpointconnections.go | 394 +++ .../signalr/privatelinkresources.go | 151 ++ .../signalr/sharedprivatelinkresources.go | 407 +++ .../mgmt/2021-10-01/signalr/signalr.go | 994 +++++++ .../signalr/signalrapi/interfaces.go | 77 + .../signalr/mgmt/2021-10-01/signalr/usages.go | 147 + .../mgmt/2021-10-01/signalr/version.go | 19 + 45 files changed, 10171 insertions(+), 67 deletions(-) create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/CHANGELOG.md create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/_meta.json create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/client.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/enums.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/models.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/operations.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/privateendpointconnections.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/privatelinkresources.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/sharedprivatelinkresources.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalr.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalrapi/interfaces.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/usages.go create mode 100644 services/preview/signalr/mgmt/2021-09-01-preview/signalr/version.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/CHANGELOG.md create mode 100644 services/signalr/mgmt/2021-10-01/signalr/_meta.json create mode 100644 services/signalr/mgmt/2021-10-01/signalr/client.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/enums.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/models.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/operations.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/privateendpointconnections.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/privatelinkresources.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/sharedprivatelinkresources.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/signalr.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/signalrapi/interfaces.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/usages.go create mode 100644 services/signalr/mgmt/2021-10-01/signalr/version.go diff --git a/services/preview/signalr/mgmt/2018-03-01-preview/signalr/CHANGELOG.md b/services/preview/signalr/mgmt/2018-03-01-preview/signalr/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/signalr/mgmt/2018-03-01-preview/signalr/CHANGELOG.md +++ b/services/preview/signalr/mgmt/2018-03-01-preview/signalr/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/signalr/mgmt/2018-03-01-preview/signalr/_meta.json b/services/preview/signalr/mgmt/2018-03-01-preview/signalr/_meta.json index ad6fff09b44b..0800f8a048b5 100644 --- a/services/preview/signalr/mgmt/2018-03-01-preview/signalr/_meta.json +++ b/services/preview/signalr/mgmt/2018-03-01-preview/signalr/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", "tag": "package-2018-03-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/CHANGELOG.md b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/CHANGELOG.md index 52911e4cc5e4..a7be6eef1105 100644 --- a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/CHANGELOG.md +++ b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/CHANGELOG.md @@ -1,2 +1,7 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. ResourceSku.MarshalJSON() ([]byte, error) diff --git a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/_meta.json b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/_meta.json index c45bbaee83d7..86c9f23372e9 100644 --- a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/_meta.json +++ b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", "tag": "package-2020-07-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/models.go b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/models.go index fed48d35529a..0560bb4e0be9 100644 --- a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/models.go +++ b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/models.go @@ -179,16 +179,16 @@ func (f Feature) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Keys a class represents the access keys of SignalR service. +// Keys a class represents the access keys of the resource. type Keys struct { autorest.Response `json:"-"` // PrimaryKey - The primary access key. PrimaryKey *string `json:"primaryKey,omitempty"` // SecondaryKey - The secondary access key. SecondaryKey *string `json:"secondaryKey,omitempty"` - // PrimaryConnectionString - SignalR connection string constructed via the primaryKey + // PrimaryConnectionString - Connection string constructed via the primaryKey PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - // SecondaryConnectionString - SignalR connection string constructed via the secondaryKey + // SecondaryConnectionString - Connection string constructed via the secondaryKey SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` } @@ -269,7 +269,7 @@ type NameAvailability struct { // NameAvailabilityParameters data POST-ed to the nameAvailability action type NameAvailabilityParameters struct { - // Type - The resource type. Should be always "Microsoft.SignalRService/SignalR". + // Type - The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" Type *string `json:"type,omitempty"` // Name - The SignalR service name to validate. e.g."my-signalR-name-here" Name *string `json:"name,omitempty"` @@ -283,7 +283,7 @@ type NetworkACL struct { Deny *[]RequestType `json:"deny,omitempty"` } -// NetworkACLs network ACLs for SignalR +// NetworkACLs network ACLs for the resource type NetworkACLs struct { // DefaultAction - Default action when no other rule matches. Possible values include: 'Allow', 'Deny' DefaultAction ACLAction `json:"defaultAction,omitempty"` @@ -293,7 +293,7 @@ type NetworkACLs struct { PrivateEndpoints *[]PrivateEndpointACL `json:"privateEndpoints,omitempty"` } -// Operation REST API operation supported by SignalR resource provider. +// Operation REST API operation supported by resource provider. type Operation struct { // Name - Name of the operation with format: {provider}/{resource}/{operation} Name *string `json:"name,omitempty"` @@ -886,22 +886,21 @@ type PrivateLinkServiceConnectionState struct { ActionsRequired *string `json:"actionsRequired,omitempty"` } -// Properties a class that describes the properties of the SignalR service that should contain more -// read-only properties than AzSignalR.Models.SignalRCreateOrUpdateProperties +// Properties a class that describes the properties of the resource type Properties struct { // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ExternalIP - READ-ONLY; The publicly accessible IP of the SignalR service. + // ExternalIP - READ-ONLY; The publicly accessible IP of the resource. ExternalIP *string `json:"externalIP,omitempty"` - // HostName - READ-ONLY; FQDN of the SignalR service instance. Format: xxx.service.signalr.net + // HostName - READ-ONLY; FQDN of the service instance. HostName *string `json:"hostName,omitempty"` - // PublicPort - READ-ONLY; The publicly accessible port of the SignalR service which is designed for browser/client side usage. + // PublicPort - READ-ONLY; The publicly accessible port of the resource which is designed for browser/client side usage. PublicPort *int32 `json:"publicPort,omitempty"` - // ServerPort - READ-ONLY; The publicly accessible port of the SignalR service which is designed for customer server side usage. + // ServerPort - READ-ONLY; The publicly accessible port of the resource which is designed for customer server side usage. ServerPort *int32 `json:"serverPort,omitempty"` - // Version - READ-ONLY; Version of the SignalR resource. Probably you need the same or higher version of client SDKs. + // Version - READ-ONLY; Version of the resource. Probably you need the same or higher version of client SDKs. Version *string `json:"version,omitempty"` - // PrivateEndpointConnections - READ-ONLY; Private endpoint connections to the SignalR resource. + // PrivateEndpointConnections - READ-ONLY; Private endpoint connections to the resource. PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` // TLS - TLS settings. TLS *TLSSettings `json:"tls,omitempty"` @@ -1023,10 +1022,10 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ResourceList object that includes an array of SignalR services and a possible link for next set. +// ResourceList object that includes an array of resources and a possible link for next set. type ResourceList struct { autorest.Response `json:"-"` - // Value - List of SignalR services + // Value - List of the resources Value *[]ResourceType `json:"value,omitempty"` // NextLink - The URL the client should use to fetch the next page (per server side paging). // It's null for now, added for future use. @@ -1183,7 +1182,7 @@ func NewResourceListPage(cur ResourceList, getNextPage func(context.Context, Res } } -// ResourceSku the billing information of the SignalR resource. +// ResourceSku the billing information of the resource. type ResourceSku struct { // Name - The name of the SKU. Required. // @@ -1193,9 +1192,9 @@ type ResourceSku struct { // // `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' Tier SkuTier `json:"tier,omitempty"` - // Size - Optional string. For future use. + // Size - READ-ONLY; Not used. Retained for future use. Size *string `json:"size,omitempty"` - // Family - Optional string. For future use. + // Family - READ-ONLY; Not used. Retained for future use. Family *string `json:"family,omitempty"` // Capacity - Optional, integer. The unit count of SignalR resource. 1 by default. // @@ -1205,18 +1204,33 @@ type ResourceSku struct { Capacity *int32 `json:"capacity,omitempty"` } -// ResourceType a class represent a SignalR service resource. +// MarshalJSON is the custom marshaler for ResourceSku. +func (rs ResourceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Tier != "" { + objectMap["tier"] = rs.Tier + } + if rs.Capacity != nil { + objectMap["capacity"] = rs.Capacity + } + return json.Marshal(objectMap) +} + +// ResourceType a class represent a resource. type ResourceType struct { autorest.Response `json:"-"` // Sku - The billing information of the resource.(e.g. Free, Standard) Sku *ResourceSku `json:"sku,omitempty"` // Properties - Settings used to provision or configure the resource *Properties `json:"properties,omitempty"` - // Kind - The kind of the service - e.g. "SignalR", or "RawWebSockets" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets' + // Kind - The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets' Kind ServiceKind `json:"kind,omitempty"` // Identity - The managed identity response Identity *ManagedIdentity `json:"identity,omitempty"` - // Location - The GEO location of the SignalR service. e.g. West US | East US | North Central US | South Central US. + // Location - The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. Location *string `json:"location,omitempty"` // Tags - Tags of the service which is a list of key value pairs that describe the resource. Tags map[string]*string `json:"tags"` @@ -1384,7 +1398,7 @@ func (future *RestartFuture) result(client Client) (ar autorest.Response, err er return } -// ServerlessUpstreamSettings the settings for the Upstream when the Azure SignalR is in server-less mode. +// ServerlessUpstreamSettings the settings for the Upstream when the service is in server-less mode. type ServerlessUpstreamSettings struct { // Templates - Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. Templates *[]UpstreamTemplate `json:"templates,omitempty"` @@ -1398,7 +1412,7 @@ type ServiceSpecification struct { LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` } -// TLSSettings TLS settings for SignalR +// TLSSettings TLS settings for the resource type TLSSettings struct { // ClientCertEnabled - Request client certificate during TLS handshake if enabled ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` @@ -1406,7 +1420,7 @@ type TLSSettings struct { // TrackedResource the resource model definition for a ARM tracked top level resource. type TrackedResource struct { - // Location - The GEO location of the SignalR service. e.g. West US | East US | North Central US | South Central US. + // Location - The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. Location *string `json:"location,omitempty"` // Tags - Tags of the service which is a list of key value pairs that describe the resource. Tags map[string]*string `json:"tags"` @@ -1509,7 +1523,7 @@ type UpstreamTemplate struct { Auth *UpstreamAuthSettings `json:"auth,omitempty"` } -// Usage object that describes a specific usage of SignalR resources. +// Usage object that describes a specific usage of the resources. type Usage struct { // ID - Fully qualified ARM resource id ID *string `json:"id,omitempty"` @@ -1523,10 +1537,10 @@ type Usage struct { Unit *string `json:"unit,omitempty"` } -// UsageList object that includes an array of SignalR resource usages and a possible link for next set. +// UsageList object that includes an array of the resource usages and a possible link for next set. type UsageList struct { autorest.Response `json:"-"` - // Value - List of SignalR usages + // Value - List of the resource usages Value *[]Usage `json:"value,omitempty"` // NextLink - The URL the client should use to fetch the next page (per server side paging). // It's null for now, added for future use. diff --git a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalr.go b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalr.go index 06aa1be38c79..2a983cca5709 100644 --- a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalr.go +++ b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalr.go @@ -31,7 +31,7 @@ func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { return Client{NewWithBaseURI(baseURI, subscriptionID)} } -// CheckNameAvailability checks that the SignalR name is valid and is not already in use. +// CheckNameAvailability checks that the resource name is valid and is not already in use. // Parameters: // location - the region // parameters - parameters supplied to the operation. @@ -120,7 +120,7 @@ func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result return } -// CreateOrUpdate create a new SignalR service and update an exiting SignalR service. +// CreateOrUpdate create or update a resource. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -215,7 +215,7 @@ func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Resour return } -// Delete operation to delete a SignalR service. +// Delete operation to delete a resource. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -294,7 +294,7 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo return } -// Get get the SignalR service and its properties. +// Get get the resource and its properties. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -601,7 +601,7 @@ func (client Client) ListBySubscriptionComplete(ctx context.Context) (result Res return } -// ListKeys get the access keys of the SignalR resource. +// ListKeys get the access keys of the resource. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -678,8 +678,8 @@ func (client Client) ListKeysResponder(resp *http.Response) (result Keys, err er return } -// RegenerateKey regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same -// time. +// RegenerateKey regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the +// same time. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -765,7 +765,7 @@ func (client Client) RegenerateKeyResponder(resp *http.Response) (result Keys, e return } -// Restart operation to restart a SignalR service. +// Restart operation to restart a resource. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -844,7 +844,7 @@ func (client Client) RestartResponder(resp *http.Response) (result autorest.Resp return } -// Update operation to update an exiting SignalR service. +// Update operation to update an exiting resource. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. diff --git a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalrapi/interfaces.go b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalrapi/interfaces.go index ca92e501063b..fa9d82760344 100644 --- a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalrapi/interfaces.go +++ b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/signalrapi/interfaces.go @@ -37,6 +37,14 @@ type ClientAPI interface { var _ ClientAPI = (*signalr.Client)(nil) +// UsagesClientAPI contains the set of methods on the UsagesClient type. +type UsagesClientAPI interface { + List(ctx context.Context, location string) (result signalr.UsageListPage, err error) + ListComplete(ctx context.Context, location string) (result signalr.UsageListIterator, err error) +} + +var _ UsagesClientAPI = (*signalr.UsagesClient)(nil) + // PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. type PrivateEndpointConnectionsClientAPI interface { Delete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionsDeleteFuture, err error) @@ -53,11 +61,3 @@ type PrivateLinkResourcesClientAPI interface { } var _ PrivateLinkResourcesClientAPI = (*signalr.PrivateLinkResourcesClient)(nil) - -// UsagesClientAPI contains the set of methods on the UsagesClient type. -type UsagesClientAPI interface { - List(ctx context.Context, location string) (result signalr.UsageListPage, err error) - ListComplete(ctx context.Context, location string) (result signalr.UsageListIterator, err error) -} - -var _ UsagesClientAPI = (*signalr.UsagesClient)(nil) diff --git a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/usages.go b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/usages.go index 38c88b18f9cf..e5c82a5d4f68 100644 --- a/services/preview/signalr/mgmt/2020-07-01-preview/signalr/usages.go +++ b/services/preview/signalr/mgmt/2020-07-01-preview/signalr/usages.go @@ -30,7 +30,7 @@ func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesCli return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// List list usage quotas for Azure SignalR service by location. +// List list resource usage quotas by location. // Parameters: // location - the location like "eastus" func (client UsagesClient) List(ctx context.Context, location string) (result UsageListPage, err error) { diff --git a/services/preview/signalr/mgmt/2021-04-01-preview/signalr/CHANGELOG.md b/services/preview/signalr/mgmt/2021-04-01-preview/signalr/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/signalr/mgmt/2021-04-01-preview/signalr/CHANGELOG.md +++ b/services/preview/signalr/mgmt/2021-04-01-preview/signalr/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/signalr/mgmt/2021-04-01-preview/signalr/_meta.json b/services/preview/signalr/mgmt/2021-04-01-preview/signalr/_meta.json index 284c96e7f346..18dac16c2206 100644 --- a/services/preview/signalr/mgmt/2021-04-01-preview/signalr/_meta.json +++ b/services/preview/signalr/mgmt/2021-04-01-preview/signalr/_meta.json @@ -1,5 +1,5 @@ { - "commit": "ea5bc27ee9cadeb67767d774c82095be2420bcad", + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", "tag": "package-2021-04-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/signalr/mgmt/2021-06-01-preview/signalr/CHANGELOG.md b/services/preview/signalr/mgmt/2021-06-01-preview/signalr/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/signalr/mgmt/2021-06-01-preview/signalr/CHANGELOG.md +++ b/services/preview/signalr/mgmt/2021-06-01-preview/signalr/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/signalr/mgmt/2021-06-01-preview/signalr/_meta.json b/services/preview/signalr/mgmt/2021-06-01-preview/signalr/_meta.json index d7ba320f10a1..6bd22b1056c6 100644 --- a/services/preview/signalr/mgmt/2021-06-01-preview/signalr/_meta.json +++ b/services/preview/signalr/mgmt/2021-06-01-preview/signalr/_meta.json @@ -1,5 +1,5 @@ { - "commit": "b548283ea6f4b3d797e85432fcc6e3ff2a2ac224", + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", "tag": "package-2021-06-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/signalr/mgmt/2021-06-01-preview/signalr/models.go b/services/preview/signalr/mgmt/2021-06-01-preview/signalr/models.go index 2917ffc18c13..567d7ebe51a3 100644 --- a/services/preview/signalr/mgmt/2021-06-01-preview/signalr/models.go +++ b/services/preview/signalr/mgmt/2021-06-01-preview/signalr/models.go @@ -1107,7 +1107,7 @@ type Properties struct { // Enable or disable local auth with AccessKey // When set as true, connection with AccessKey=xxx won't work. DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - // DisableAadAuth - disableAadAuth + // DisableAadAuth - DisableLocalAuth // Enable or disable aad auth // When set as true, connection with AuthType=aad won't work. DisableAadAuth *bool `json:"disableAadAuth,omitempty"` diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/CHANGELOG.md b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/_meta.json b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/_meta.json new file mode 100644 index 000000000000..7da04ba18638 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", + "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", + "tag": "package-2021-09-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-09-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/client.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/client.go new file mode 100644 index 000000000000..92a7835a31eb --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/client.go @@ -0,0 +1,41 @@ +// Package signalr implements the Azure ARM Signalr service API version 2021-09-01-preview. +// +// REST API for Azure SignalR Service +package signalr + +// 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Signalr + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Signalr. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/enums.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/enums.go new file mode 100644 index 000000000000..e95b96856fca --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/enums.go @@ -0,0 +1,248 @@ +package signalr + +// 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. + +// ACLAction enumerates the values for acl action. +type ACLAction string + +const ( + // Allow ... + Allow ACLAction = "Allow" + // Deny ... + Deny ACLAction = "Deny" +) + +// PossibleACLActionValues returns an array of possible values for the ACLAction const type. +func PossibleACLActionValues() []ACLAction { + return []ACLAction{Allow, Deny} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// FeatureFlags enumerates the values for feature flags. +type FeatureFlags string + +const ( + // EnableConnectivityLogs ... + EnableConnectivityLogs FeatureFlags = "EnableConnectivityLogs" + // EnableLiveTrace ... + EnableLiveTrace FeatureFlags = "EnableLiveTrace" + // EnableMessagingLogs ... + EnableMessagingLogs FeatureFlags = "EnableMessagingLogs" + // ServiceMode ... + ServiceMode FeatureFlags = "ServiceMode" +) + +// PossibleFeatureFlagsValues returns an array of possible values for the FeatureFlags const type. +func PossibleFeatureFlagsValues() []FeatureFlags { + return []FeatureFlags{EnableConnectivityLogs, EnableLiveTrace, EnableMessagingLogs, ServiceMode} +} + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // Primary ... + Primary KeyType = "Primary" + // Salt ... + Salt KeyType = "Salt" + // Secondary ... + Secondary KeyType = "Secondary" +) + +// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{Primary, Salt, Secondary} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // None ... + None ManagedIdentityType = "None" + // SystemAssigned ... + SystemAssigned ManagedIdentityType = "SystemAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{None, SystemAssigned, UserAssigned} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // Approved ... + Approved PrivateLinkServiceConnectionStatus = "Approved" + // Disconnected ... + Disconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // Pending ... + Pending PrivateLinkServiceConnectionStatus = "Pending" + // Rejected ... + Rejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{Approved, Disconnected, Pending, Rejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Canceled ... + Canceled ProvisioningState = "Canceled" + // Creating ... + Creating ProvisioningState = "Creating" + // Deleting ... + Deleting ProvisioningState = "Deleting" + // Failed ... + Failed ProvisioningState = "Failed" + // Moving ... + Moving ProvisioningState = "Moving" + // Running ... + Running ProvisioningState = "Running" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" + // Unknown ... + Unknown ProvisioningState = "Unknown" + // Updating ... + Updating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{Canceled, Creating, Deleting, Failed, Moving, Running, Succeeded, Unknown, Updating} +} + +// RequestType enumerates the values for request type. +type RequestType string + +const ( + // ClientConnection ... + ClientConnection RequestType = "ClientConnection" + // RESTAPI ... + RESTAPI RequestType = "RESTAPI" + // ServerConnection ... + ServerConnection RequestType = "ServerConnection" + // Trace ... + Trace RequestType = "Trace" +) + +// PossibleRequestTypeValues returns an array of possible values for the RequestType const type. +func PossibleRequestTypeValues() []RequestType { + return []RequestType{ClientConnection, RESTAPI, ServerConnection, Trace} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ScaleTypeAutomatic ... + ScaleTypeAutomatic ScaleType = "Automatic" + // ScaleTypeManual ... + ScaleTypeManual ScaleType = "Manual" + // ScaleTypeNone ... + ScaleTypeNone ScaleType = "None" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{ScaleTypeAutomatic, ScaleTypeManual, ScaleTypeNone} +} + +// ServiceKind enumerates the values for service kind. +type ServiceKind string + +const ( + // RawWebSockets ... + RawWebSockets ServiceKind = "RawWebSockets" + // SignalR ... + SignalR ServiceKind = "SignalR" +) + +// PossibleServiceKindValues returns an array of possible values for the ServiceKind const type. +func PossibleServiceKindValues() []ServiceKind { + return []ServiceKind{RawWebSockets, SignalR} +} + +// SharedPrivateLinkResourceStatus enumerates the values for shared private link resource status. +type SharedPrivateLinkResourceStatus string + +const ( + // SharedPrivateLinkResourceStatusApproved ... + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + // SharedPrivateLinkResourceStatusDisconnected ... + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + // SharedPrivateLinkResourceStatusPending ... + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + // SharedPrivateLinkResourceStatusRejected ... + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" + // SharedPrivateLinkResourceStatusTimeout ... + SharedPrivateLinkResourceStatusTimeout SharedPrivateLinkResourceStatus = "Timeout" +) + +// PossibleSharedPrivateLinkResourceStatusValues returns an array of possible values for the SharedPrivateLinkResourceStatus const type. +func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { + return []SharedPrivateLinkResourceStatus{SharedPrivateLinkResourceStatusApproved, SharedPrivateLinkResourceStatusDisconnected, SharedPrivateLinkResourceStatusPending, SharedPrivateLinkResourceStatusRejected, SharedPrivateLinkResourceStatusTimeout} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// UpstreamAuthType enumerates the values for upstream auth type. +type UpstreamAuthType string + +const ( + // UpstreamAuthTypeManagedIdentity ... + UpstreamAuthTypeManagedIdentity UpstreamAuthType = "ManagedIdentity" + // UpstreamAuthTypeNone ... + UpstreamAuthTypeNone UpstreamAuthType = "None" +) + +// PossibleUpstreamAuthTypeValues returns an array of possible values for the UpstreamAuthType const type. +func PossibleUpstreamAuthTypeValues() []UpstreamAuthType { + return []UpstreamAuthType{UpstreamAuthTypeManagedIdentity, UpstreamAuthTypeNone} +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/models.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/models.go new file mode 100644 index 000000000000..70834380f701 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/models.go @@ -0,0 +1,2377 @@ +package signalr + +// 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/signalr/mgmt/2021-09-01-preview/signalr" + +// CorsSettings cross-Origin Resource Sharing (CORS) settings. +type CorsSettings struct { + // AllowedOrigins - Gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` +} + +// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (ResourceType, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CreateOrUpdateFuture.Result. +func (future *CreateOrUpdateFuture) result(client Client) (rt ResourceType, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.CreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.CreateOrUpdateResponder(rt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.CreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") + } + } + return +} + +// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteFuture.Result. +func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.DeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.DeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Dimension specifications of the Dimension of metrics. +type Dimension struct { + // Name - The public facing name of the dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension. + DisplayName *string `json:"displayName,omitempty"` + // InternalName - Name of the dimension as it appears in MDM. + InternalName *string `json:"internalName,omitempty"` + // ToBeExportedForShoebox - 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 { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Feature feature of a resource, which controls the runtime behavior. +type Feature struct { + // Flag - FeatureFlags is the supported features of Azure SignalR service. + // - ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have your own backend server; "Serverless": your application doesn't have a backend server; "Classic": for backward compatibility. Support both Default and Serverless mode but not recommended; "PredefinedOnly": for future use. + // - EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category respectively. + // - EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category respectively. + // - EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR service, it will give you live traces in real time, it will be helpful when you developing your own Azure SignalR based web application or self-troubleshooting some issues. Please note that live traces are counted as outbound messages that will be charged. Values allowed: "true"/"false", to enable/disable live trace feature. Possible values include: 'ServiceMode', 'EnableConnectivityLogs', 'EnableMessagingLogs', 'EnableLiveTrace' + Flag FeatureFlags `json:"flag,omitempty"` + // Value - Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. + Value *string `json:"value,omitempty"` + // Properties - Optional properties related to this feature. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for Feature. +func (f Feature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if f.Flag != "" { + objectMap["flag"] = f.Flag + } + if f.Value != nil { + objectMap["value"] = f.Value + } + if f.Properties != nil { + objectMap["properties"] = f.Properties + } + return json.Marshal(objectMap) +} + +// Keys a class represents the access keys of the resource. +type Keys struct { + autorest.Response `json:"-"` + // PrimaryKey - The primary access key. + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - The secondary access key. + SecondaryKey *string `json:"secondaryKey,omitempty"` + // PrimaryConnectionString - Connection string constructed via the primaryKey + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + // SecondaryConnectionString - Connection string constructed via the secondaryKey + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` +} + +// LogSpecification specifications of the Logs for Azure Monitoring. +type LogSpecification struct { + // Name - Name of the log. + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the log. + DisplayName *string `json:"displayName,omitempty"` +} + +// ManagedIdentity a class represent managed identities used for request and response +type ManagedIdentity struct { + // Type - Represent the identity type: systemAssigned, userAssigned, None. Possible values include: 'None', 'SystemAssigned', 'UserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - Get or set the user assigned identities + UserAssignedIdentities map[string]*UserAssignedIdentityProperty `json:"userAssignedIdentities"` + // PrincipalID - READ-ONLY; Get the principal id for the system assigned identity. + // Only be used in response. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; Get the tenant id for the system assigned identity. + // Only be used in response + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentity. +func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mi.Type != "" { + objectMap["type"] = mi.Type + } + if mi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedIdentitySettings managed identity settings for upstream. +type ManagedIdentitySettings struct { + // Resource - 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 { + // Name - Name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Localized friendly description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The unit that makes sense for the metric. + Unit *string `json:"unit,omitempty"` + // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + // FillGapWithZero - 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"` + // Category - 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"` + // Dimensions - The dimensions of the metrics. + Dimensions *[]Dimension `json:"dimensions,omitempty"` +} + +// NameAvailability result of the request to check name availability. It contains a flag and possible +// reason of failure. +type NameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - Indicates whether the name is available or not. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - The reason of the availability. Required if name is not available. + Reason *string `json:"reason,omitempty"` + // Message - The message of the operation. + Message *string `json:"message,omitempty"` +} + +// NameAvailabilityParameters data POST-ed to the nameAvailability action +type NameAvailabilityParameters struct { + // Type - The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" + Type *string `json:"type,omitempty"` + // Name - The resource name to validate. e.g."my-resource-name" + Name *string `json:"name,omitempty"` +} + +// NetworkACL network ACL +type NetworkACL struct { + // Allow - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Allow *[]RequestType `json:"allow,omitempty"` + // Deny - Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Deny *[]RequestType `json:"deny,omitempty"` +} + +// NetworkACLs network ACLs for the resource +type NetworkACLs struct { + // DefaultAction - Default action when no other rule matches. Possible values include: 'Allow', 'Deny' + DefaultAction ACLAction `json:"defaultAction,omitempty"` + // PublicNetwork - ACL for requests from public network + PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"` + // PrivateEndpoints - ACLs for requests from private endpoints + PrivateEndpoints *[]PrivateEndpointACL `json:"privateEndpoints,omitempty"` +} + +// Operation REST API operation supported by resource provider. +type Operation struct { + // Name - Name of the operation with format: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // IsDataAction - If the operation is a data action. (for data plane rbac) + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - The object that describes the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - 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"` + // Properties - Extra properties for the operation. + Properties *OperationProperties `json:"properties,omitempty"` +} + +// OperationDisplay the object that describes a operation. +type OperationDisplay struct { + // Provider - Friendly name of the resource provider + Provider *string `json:"provider,omitempty"` + // Resource - Resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - The localized friendly name for the operation. + Operation *string `json:"operation,omitempty"` + // Description - The localized friendly description for the operation + Description *string `json:"description,omitempty"` +} + +// OperationList result of the request to list REST API operations. It contains a list of operations. +type OperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - 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"` +} + +// OperationListIterator provides access to a complete listing of Operation values. +type OperationListIterator struct { + i int + page OperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListIterator) Response() OperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListIterator type. +func NewOperationListIterator(page OperationListPage) OperationListIterator { + return OperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OperationList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// operationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OperationListPage contains a page of Operation values. +type OperationListPage struct { + fn func(context.Context, OperationList) (OperationList, error) + ol OperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListPage) Response() OperationList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListPage) Values() []Operation { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OperationListPage type. +func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { + return OperationListPage{ + fn: getNextPage, + ol: cur, + } +} + +// OperationProperties extra Operation properties. +type OperationProperties struct { + // ServiceSpecification - The service specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PrivateEndpoint private endpoint +type PrivateEndpoint struct { + // ID - Full qualified Id of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointACL ACL for a private endpoint +type PrivateEndpointACL struct { + // Name - Name of the private endpoint connection + Name *string `json:"name,omitempty"` + // Allow - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Allow *[]RequestType `json:"allow,omitempty"` + // Deny - Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Deny *[]RequestType `json:"deny,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection to an azure resource +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // PrivateEndpointConnectionProperties - Properties of the private endpoint connection + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionList a list of private endpoint connections +type PrivateEndpointConnectionList struct { + autorest.Response `json:"-"` + // Value - The list of the private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - 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"` +} + +// PrivateEndpointConnectionListIterator provides access to a complete listing of PrivateEndpointConnection +// values. +type PrivateEndpointConnectionListIterator struct { + i int + page PrivateEndpointConnectionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionListIterator) Response() PrivateEndpointConnectionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionListIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListIterator type. +func NewPrivateEndpointConnectionListIterator(page PrivateEndpointConnectionListPage) PrivateEndpointConnectionListIterator { + return PrivateEndpointConnectionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pecl PrivateEndpointConnectionList) IsEmpty() bool { + return pecl.Value == nil || len(*pecl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pecl PrivateEndpointConnectionList) hasNextLink() bool { + return pecl.NextLink != nil && len(*pecl.NextLink) != 0 +} + +// privateEndpointConnectionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pecl PrivateEndpointConnectionList) privateEndpointConnectionListPreparer(ctx context.Context) (*http.Request, error) { + if !pecl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pecl.NextLink))) +} + +// PrivateEndpointConnectionListPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListPage struct { + fn func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error) + pecl PrivateEndpointConnectionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pecl) + if err != nil { + return err + } + page.pecl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListPage) NotDone() bool { + return !page.pecl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListPage) Response() PrivateEndpointConnectionList { + return page.pecl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListPage) Values() []PrivateEndpointConnection { + if page.pecl.IsEmpty() { + return nil + } + return *page.pecl.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListPage type. +func NewPrivateEndpointConnectionListPage(cur PrivateEndpointConnectionList, getNextPage func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error)) PrivateEndpointConnectionListPage { + return PrivateEndpointConnectionListPage{ + fn: getNextPage, + pecl: cur, + } +} + +// PrivateEndpointConnectionProperties private endpoint connection properties +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint connection. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - Private endpoint associated with the private endpoint connection + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Connection state + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource private link resource +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Properties of a private link resource + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceList contains a list of PrivateLinkResource and a possible link to query more results +type PrivateLinkResourceList struct { + autorest.Response `json:"-"` + // Value - List of PrivateLinkResource + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - 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"` +} + +// PrivateLinkResourceListIterator provides access to a complete listing of PrivateLinkResource values. +type PrivateLinkResourceListIterator struct { + i int + page PrivateLinkResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateLinkResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateLinkResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateLinkResourceListIterator) Response() PrivateLinkResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateLinkResourceListIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourceListIterator type. +func NewPrivateLinkResourceListIterator(page PrivateLinkResourceListPage) PrivateLinkResourceListIterator { + return PrivateLinkResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrl PrivateLinkResourceList) IsEmpty() bool { + return plrl.Value == nil || len(*plrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrl PrivateLinkResourceList) hasNextLink() bool { + return plrl.NextLink != nil && len(*plrl.NextLink) != 0 +} + +// privateLinkResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrl PrivateLinkResourceList) privateLinkResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !plrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plrl.NextLink))) +} + +// PrivateLinkResourceListPage contains a page of PrivateLinkResource values. +type PrivateLinkResourceListPage struct { + fn func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error) + plrl PrivateLinkResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateLinkResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plrl) + if err != nil { + return err + } + page.plrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateLinkResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourceListPage) NotDone() bool { + return !page.plrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourceListPage) Response() PrivateLinkResourceList { + return page.plrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourceListPage) Values() []PrivateLinkResource { + if page.plrl.IsEmpty() { + return nil + } + return *page.plrl.Value +} + +// Creates a new instance of the PrivateLinkResourceListPage type. +func NewPrivateLinkResourceListPage(cur PrivateLinkResourceList, getNextPage func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error)) PrivateLinkResourceListPage { + return PrivateLinkResourceListPage{ + fn: getNextPage, + plrl: cur, + } +} + +// PrivateLinkResourceProperties private link resource properties +type PrivateLinkResourceProperties struct { + // GroupID - Group Id of the private link resource + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - Required members of the private link resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required private DNS zone names + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` + // ShareablePrivateLinkResourceTypes - The list of resources that are onboarded to private link service + ShareablePrivateLinkResourceTypes *[]ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` +} + +// PrivateLinkServiceConnectionState connection state of the private endpoint connection +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// Properties a class that describes the properties of the resource +type Properties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExternalIP - READ-ONLY; The publicly accessible IP of the resource. + ExternalIP *string `json:"externalIP,omitempty"` + // HostName - READ-ONLY; FQDN of the service instance. + HostName *string `json:"hostName,omitempty"` + // PublicPort - READ-ONLY; The publicly accessible port of the resource which is designed for browser/client side usage. + PublicPort *int32 `json:"publicPort,omitempty"` + // ServerPort - READ-ONLY; The publicly accessible port of the resource which is designed for customer server side usage. + ServerPort *int32 `json:"serverPort,omitempty"` + // Version - READ-ONLY; Version of the resource. Probably you need the same or higher version of client SDKs. + Version *string `json:"version,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private endpoint connections to the resource. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // SharedPrivateLinkResources - READ-ONLY; The list of shared private link resources. + SharedPrivateLinkResources *[]SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty"` + // TLS - TLS settings. + TLS *TLSSettings `json:"tls,omitempty"` + // HostNamePrefix - READ-ONLY; Deprecated. + HostNamePrefix *string `json:"hostNamePrefix,omitempty"` + // Features - List of the featureFlags. + // + // FeatureFlags that are not included in the parameters for the update operation will not be modified. + // And the response will only include featureFlags that are explicitly set. + // When a featureFlag is not explicitly set, its globally default value will be used + // But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + Features *[]Feature `json:"features,omitempty"` + // Cors - Cross-Origin Resource Sharing (CORS) settings. + Cors *CorsSettings `json:"cors,omitempty"` + // Upstream - Upstream settings when the service is in server-less mode. + Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"` + // NetworkACLs - Network ACLs + NetworkACLs *NetworkACLs `json:"networkACLs,omitempty"` + // PublicNetworkAccess - 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"` + // DisableLocalAuth - DisableLocalAuth + // Enable or disable local auth with AccessKey + // When set as true, connection with AccessKey=xxx won't work. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // DisableAadAuth - DisableLocalAuth + // Enable or disable aad auth + // When set as true, connection with AuthType=aad won't work. + DisableAadAuth *bool `json:"disableAadAuth,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.TLS != nil { + objectMap["tls"] = p.TLS + } + if p.Features != nil { + objectMap["features"] = p.Features + } + if p.Cors != nil { + objectMap["cors"] = p.Cors + } + if p.Upstream != nil { + objectMap["upstream"] = p.Upstream + } + if p.NetworkACLs != nil { + objectMap["networkACLs"] = p.NetworkACLs + } + if p.PublicNetworkAccess != nil { + objectMap["publicNetworkAccess"] = p.PublicNetworkAccess + } + if p.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = p.DisableLocalAuth + } + if p.DisableAadAuth != nil { + objectMap["disableAadAuth"] = p.DisableAadAuth + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegenerateKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (Keys, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegenerateKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RegenerateKeyFuture.Result. +func (future *RegenerateKeyFuture) result(client Client) (kVar Keys, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.RegenerateKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + kVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.RegenerateKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if kVar.Response.Response, err = future.GetResult(sender); err == nil && kVar.Response.Response.StatusCode != http.StatusNoContent { + kVar, err = client.RegenerateKeyResponder(kVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.RegenerateKeyFuture", "Result", kVar.Response.Response, "Failure responding to request") + } + } + return +} + +// RegenerateKeyParameters parameters describes the request to regenerate access keys +type RegenerateKeyParameters struct { + // KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary', 'Salt' + KeyType KeyType `json:"keyType,omitempty"` +} + +// Resource the core properties of ARM resources. +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceList object that includes an array of resources and a possible link for next set. +type ResourceList struct { + autorest.Response `json:"-"` + // Value - List of the resources + Value *[]ResourceType `json:"value,omitempty"` + // NextLink - 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"` +} + +// ResourceListIterator provides access to a complete listing of ResourceType values. +type ResourceListIterator struct { + i int + page ResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceListIterator) Response() ResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceListIterator) Value() ResourceType { + if !iter.page.NotDone() { + return ResourceType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceListIterator type. +func NewResourceListIterator(page ResourceListPage) ResourceListIterator { + return ResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rl ResourceList) IsEmpty() bool { + return rl.Value == nil || len(*rl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rl ResourceList) hasNextLink() bool { + return rl.NextLink != nil && len(*rl.NextLink) != 0 +} + +// resourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rl ResourceList) resourceListPreparer(ctx context.Context) (*http.Request, error) { + if !rl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rl.NextLink))) +} + +// ResourceListPage contains a page of ResourceType values. +type ResourceListPage struct { + fn func(context.Context, ResourceList) (ResourceList, error) + rl ResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rl) + if err != nil { + return err + } + page.rl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceListPage) NotDone() bool { + return !page.rl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceListPage) Response() ResourceList { + return page.rl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceListPage) Values() []ResourceType { + if page.rl.IsEmpty() { + return nil + } + return *page.rl.Value +} + +// Creates a new instance of the ResourceListPage type. +func NewResourceListPage(cur ResourceList, getNextPage func(context.Context, ResourceList) (ResourceList, error)) ResourceListPage { + return ResourceListPage{ + fn: getNextPage, + rl: cur, + } +} + +// ResourceSku the billing information of the resource. +type ResourceSku struct { + // Name - The name of the SKU. Required. + // + // Allowed values: Standard_S1, Free_F1 + Name *string `json:"name,omitempty"` + // Tier - Optional tier of this particular SKU. 'Standard' or 'Free'. + // + // `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - READ-ONLY; Not used. Retained for future use. + Size *string `json:"size,omitempty"` + // Family - READ-ONLY; Not used. Retained for future use. + Family *string `json:"family,omitempty"` + // Capacity - 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"` +} + +// MarshalJSON is the custom marshaler for ResourceSku. +func (rs ResourceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Tier != "" { + objectMap["tier"] = rs.Tier + } + if rs.Capacity != nil { + objectMap["capacity"] = rs.Capacity + } + return json.Marshal(objectMap) +} + +// ResourceType a class represent a resource. +type ResourceType struct { + autorest.Response `json:"-"` + // Sku - The billing information of the resource.(e.g. Free, Standard) + Sku *ResourceSku `json:"sku,omitempty"` + // Properties - Settings used to provision or configure the resource + *Properties `json:"properties,omitempty"` + // Kind - The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets' + Kind ServiceKind `json:"kind,omitempty"` + // Identity - The managed identity response + Identity *ManagedIdentity `json:"identity,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Location - The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceType. +func (rt ResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rt.Sku != nil { + objectMap["sku"] = rt.Sku + } + if rt.Properties != nil { + objectMap["properties"] = rt.Properties + } + if rt.Kind != "" { + objectMap["kind"] = rt.Kind + } + if rt.Identity != nil { + objectMap["identity"] = rt.Identity + } + if rt.Location != nil { + objectMap["location"] = rt.Location + } + if rt.Tags != nil { + objectMap["tags"] = rt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceType struct. +func (rt *ResourceType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ResourceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + rt.Sku = &sku + } + case "properties": + if v != nil { + var properties Properties + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + rt.Properties = &properties + } + case "kind": + if v != nil { + var kind ServiceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rt.Kind = kind + } + case "identity": + if v != nil { + var identity ManagedIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + rt.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rt.SystemData = &systemData + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rt.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rt.Type = &typeVar + } + } + } + + return nil +} + +// RestartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RestartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RestartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RestartFuture.Result. +func (future *RestartFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.RestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.RestartFuture") + return + } + ar.Response = future.Response() + return +} + +// ServerlessUpstreamSettings the settings for the Upstream when the service is in server-less mode. +type ServerlessUpstreamSettings struct { + // Templates - Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. + Templates *[]UpstreamTemplate `json:"templates,omitempty"` +} + +// ServiceSpecification an object that describes a specification. +type ServiceSpecification struct { + // MetricSpecifications - Specifications of the Metrics for Azure Monitoring. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` + // LogSpecifications - Specifications of the Logs for Azure Monitoring. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` +} + +// ShareablePrivateLinkResourceProperties describes the properties of a resource type that has been +// onboarded to private link service +type ShareablePrivateLinkResourceProperties struct { + // Description - The description of the resource type that has been onboarded to private link service + Description *string `json:"description,omitempty"` + // GroupID - The resource provider group id for the resource that has been onboarded to private link service + GroupID *string `json:"groupId,omitempty"` + // Type - 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 { + // Name - The name of the resource type that has been onboarded to private link service + Name *string `json:"name,omitempty"` + // Properties - 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 { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // SharedPrivateLinkResourceProperties - Describes the properties of a Shared Private Link Resource + *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SharedPrivateLinkResource. +func (splr SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splr.SharedPrivateLinkResourceProperties != nil { + objectMap["properties"] = splr.SharedPrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SharedPrivateLinkResource struct. +func (splr *SharedPrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + splr.SystemData = &systemData + } + case "properties": + if v != nil { + var sharedPrivateLinkResourceProperties SharedPrivateLinkResourceProperties + err = json.Unmarshal(*v, &sharedPrivateLinkResourceProperties) + if err != nil { + return err + } + splr.SharedPrivateLinkResourceProperties = &sharedPrivateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + splr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + splr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + splr.Type = &typeVar + } + } + } + + return nil +} + +// SharedPrivateLinkResourceList a list of shared private link resources +type SharedPrivateLinkResourceList struct { + autorest.Response `json:"-"` + // Value - The list of the shared private link resources + Value *[]SharedPrivateLinkResource `json:"value,omitempty"` + // NextLink - 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"` +} + +// SharedPrivateLinkResourceListIterator provides access to a complete listing of SharedPrivateLinkResource +// values. +type SharedPrivateLinkResourceListIterator struct { + i int + page SharedPrivateLinkResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SharedPrivateLinkResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SharedPrivateLinkResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SharedPrivateLinkResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SharedPrivateLinkResourceListIterator) Response() SharedPrivateLinkResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SharedPrivateLinkResourceListIterator) Value() SharedPrivateLinkResource { + if !iter.page.NotDone() { + return SharedPrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SharedPrivateLinkResourceListIterator type. +func NewSharedPrivateLinkResourceListIterator(page SharedPrivateLinkResourceListPage) SharedPrivateLinkResourceListIterator { + return SharedPrivateLinkResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (splrl SharedPrivateLinkResourceList) IsEmpty() bool { + return splrl.Value == nil || len(*splrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (splrl SharedPrivateLinkResourceList) hasNextLink() bool { + return splrl.NextLink != nil && len(*splrl.NextLink) != 0 +} + +// sharedPrivateLinkResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (splrl SharedPrivateLinkResourceList) sharedPrivateLinkResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !splrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(splrl.NextLink))) +} + +// SharedPrivateLinkResourceListPage contains a page of SharedPrivateLinkResource values. +type SharedPrivateLinkResourceListPage struct { + fn func(context.Context, SharedPrivateLinkResourceList) (SharedPrivateLinkResourceList, error) + splrl SharedPrivateLinkResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SharedPrivateLinkResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.splrl) + if err != nil { + return err + } + page.splrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SharedPrivateLinkResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SharedPrivateLinkResourceListPage) NotDone() bool { + return !page.splrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SharedPrivateLinkResourceListPage) Response() SharedPrivateLinkResourceList { + return page.splrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SharedPrivateLinkResourceListPage) Values() []SharedPrivateLinkResource { + if page.splrl.IsEmpty() { + return nil + } + return *page.splrl.Value +} + +// Creates a new instance of the SharedPrivateLinkResourceListPage type. +func NewSharedPrivateLinkResourceListPage(cur SharedPrivateLinkResourceList, getNextPage func(context.Context, SharedPrivateLinkResourceList) (SharedPrivateLinkResourceList, error)) SharedPrivateLinkResourceListPage { + return SharedPrivateLinkResourceListPage{ + fn: getNextPage, + splrl: cur, + } +} + +// SharedPrivateLinkResourceProperties describes the properties of an existing Shared Private Link Resource +type SharedPrivateLinkResourceProperties struct { + // GroupID - The group id from the provider of resource the shared private link resource is for + GroupID *string `json:"groupId,omitempty"` + // PrivateLinkResourceID - The resource id of the resource the shared private link resource is for + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the shared private link resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // RequestMessage - The request message for requesting approval of the shared private link resource + RequestMessage *string `json:"requestMessage,omitempty"` + // Status - READ-ONLY; Status of the shared private link resource. Possible values include: 'SharedPrivateLinkResourceStatusPending', 'SharedPrivateLinkResourceStatusApproved', 'SharedPrivateLinkResourceStatusRejected', 'SharedPrivateLinkResourceStatusDisconnected', 'SharedPrivateLinkResourceStatusTimeout' + Status SharedPrivateLinkResourceStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for SharedPrivateLinkResourceProperties. +func (splrp SharedPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splrp.GroupID != nil { + objectMap["groupId"] = splrp.GroupID + } + if splrp.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = splrp.PrivateLinkResourceID + } + if splrp.RequestMessage != nil { + objectMap["requestMessage"] = splrp.RequestMessage + } + return json.Marshal(objectMap) +} + +// SharedPrivateLinkResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type SharedPrivateLinkResourcesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharedPrivateLinkResourcesClient) (SharedPrivateLinkResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SharedPrivateLinkResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SharedPrivateLinkResourcesCreateOrUpdateFuture.Result. +func (future *SharedPrivateLinkResourcesCreateOrUpdateFuture) result(client SharedPrivateLinkResourcesClient) (splr SharedPrivateLinkResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + splr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if splr.Response.Response, err = future.GetResult(sender); err == nil && splr.Response.Response.StatusCode != http.StatusNoContent { + splr, err = client.CreateOrUpdateResponder(splr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture", "Result", splr.Response.Response, "Failure responding to request") + } + } + return +} + +// SharedPrivateLinkResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SharedPrivateLinkResourcesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharedPrivateLinkResourcesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SharedPrivateLinkResourcesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SharedPrivateLinkResourcesDeleteFuture.Result. +func (future *SharedPrivateLinkResourcesDeleteFuture) result(client SharedPrivateLinkResourcesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.SharedPrivateLinkResourcesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Sku describes an available sku." +type Sku struct { + // ResourceType - READ-ONLY; The resource type that this object applies to + ResourceType *string `json:"resourceType,omitempty"` + // Sku - READ-ONLY; The exact set of keys that define this sku. + Sku *ResourceSku `json:"sku,omitempty"` + // Capacity - READ-ONLY; Specifies the unit of the resource. + Capacity *SkuCapacity `json:"capacity,omitempty"` +} + +// MarshalJSON is the custom marshaler for Sku. +func (s Sku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuCapacity describes scaling information of a sku. +type SkuCapacity struct { + // Minimum - READ-ONLY; The lowest permitted capacity for this resource + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - READ-ONLY; The highest permitted capacity for this resource + Maximum *int32 `json:"maximum,omitempty"` + // Default - READ-ONLY; The default capacity. + Default *int32 `json:"default,omitempty"` + // AllowedValues - READ-ONLY; Allows capacity value list. + AllowedValues *[]int32 `json:"allowedValues,omitempty"` + // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'ScaleTypeNone', 'ScaleTypeManual', 'ScaleTypeAutomatic' + ScaleType ScaleType `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuCapacity. +func (sc SkuCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuList the list skus operation response +type SkuList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of skus available for the resource. + Value *[]Sku `json:"value,omitempty"` + // NextLink - 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"` +} + +// MarshalJSON is the custom marshaler for SkuList. +func (sl SkuList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TLSSettings TLS settings for the resource +type TLSSettings struct { + // ClientCertEnabled - Request client certificate during TLS handshake if enabled + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (ResourceType, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *UpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for UpdateFuture.Result. +func (future *UpdateFuture) result(client Client) (rt ResourceType, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.UpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.UpdateResponder(rt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UpdateFuture", "Result", rt.Response.Response, "Failure responding to request") + } + } + return +} + +// UpstreamAuthSettings upstream auth settings. +type UpstreamAuthSettings struct { + // Type - Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible values include: 'UpstreamAuthTypeNone', 'UpstreamAuthTypeManagedIdentity' + Type UpstreamAuthType `json:"type,omitempty"` + // ManagedIdentity - Gets or sets the managed identity settings. It's required if the auth type is set to ManagedIdentity. + ManagedIdentity *ManagedIdentitySettings `json:"managedIdentity,omitempty"` +} + +// UpstreamTemplate upstream template item settings. It defines the Upstream URL of the incoming requests. +// The template defines the pattern of the event, the hub or the category of the incoming request that +// matches current URL template. +type UpstreamTemplate struct { + // HubPattern - Gets or sets the matching pattern for hub names. If not set, it matches any hub. + // There are 3 kind of patterns supported: + // 1. "*", it to matches any hub name + // 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" + // 3. The single hub name, for example, "hub1", it matches "hub1" + HubPattern *string `json:"hubPattern,omitempty"` + // EventPattern - Gets or sets the matching pattern for event names. If not set, it matches any event. + // There are 3 kind of patterns supported: + // 1. "*", it to matches any event name + // 2. Combine multiple events with ",", for example "connect,disconnect", it matches event "connect" and "disconnect" + // 3. The single event name, for example, "connect", it matches "connect" + EventPattern *string `json:"eventPattern,omitempty"` + // CategoryPattern - Gets or sets the matching pattern for category names. If not set, it matches any category. + // There are 3 kind of patterns supported: + // 1. "*", it to matches any category name + // 2. Combine multiple categories with ",", for example "connections,messages", it matches category "connections" and "messages" + // 3. The single category name, for example, "connections", it matches the category "connections" + CategoryPattern *string `json:"categoryPattern,omitempty"` + // URLTemplate - Gets or sets the Upstream URL template. You can use 3 predefined parameters {hub}, {category} {event} inside the template, the value of the Upstream URL is dynamically calculated when the client request comes in. + // For example, if the urlTemplate is `http://example.com/{hub}/api/{event}`, with a client request from hub `chat` connects, it will first POST to this URL: `http://example.com/chat/api/connect`. + URLTemplate *string `json:"urlTemplate,omitempty"` + // Auth - Gets or sets the auth settings for an upstream. If not set, no auth is used for upstream messages. + Auth *UpstreamAuthSettings `json:"auth,omitempty"` +} + +// Usage object that describes a specific usage of the resources. +type Usage struct { + // ID - Fully qualified ARM resource id + ID *string `json:"id,omitempty"` + // CurrentValue - Current value for the usage quota. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The maximum permitted value for the usage quota. If there is no limit, this value will be -1. + Limit *int64 `json:"limit,omitempty"` + // Name - Localizable String object containing the name and a localized value. + Name *UsageName `json:"name,omitempty"` + // Unit - Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + Unit *string `json:"unit,omitempty"` +} + +// UsageList object that includes an array of the resource usages and a possible link for next set. +type UsageList struct { + autorest.Response `json:"-"` + // Value - List of the resource usages + Value *[]Usage `json:"value,omitempty"` + // NextLink - 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"` +} + +// UsageListIterator provides access to a complete listing of Usage values. +type UsageListIterator struct { + i int + page UsageListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsageListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsageListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsageListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsageListIterator) Response() UsageList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsageListIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsageListIterator type. +func NewUsageListIterator(page UsageListPage) UsageListIterator { + return UsageListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ul UsageList) IsEmpty() bool { + return ul.Value == nil || len(*ul.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ul UsageList) hasNextLink() bool { + return ul.NextLink != nil && len(*ul.NextLink) != 0 +} + +// usageListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ul UsageList) usageListPreparer(ctx context.Context) (*http.Request, error) { + if !ul.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ul.NextLink))) +} + +// UsageListPage contains a page of Usage values. +type UsageListPage struct { + fn func(context.Context, UsageList) (UsageList, error) + ul UsageList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsageListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ul) + if err != nil { + return err + } + page.ul = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsageListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsageListPage) NotDone() bool { + return !page.ul.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsageListPage) Response() UsageList { + return page.ul +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsageListPage) Values() []Usage { + if page.ul.IsEmpty() { + return nil + } + return *page.ul.Value +} + +// Creates a new instance of the UsageListPage type. +func NewUsageListPage(cur UsageList, getNextPage func(context.Context, UsageList) (UsageList, error)) UsageListPage { + return UsageListPage{ + fn: getNextPage, + ul: cur, + } +} + +// UsageName localizable String object containing the name and a localized value. +type UsageName struct { + // Value - The identifier of the usage. + Value *string `json:"value,omitempty"` + // LocalizedValue - Localized name of the usage. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UserAssignedIdentityProperty properties of user assigned identity. +type UserAssignedIdentityProperty struct { + // PrincipalID - READ-ONLY; Get the principal id for the user assigned identity + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; Get the client id for the user assigned identity + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentityProperty. +func (uaip UserAssignedIdentityProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/operations.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/operations.go new file mode 100644 index 000000000000..9b7db59e9d62 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/operations.go @@ -0,0 +1,140 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the REST API for Azure SignalR Service +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.SignalRService provider. +func (client OperationsClient) List(ctx context.Context) (result OperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.SignalRService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationList) (result OperationList, err error) { + req, err := lastResults.operationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/privateendpointconnections.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/privateendpointconnections.go new file mode 100644 index 000000000000..72f8561d013f --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/privateendpointconnections.go @@ -0,0 +1,394 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the REST API for Azure SignalR Service +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete the specified private endpoint connection +// Parameters: +// privateEndpointConnectionName - the name of the private endpoint connection +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, privateEndpointConnectionName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified private endpoint connection +// Parameters: +// privateEndpointConnectionName - the name of the private endpoint connection +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, privateEndpointConnectionName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private endpoint connections +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.pecl.Response.Response != nil { + sc = result.pecl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pecl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.pecl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.pecl.hasNextLink() && result.pecl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionList) (result PrivateEndpointConnectionList, err error) { + req, err := lastResults.privateEndpointConnectionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// Update update the state of specified private endpoint connection +// Parameters: +// privateEndpointConnectionName - the name of the private endpoint connection +// parameters - the resource of private endpoint and its properties +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, privateEndpointConnectionName string, parameters PrivateEndpointConnection, resourceGroupName string, resourceName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, privateEndpointConnectionName, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, privateEndpointConnectionName string, parameters PrivateEndpointConnection, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/privatelinkresources.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/privatelinkresources.go new file mode 100644 index 000000000000..eb212ac96ac0 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/privatelinkresources.go @@ -0,0 +1,151 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the REST API for Azure SignalR Service +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get the private link resources that need to be created for a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.plrl.Response.Response != nil { + sc = result.plrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.plrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.plrl.hasNextLink() && result.plrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourceList) (result PrivateLinkResourceList, err error) { + req, err := lastResults.privateLinkResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/sharedprivatelinkresources.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/sharedprivatelinkresources.go new file mode 100644 index 000000000000..50d7318b4b23 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/sharedprivatelinkresources.go @@ -0,0 +1,407 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SharedPrivateLinkResourcesClient is the REST API for Azure SignalR Service +type SharedPrivateLinkResourcesClient struct { + BaseClient +} + +// NewSharedPrivateLinkResourcesClient creates an instance of the SharedPrivateLinkResourcesClient client. +func NewSharedPrivateLinkResourcesClient(subscriptionID string) SharedPrivateLinkResourcesClient { + return NewSharedPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSharedPrivateLinkResourcesClientWithBaseURI creates an instance of the SharedPrivateLinkResourcesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewSharedPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) SharedPrivateLinkResourcesClient { + return SharedPrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a shared private link resource +// Parameters: +// sharedPrivateLinkResourceName - the name of the shared private link resource +// parameters - the shared private link resource +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourcesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedPrivateLinkResourceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedPrivateLinkResourceProperties.GroupID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.SharedPrivateLinkResourceProperties.PrivateLinkResourceID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("signalr.SharedPrivateLinkResourcesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, sharedPrivateLinkResourceName, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdatePreparer(ctx context.Context, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "sharedPrivateLinkResourceName": autorest.Encode("path", sharedPrivateLinkResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdateSender(req *http.Request) (future SharedPrivateLinkResourcesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdateResponder(resp *http.Response) (result SharedPrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified shared private link resource +// Parameters: +// sharedPrivateLinkResourceName - the name of the shared private link resource +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) Delete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourcesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SharedPrivateLinkResourcesClient) DeletePreparer(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "sharedPrivateLinkResourceName": autorest.Encode("path", sharedPrivateLinkResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) DeleteSender(req *http.Request) (future SharedPrivateLinkResourcesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified shared private link resource +// Parameters: +// sharedPrivateLinkResourceName - the name of the shared private link resource +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result SharedPrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SharedPrivateLinkResourcesClient) GetPreparer(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "sharedPrivateLinkResourceName": autorest.Encode("path", sharedPrivateLinkResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) GetResponder(resp *http.Response) (result SharedPrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list shared private link resources +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.splrl.Response.Response != nil { + sc = result.splrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.splrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.splrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.splrl.hasNextLink() && result.splrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SharedPrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) ListResponder(resp *http.Response) (result SharedPrivateLinkResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SharedPrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults SharedPrivateLinkResourceList) (result SharedPrivateLinkResourceList, err error) { + req, err := lastResults.sharedPrivateLinkResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SharedPrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalr.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalr.go new file mode 100644 index 000000000000..6ad099a5a1de --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalr.go @@ -0,0 +1,994 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// Client is the REST API for Azure SignalR Service +type Client struct { + BaseClient +} + +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the resource name is valid and is not already in use. +// Parameters: +// location - the region +// parameters - parameters supplied to the operation. +func (client Client) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityParameters) (result NameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("signalr.Client", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, location string, parameters NameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a resource. +// Parameters: +// parameters - parameters for the create or update operation +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) CreateOrUpdate(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (result CreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("signalr.Client", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client Client) CreateOrUpdatePreparer(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client Client) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result DeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the resource and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ResourceType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup handles requests to list all resources in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ResourceList) (result ResourceList, err error) { + req, err := lastResults.resourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription handles requests to list all resources in a subscription. +func (client Client) ListBySubscription(ctx context.Context) (result ResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListBySubscription", resp, "Failure sending request") + return + } + + result.rl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client Client) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client Client) ListBySubscriptionResponder(resp *http.Response) (result ResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client Client) listBySubscriptionNextResults(ctx context.Context, lastResults ResourceList) (result ResourceList, err error) { + req, err := lastResults.resourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.Client", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.Client", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListBySubscriptionComplete(ctx context.Context) (result ResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListKeys get the access keys of the resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) ListKeys(ctx context.Context, resourceGroupName string, resourceName string) (result Keys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListKeysPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client Client) ListKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client Client) ListKeysResponder(resp *http.Response) (result Keys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkus list all available skus of the resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) ListSkus(ctx context.Context, resourceGroupName string, resourceName string) (result SkuList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListSkus", resp, "Failure responding to request") + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client Client) ListSkusPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client Client) ListSkusResponder(resp *http.Response) (result SkuList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the +// same time. +// Parameters: +// parameters - parameter that describes the Regenerate Key Operation. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) RegenerateKey(ctx context.Context, parameters RegenerateKeyParameters, resourceGroupName string, resourceName string) (result RegenerateKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.RegenerateKey") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegenerateKeyPreparer(ctx, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "RegenerateKey", nil, "Failure preparing request") + return + } + + result, err = client.RegenerateKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "RegenerateKey", result.Response(), "Failure sending request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client Client) RegenerateKeyPreparer(ctx context.Context, parameters RegenerateKeyParameters, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client Client) RegenerateKeySender(req *http.Request) (future RegenerateKeyFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client Client) RegenerateKeyResponder(resp *http.Response) (result Keys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Restart operation to restart a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Restart(ctx context.Context, resourceGroupName string, resourceName string) (result RestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Restart") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client Client) RestartPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client Client) RestartSender(req *http.Request) (future RestartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client Client) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update operation to update an exiting resource. +// Parameters: +// parameters - parameters for the update operation +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Update(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (result UpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client Client) UpdatePreparer(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client Client) UpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalrapi/interfaces.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalrapi/interfaces.go new file mode 100644 index 000000000000..13e4c5ae7572 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/signalrapi/interfaces.go @@ -0,0 +1,77 @@ +package signalrapi + +// 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/signalr/mgmt/2021-09-01-preview/signalr" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result signalr.OperationListPage, err error) + ListComplete(ctx context.Context) (result signalr.OperationListIterator, err error) +} + +var _ OperationsClientAPI = (*signalr.OperationsClient)(nil) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + CheckNameAvailability(ctx context.Context, location string, parameters signalr.NameAvailabilityParameters) (result signalr.NameAvailability, err error) + CreateOrUpdate(ctx context.Context, parameters signalr.ResourceType, resourceGroupName string, resourceName string) (result signalr.CreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.DeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.ResourceType, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result signalr.ResourceListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result signalr.ResourceListIterator, err error) + ListBySubscription(ctx context.Context) (result signalr.ResourceListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result signalr.ResourceListIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.Keys, err error) + ListSkus(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.SkuList, err error) + RegenerateKey(ctx context.Context, parameters signalr.RegenerateKeyParameters, resourceGroupName string, resourceName string) (result signalr.RegenerateKeyFuture, err error) + Restart(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.RestartFuture, err error) + Update(ctx context.Context, parameters signalr.ResourceType, resourceGroupName string, resourceName string) (result signalr.UpdateFuture, err error) +} + +var _ ClientAPI = (*signalr.Client)(nil) + +// UsagesClientAPI contains the set of methods on the UsagesClient type. +type UsagesClientAPI interface { + List(ctx context.Context, location string) (result signalr.UsageListPage, err error) + ListComplete(ctx context.Context, location string) (result signalr.UsageListIterator, err error) +} + +var _ UsagesClientAPI = (*signalr.UsagesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionListIterator, err error) + Update(ctx context.Context, privateEndpointConnectionName string, parameters signalr.PrivateEndpointConnection, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnection, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*signalr.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateLinkResourceListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateLinkResourceListIterator, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*signalr.PrivateLinkResourcesClient)(nil) + +// SharedPrivateLinkResourcesClientAPI contains the set of methods on the SharedPrivateLinkResourcesClient type. +type SharedPrivateLinkResourcesClientAPI interface { + CreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, parameters signalr.SharedPrivateLinkResource, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourcesDeleteFuture, err error) + Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResource, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourceListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourceListIterator, err error) +} + +var _ SharedPrivateLinkResourcesClientAPI = (*signalr.SharedPrivateLinkResourcesClient)(nil) diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/usages.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/usages.go new file mode 100644 index 000000000000..645ba8a3fd75 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/usages.go @@ -0,0 +1,147 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsagesClient is the REST API for Azure SignalR Service +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list resource usage quotas by location. +// Parameters: +// location - the location like "eastus" +func (client UsagesClient) List(ctx context.Context, location string) (result UsageListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.ul.Response.Response != nil { + sc = result.ul.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ul.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.ul, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "List", resp, "Failure responding to request") + return + } + if result.ul.hasNextLink() && result.ul.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result UsageList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesClient) listNextResults(ctx context.Context, lastResults UsageList) (result UsageList, err error) { + req, err := lastResults.usageListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.UsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, location string) (result UsageListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/signalr/mgmt/2021-09-01-preview/signalr/version.go b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/version.go new file mode 100644 index 000000000000..0631f1262a54 --- /dev/null +++ b/services/preview/signalr/mgmt/2021-09-01-preview/signalr/version.go @@ -0,0 +1,19 @@ +package signalr + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " signalr/2021-09-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/signalr/mgmt/2018-10-01/signalr/CHANGELOG.md b/services/signalr/mgmt/2018-10-01/signalr/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/signalr/mgmt/2018-10-01/signalr/CHANGELOG.md +++ b/services/signalr/mgmt/2018-10-01/signalr/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/signalr/mgmt/2018-10-01/signalr/_meta.json b/services/signalr/mgmt/2018-10-01/signalr/_meta.json index 9a078cbc045c..1f9ddd68b8a3 100644 --- a/services/signalr/mgmt/2018-10-01/signalr/_meta.json +++ b/services/signalr/mgmt/2018-10-01/signalr/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", "tag": "package-2018-10-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/signalr/mgmt/2020-05-01/signalr/CHANGELOG.md b/services/signalr/mgmt/2020-05-01/signalr/CHANGELOG.md index 52911e4cc5e4..44bc0f6e285e 100644 --- a/services/signalr/mgmt/2020-05-01/signalr/CHANGELOG.md +++ b/services/signalr/mgmt/2020-05-01/signalr/CHANGELOG.md @@ -1,2 +1,12 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. RequestType.Trace + +### New Funcs + +1. CreateOrUpdateProperties.MarshalJSON() ([]byte, error) +1. ResourceSku.MarshalJSON() ([]byte, error) diff --git a/services/signalr/mgmt/2020-05-01/signalr/_meta.json b/services/signalr/mgmt/2020-05-01/signalr/_meta.json index 506886b446dc..6aedcfbc5bbb 100644 --- a/services/signalr/mgmt/2020-05-01/signalr/_meta.json +++ b/services/signalr/mgmt/2020-05-01/signalr/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", "tag": "package-2020-05-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/signalr/mgmt/2020-05-01/signalr/enums.go b/services/signalr/mgmt/2020-05-01/signalr/enums.go index 591f88e9cb8f..e0f91bf6f853 100644 --- a/services/signalr/mgmt/2020-05-01/signalr/enums.go +++ b/services/signalr/mgmt/2020-05-01/signalr/enums.go @@ -111,11 +111,13 @@ const ( RESTAPI RequestType = "RESTAPI" // ServerConnection ... ServerConnection RequestType = "ServerConnection" + // Trace ... + Trace RequestType = "Trace" ) // PossibleRequestTypeValues returns an array of possible values for the RequestType const type. func PossibleRequestTypeValues() []RequestType { - return []RequestType{ClientConnection, RESTAPI, ServerConnection} + return []RequestType{ClientConnection, RESTAPI, ServerConnection, Trace} } // ServiceKind enumerates the values for service kind. diff --git a/services/signalr/mgmt/2020-05-01/signalr/models.go b/services/signalr/mgmt/2020-05-01/signalr/models.go index 5083df3069fc..3232d0a53a52 100644 --- a/services/signalr/mgmt/2020-05-01/signalr/models.go +++ b/services/signalr/mgmt/2020-05-01/signalr/models.go @@ -70,7 +70,7 @@ func (future *CreateOrUpdateFuture) result(client Client) (rt ResourceType, err // CreateOrUpdateProperties settings used to provision or configure the resource. type CreateOrUpdateProperties struct { - // HostNamePrefix - Prefix for the hostName of the SignalR service. Retained for future use. + // HostNamePrefix - READ-ONLY; Prefix for the hostName of the SignalR service. Retained for future use. // The hostname will be of format: <hostNamePrefix>.service.signalr.net. HostNamePrefix *string `json:"hostNamePrefix,omitempty"` // Features - List of SignalR featureFlags. e.g. ServiceMode. @@ -88,6 +88,24 @@ type CreateOrUpdateProperties struct { NetworkACLs *NetworkACLs `json:"networkACLs,omitempty"` } +// MarshalJSON is the custom marshaler for CreateOrUpdateProperties. +func (coup CreateOrUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if coup.Features != nil { + objectMap["features"] = coup.Features + } + if coup.Cors != nil { + objectMap["cors"] = coup.Cors + } + if coup.Upstream != nil { + objectMap["upstream"] = coup.Upstream + } + if coup.NetworkACLs != nil { + objectMap["networkACLs"] = coup.NetworkACLs + } + return json.Marshal(objectMap) +} + // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeleteFuture struct { azure.FutureAPI @@ -873,7 +891,7 @@ type Properties struct { Version *string `json:"version,omitempty"` // PrivateEndpointConnections - READ-ONLY; Private endpoint connections to the SignalR resource. PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // HostNamePrefix - Prefix for the hostName of the SignalR service. Retained for future use. + // HostNamePrefix - READ-ONLY; Prefix for the hostName of the SignalR service. Retained for future use. // The hostname will be of format: <hostNamePrefix>.service.signalr.net. HostNamePrefix *string `json:"hostNamePrefix,omitempty"` // Features - List of SignalR featureFlags. e.g. ServiceMode. @@ -894,9 +912,6 @@ type Properties struct { // MarshalJSON is the custom marshaler for Properties. func (p Properties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if p.HostNamePrefix != nil { - objectMap["hostNamePrefix"] = p.HostNamePrefix - } if p.Features != nil { objectMap["features"] = p.Features } @@ -1164,9 +1179,9 @@ type ResourceSku struct { // // `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' Tier SkuTier `json:"tier,omitempty"` - // Size - Optional string. For future use. + // Size - READ-ONLY; Not used. Retained for future use. Size *string `json:"size,omitempty"` - // Family - Optional string. For future use. + // Family - READ-ONLY; Not used. Retained for future use. Family *string `json:"family,omitempty"` // Capacity - Optional, integer. The unit count of SignalR resource. 1 by default. // @@ -1176,6 +1191,21 @@ type ResourceSku struct { Capacity *int32 `json:"capacity,omitempty"` } +// MarshalJSON is the custom marshaler for ResourceSku. +func (rs ResourceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Tier != "" { + objectMap["tier"] = rs.Tier + } + if rs.Capacity != nil { + objectMap["capacity"] = rs.Capacity + } + return json.Marshal(objectMap) +} + // ResourceType a class represent a SignalR service resource. type ResourceType struct { autorest.Response `json:"-"` diff --git a/services/signalr/mgmt/2021-10-01/signalr/CHANGELOG.md b/services/signalr/mgmt/2021-10-01/signalr/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/signalr/mgmt/2021-10-01/signalr/_meta.json b/services/signalr/mgmt/2021-10-01/signalr/_meta.json new file mode 100644 index 000000000000..520629b4fd37 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1df76adb301b0b1f78375aacd19005f151ef6f72", + "readme": "/_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", + "tag": "package-2021-10-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-10-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/signalr/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/signalr/mgmt/2021-10-01/signalr/client.go b/services/signalr/mgmt/2021-10-01/signalr/client.go new file mode 100644 index 000000000000..67376e10c420 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/client.go @@ -0,0 +1,41 @@ +// Package signalr implements the Azure ARM Signalr service API version 2021-10-01. +// +// REST API for Azure SignalR Service +package signalr + +// 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Signalr + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Signalr. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/enums.go b/services/signalr/mgmt/2021-10-01/signalr/enums.go new file mode 100644 index 000000000000..e95b96856fca --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/enums.go @@ -0,0 +1,248 @@ +package signalr + +// 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. + +// ACLAction enumerates the values for acl action. +type ACLAction string + +const ( + // Allow ... + Allow ACLAction = "Allow" + // Deny ... + Deny ACLAction = "Deny" +) + +// PossibleACLActionValues returns an array of possible values for the ACLAction const type. +func PossibleACLActionValues() []ACLAction { + return []ACLAction{Allow, Deny} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// FeatureFlags enumerates the values for feature flags. +type FeatureFlags string + +const ( + // EnableConnectivityLogs ... + EnableConnectivityLogs FeatureFlags = "EnableConnectivityLogs" + // EnableLiveTrace ... + EnableLiveTrace FeatureFlags = "EnableLiveTrace" + // EnableMessagingLogs ... + EnableMessagingLogs FeatureFlags = "EnableMessagingLogs" + // ServiceMode ... + ServiceMode FeatureFlags = "ServiceMode" +) + +// PossibleFeatureFlagsValues returns an array of possible values for the FeatureFlags const type. +func PossibleFeatureFlagsValues() []FeatureFlags { + return []FeatureFlags{EnableConnectivityLogs, EnableLiveTrace, EnableMessagingLogs, ServiceMode} +} + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // Primary ... + Primary KeyType = "Primary" + // Salt ... + Salt KeyType = "Salt" + // Secondary ... + Secondary KeyType = "Secondary" +) + +// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{Primary, Salt, Secondary} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // None ... + None ManagedIdentityType = "None" + // SystemAssigned ... + SystemAssigned ManagedIdentityType = "SystemAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{None, SystemAssigned, UserAssigned} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // Approved ... + Approved PrivateLinkServiceConnectionStatus = "Approved" + // Disconnected ... + Disconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // Pending ... + Pending PrivateLinkServiceConnectionStatus = "Pending" + // Rejected ... + Rejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{Approved, Disconnected, Pending, Rejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Canceled ... + Canceled ProvisioningState = "Canceled" + // Creating ... + Creating ProvisioningState = "Creating" + // Deleting ... + Deleting ProvisioningState = "Deleting" + // Failed ... + Failed ProvisioningState = "Failed" + // Moving ... + Moving ProvisioningState = "Moving" + // Running ... + Running ProvisioningState = "Running" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" + // Unknown ... + Unknown ProvisioningState = "Unknown" + // Updating ... + Updating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{Canceled, Creating, Deleting, Failed, Moving, Running, Succeeded, Unknown, Updating} +} + +// RequestType enumerates the values for request type. +type RequestType string + +const ( + // ClientConnection ... + ClientConnection RequestType = "ClientConnection" + // RESTAPI ... + RESTAPI RequestType = "RESTAPI" + // ServerConnection ... + ServerConnection RequestType = "ServerConnection" + // Trace ... + Trace RequestType = "Trace" +) + +// PossibleRequestTypeValues returns an array of possible values for the RequestType const type. +func PossibleRequestTypeValues() []RequestType { + return []RequestType{ClientConnection, RESTAPI, ServerConnection, Trace} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ScaleTypeAutomatic ... + ScaleTypeAutomatic ScaleType = "Automatic" + // ScaleTypeManual ... + ScaleTypeManual ScaleType = "Manual" + // ScaleTypeNone ... + ScaleTypeNone ScaleType = "None" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{ScaleTypeAutomatic, ScaleTypeManual, ScaleTypeNone} +} + +// ServiceKind enumerates the values for service kind. +type ServiceKind string + +const ( + // RawWebSockets ... + RawWebSockets ServiceKind = "RawWebSockets" + // SignalR ... + SignalR ServiceKind = "SignalR" +) + +// PossibleServiceKindValues returns an array of possible values for the ServiceKind const type. +func PossibleServiceKindValues() []ServiceKind { + return []ServiceKind{RawWebSockets, SignalR} +} + +// SharedPrivateLinkResourceStatus enumerates the values for shared private link resource status. +type SharedPrivateLinkResourceStatus string + +const ( + // SharedPrivateLinkResourceStatusApproved ... + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + // SharedPrivateLinkResourceStatusDisconnected ... + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + // SharedPrivateLinkResourceStatusPending ... + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + // SharedPrivateLinkResourceStatusRejected ... + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" + // SharedPrivateLinkResourceStatusTimeout ... + SharedPrivateLinkResourceStatusTimeout SharedPrivateLinkResourceStatus = "Timeout" +) + +// PossibleSharedPrivateLinkResourceStatusValues returns an array of possible values for the SharedPrivateLinkResourceStatus const type. +func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { + return []SharedPrivateLinkResourceStatus{SharedPrivateLinkResourceStatusApproved, SharedPrivateLinkResourceStatusDisconnected, SharedPrivateLinkResourceStatusPending, SharedPrivateLinkResourceStatusRejected, SharedPrivateLinkResourceStatusTimeout} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// UpstreamAuthType enumerates the values for upstream auth type. +type UpstreamAuthType string + +const ( + // UpstreamAuthTypeManagedIdentity ... + UpstreamAuthTypeManagedIdentity UpstreamAuthType = "ManagedIdentity" + // UpstreamAuthTypeNone ... + UpstreamAuthTypeNone UpstreamAuthType = "None" +) + +// PossibleUpstreamAuthTypeValues returns an array of possible values for the UpstreamAuthType const type. +func PossibleUpstreamAuthTypeValues() []UpstreamAuthType { + return []UpstreamAuthType{UpstreamAuthTypeManagedIdentity, UpstreamAuthTypeNone} +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/models.go b/services/signalr/mgmt/2021-10-01/signalr/models.go new file mode 100644 index 000000000000..35073743198f --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/models.go @@ -0,0 +1,2404 @@ +package signalr + +// 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/signalr/mgmt/2021-10-01/signalr" + +// CorsSettings cross-Origin Resource Sharing (CORS) settings. +type CorsSettings struct { + // AllowedOrigins - Gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` +} + +// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (ResourceType, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CreateOrUpdateFuture.Result. +func (future *CreateOrUpdateFuture) result(client Client) (rt ResourceType, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.CreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.CreateOrUpdateResponder(rt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.CreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") + } + } + return +} + +// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteFuture.Result. +func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.DeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.DeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Dimension specifications of the Dimension of metrics. +type Dimension struct { + // Name - The public facing name of the dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension. + DisplayName *string `json:"displayName,omitempty"` + // InternalName - Name of the dimension as it appears in MDM. + InternalName *string `json:"internalName,omitempty"` + // ToBeExportedForShoebox - 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 { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Feature feature of a resource, which controls the runtime behavior. +type Feature struct { + // Flag - FeatureFlags is the supported features of Azure SignalR service. + // - ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have your own backend server; "Serverless": your application doesn't have a backend server; "Classic": for backward compatibility. Support both Default and Serverless mode but not recommended; "PredefinedOnly": for future use. + // - EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category respectively. + // - EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category respectively. + // - EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR service, it will give you live traces in real time, it will be helpful when you developing your own Azure SignalR based web application or self-troubleshooting some issues. Please note that live traces are counted as outbound messages that will be charged. Values allowed: "true"/"false", to enable/disable live trace feature. Possible values include: 'ServiceMode', 'EnableConnectivityLogs', 'EnableMessagingLogs', 'EnableLiveTrace' + Flag FeatureFlags `json:"flag,omitempty"` + // Value - Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. + Value *string `json:"value,omitempty"` + // Properties - Optional properties related to this feature. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for Feature. +func (f Feature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if f.Flag != "" { + objectMap["flag"] = f.Flag + } + if f.Value != nil { + objectMap["value"] = f.Value + } + if f.Properties != nil { + objectMap["properties"] = f.Properties + } + return json.Marshal(objectMap) +} + +// Keys a class represents the access keys of the resource. +type Keys struct { + autorest.Response `json:"-"` + // PrimaryKey - The primary access key. + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - The secondary access key. + SecondaryKey *string `json:"secondaryKey,omitempty"` + // PrimaryConnectionString - Connection string constructed via the primaryKey + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + // SecondaryConnectionString - Connection string constructed via the secondaryKey + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` +} + +// LogSpecification specifications of the Logs for Azure Monitoring. +type LogSpecification struct { + // Name - Name of the log. + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the log. + DisplayName *string `json:"displayName,omitempty"` +} + +// ManagedIdentity a class represent managed identities used for request and response +type ManagedIdentity struct { + // Type - Represent the identity type: systemAssigned, userAssigned, None. Possible values include: 'None', 'SystemAssigned', 'UserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - Get or set the user assigned identities + UserAssignedIdentities map[string]*UserAssignedIdentityProperty `json:"userAssignedIdentities"` + // PrincipalID - READ-ONLY; Get the principal id for the system assigned identity. + // Only be used in response. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; Get the tenant id for the system assigned identity. + // Only be used in response + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentity. +func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mi.Type != "" { + objectMap["type"] = mi.Type + } + if mi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedIdentitySettings managed identity settings for upstream. +type ManagedIdentitySettings struct { + // Resource - 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 { + // Name - Name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Localized friendly description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The unit that makes sense for the metric. + Unit *string `json:"unit,omitempty"` + // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + // FillGapWithZero - 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"` + // Category - 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"` + // Dimensions - The dimensions of the metrics. + Dimensions *[]Dimension `json:"dimensions,omitempty"` +} + +// NameAvailability result of the request to check name availability. It contains a flag and possible +// reason of failure. +type NameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - Indicates whether the name is available or not. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - The reason of the availability. Required if name is not available. + Reason *string `json:"reason,omitempty"` + // Message - The message of the operation. + Message *string `json:"message,omitempty"` +} + +// NameAvailabilityParameters data POST-ed to the nameAvailability action +type NameAvailabilityParameters struct { + // Type - The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" + Type *string `json:"type,omitempty"` + // Name - The resource name to validate. e.g."my-resource-name" + Name *string `json:"name,omitempty"` +} + +// NetworkACL network ACL +type NetworkACL struct { + // Allow - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Allow *[]RequestType `json:"allow,omitempty"` + // Deny - Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Deny *[]RequestType `json:"deny,omitempty"` +} + +// NetworkACLs network ACLs for the resource +type NetworkACLs struct { + // DefaultAction - Default action when no other rule matches. Possible values include: 'Allow', 'Deny' + DefaultAction ACLAction `json:"defaultAction,omitempty"` + // PublicNetwork - ACL for requests from public network + PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"` + // PrivateEndpoints - ACLs for requests from private endpoints + PrivateEndpoints *[]PrivateEndpointACL `json:"privateEndpoints,omitempty"` +} + +// Operation REST API operation supported by resource provider. +type Operation struct { + // Name - Name of the operation with format: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // IsDataAction - If the operation is a data action. (for data plane rbac) + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - The object that describes the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - 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"` + // Properties - Extra properties for the operation. + Properties *OperationProperties `json:"properties,omitempty"` +} + +// OperationDisplay the object that describes a operation. +type OperationDisplay struct { + // Provider - Friendly name of the resource provider + Provider *string `json:"provider,omitempty"` + // Resource - Resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - The localized friendly name for the operation. + Operation *string `json:"operation,omitempty"` + // Description - The localized friendly description for the operation + Description *string `json:"description,omitempty"` +} + +// OperationList result of the request to list REST API operations. It contains a list of operations. +type OperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - 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"` +} + +// OperationListIterator provides access to a complete listing of Operation values. +type OperationListIterator struct { + i int + page OperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListIterator) Response() OperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListIterator type. +func NewOperationListIterator(page OperationListPage) OperationListIterator { + return OperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OperationList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// operationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OperationListPage contains a page of Operation values. +type OperationListPage struct { + fn func(context.Context, OperationList) (OperationList, error) + ol OperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListPage) Response() OperationList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListPage) Values() []Operation { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OperationListPage type. +func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { + return OperationListPage{ + fn: getNextPage, + ol: cur, + } +} + +// OperationProperties extra Operation properties. +type OperationProperties struct { + // ServiceSpecification - The service specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PrivateEndpoint private endpoint +type PrivateEndpoint struct { + // ID - Full qualified Id of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointACL ACL for a private endpoint +type PrivateEndpointACL struct { + // Name - Name of the private endpoint connection + Name *string `json:"name,omitempty"` + // Allow - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Allow *[]RequestType `json:"allow,omitempty"` + // Deny - Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + Deny *[]RequestType `json:"deny,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection to an azure resource +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // PrivateEndpointConnectionProperties - Properties of the private endpoint connection + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionList a list of private endpoint connections +type PrivateEndpointConnectionList struct { + autorest.Response `json:"-"` + // Value - The list of the private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - 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"` +} + +// PrivateEndpointConnectionListIterator provides access to a complete listing of PrivateEndpointConnection +// values. +type PrivateEndpointConnectionListIterator struct { + i int + page PrivateEndpointConnectionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionListIterator) Response() PrivateEndpointConnectionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionListIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListIterator type. +func NewPrivateEndpointConnectionListIterator(page PrivateEndpointConnectionListPage) PrivateEndpointConnectionListIterator { + return PrivateEndpointConnectionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pecl PrivateEndpointConnectionList) IsEmpty() bool { + return pecl.Value == nil || len(*pecl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pecl PrivateEndpointConnectionList) hasNextLink() bool { + return pecl.NextLink != nil && len(*pecl.NextLink) != 0 +} + +// privateEndpointConnectionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pecl PrivateEndpointConnectionList) privateEndpointConnectionListPreparer(ctx context.Context) (*http.Request, error) { + if !pecl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pecl.NextLink))) +} + +// PrivateEndpointConnectionListPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListPage struct { + fn func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error) + pecl PrivateEndpointConnectionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pecl) + if err != nil { + return err + } + page.pecl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListPage) NotDone() bool { + return !page.pecl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListPage) Response() PrivateEndpointConnectionList { + return page.pecl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListPage) Values() []PrivateEndpointConnection { + if page.pecl.IsEmpty() { + return nil + } + return *page.pecl.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListPage type. +func NewPrivateEndpointConnectionListPage(cur PrivateEndpointConnectionList, getNextPage func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error)) PrivateEndpointConnectionListPage { + return PrivateEndpointConnectionListPage{ + fn: getNextPage, + pecl: cur, + } +} + +// PrivateEndpointConnectionProperties private endpoint connection properties +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint connection. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - Private endpoint associated with the private endpoint connection + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // GroupIds - READ-ONLY; Group IDs + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - Connection state + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource private link resource +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Properties of a private link resource + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceList contains a list of PrivateLinkResource and a possible link to query more results +type PrivateLinkResourceList struct { + autorest.Response `json:"-"` + // Value - List of PrivateLinkResource + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - 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"` +} + +// PrivateLinkResourceListIterator provides access to a complete listing of PrivateLinkResource values. +type PrivateLinkResourceListIterator struct { + i int + page PrivateLinkResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateLinkResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateLinkResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateLinkResourceListIterator) Response() PrivateLinkResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateLinkResourceListIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourceListIterator type. +func NewPrivateLinkResourceListIterator(page PrivateLinkResourceListPage) PrivateLinkResourceListIterator { + return PrivateLinkResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrl PrivateLinkResourceList) IsEmpty() bool { + return plrl.Value == nil || len(*plrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrl PrivateLinkResourceList) hasNextLink() bool { + return plrl.NextLink != nil && len(*plrl.NextLink) != 0 +} + +// privateLinkResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrl PrivateLinkResourceList) privateLinkResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !plrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plrl.NextLink))) +} + +// PrivateLinkResourceListPage contains a page of PrivateLinkResource values. +type PrivateLinkResourceListPage struct { + fn func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error) + plrl PrivateLinkResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateLinkResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plrl) + if err != nil { + return err + } + page.plrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateLinkResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourceListPage) NotDone() bool { + return !page.plrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourceListPage) Response() PrivateLinkResourceList { + return page.plrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourceListPage) Values() []PrivateLinkResource { + if page.plrl.IsEmpty() { + return nil + } + return *page.plrl.Value +} + +// Creates a new instance of the PrivateLinkResourceListPage type. +func NewPrivateLinkResourceListPage(cur PrivateLinkResourceList, getNextPage func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error)) PrivateLinkResourceListPage { + return PrivateLinkResourceListPage{ + fn: getNextPage, + plrl: cur, + } +} + +// PrivateLinkResourceProperties private link resource properties +type PrivateLinkResourceProperties struct { + // GroupID - Group Id of the private link resource + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - Required members of the private link resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required private DNS zone names + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` + // ShareablePrivateLinkResourceTypes - The list of resources that are onboarded to private link service + ShareablePrivateLinkResourceTypes *[]ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` +} + +// PrivateLinkServiceConnectionState connection state of the private endpoint connection +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// Properties a class that describes the properties of the resource +type Properties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExternalIP - READ-ONLY; The publicly accessible IP of the resource. + ExternalIP *string `json:"externalIP,omitempty"` + // HostName - READ-ONLY; FQDN of the service instance. + HostName *string `json:"hostName,omitempty"` + // PublicPort - READ-ONLY; The publicly accessible port of the resource which is designed for browser/client side usage. + PublicPort *int32 `json:"publicPort,omitempty"` + // ServerPort - READ-ONLY; The publicly accessible port of the resource which is designed for customer server side usage. + ServerPort *int32 `json:"serverPort,omitempty"` + // Version - READ-ONLY; Version of the resource. Probably you need the same or higher version of client SDKs. + Version *string `json:"version,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private endpoint connections to the resource. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // SharedPrivateLinkResources - READ-ONLY; The list of shared private link resources. + SharedPrivateLinkResources *[]SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty"` + // TLS - TLS settings. + TLS *TLSSettings `json:"tls,omitempty"` + // HostNamePrefix - READ-ONLY; Deprecated. + HostNamePrefix *string `json:"hostNamePrefix,omitempty"` + // Features - List of the featureFlags. + // + // FeatureFlags that are not included in the parameters for the update operation will not be modified. + // And the response will only include featureFlags that are explicitly set. + // When a featureFlag is not explicitly set, its globally default value will be used + // But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + Features *[]Feature `json:"features,omitempty"` + // ResourceLogConfiguration - 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"` + // Cors - Cross-Origin Resource Sharing (CORS) settings. + Cors *CorsSettings `json:"cors,omitempty"` + // Upstream - Upstream settings when the service is in server-less mode. + Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"` + // NetworkACLs - Network ACLs + NetworkACLs *NetworkACLs `json:"networkACLs,omitempty"` + // PublicNetworkAccess - 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"` + // DisableLocalAuth - DisableLocalAuth + // Enable or disable local auth with AccessKey + // When set as true, connection with AccessKey=xxx won't work. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // DisableAadAuth - DisableLocalAuth + // Enable or disable aad auth + // When set as true, connection with AuthType=aad won't work. + DisableAadAuth *bool `json:"disableAadAuth,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.TLS != nil { + objectMap["tls"] = p.TLS + } + if p.Features != nil { + objectMap["features"] = p.Features + } + if p.ResourceLogConfiguration != nil { + objectMap["resourceLogConfiguration"] = p.ResourceLogConfiguration + } + if p.Cors != nil { + objectMap["cors"] = p.Cors + } + if p.Upstream != nil { + objectMap["upstream"] = p.Upstream + } + if p.NetworkACLs != nil { + objectMap["networkACLs"] = p.NetworkACLs + } + if p.PublicNetworkAccess != nil { + objectMap["publicNetworkAccess"] = p.PublicNetworkAccess + } + if p.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = p.DisableLocalAuth + } + if p.DisableAadAuth != nil { + objectMap["disableAadAuth"] = p.DisableAadAuth + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegenerateKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (Keys, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegenerateKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RegenerateKeyFuture.Result. +func (future *RegenerateKeyFuture) result(client Client) (kVar Keys, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.RegenerateKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + kVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.RegenerateKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if kVar.Response.Response, err = future.GetResult(sender); err == nil && kVar.Response.Response.StatusCode != http.StatusNoContent { + kVar, err = client.RegenerateKeyResponder(kVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.RegenerateKeyFuture", "Result", kVar.Response.Response, "Failure responding to request") + } + } + return +} + +// RegenerateKeyParameters parameters describes the request to regenerate access keys +type RegenerateKeyParameters struct { + // KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary', 'Salt' + KeyType KeyType `json:"keyType,omitempty"` +} + +// Resource the core properties of ARM resources. +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceList object that includes an array of resources and a possible link for next set. +type ResourceList struct { + autorest.Response `json:"-"` + // Value - List of the resources + Value *[]ResourceType `json:"value,omitempty"` + // NextLink - 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"` +} + +// ResourceListIterator provides access to a complete listing of ResourceType values. +type ResourceListIterator struct { + i int + page ResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceListIterator) Response() ResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceListIterator) Value() ResourceType { + if !iter.page.NotDone() { + return ResourceType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceListIterator type. +func NewResourceListIterator(page ResourceListPage) ResourceListIterator { + return ResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rl ResourceList) IsEmpty() bool { + return rl.Value == nil || len(*rl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rl ResourceList) hasNextLink() bool { + return rl.NextLink != nil && len(*rl.NextLink) != 0 +} + +// resourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rl ResourceList) resourceListPreparer(ctx context.Context) (*http.Request, error) { + if !rl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rl.NextLink))) +} + +// ResourceListPage contains a page of ResourceType values. +type ResourceListPage struct { + fn func(context.Context, ResourceList) (ResourceList, error) + rl ResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rl) + if err != nil { + return err + } + page.rl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceListPage) NotDone() bool { + return !page.rl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceListPage) Response() ResourceList { + return page.rl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceListPage) Values() []ResourceType { + if page.rl.IsEmpty() { + return nil + } + return *page.rl.Value +} + +// Creates a new instance of the ResourceListPage type. +func NewResourceListPage(cur ResourceList, getNextPage func(context.Context, ResourceList) (ResourceList, error)) ResourceListPage { + return ResourceListPage{ + fn: getNextPage, + rl: cur, + } +} + +// ResourceLogCategory resource log category configuration of a Microsoft.SignalRService resource. +type ResourceLogCategory struct { + // Name - Gets or sets the resource log category's name. + // Available values: ConnectivityLogs, MessagingLogs. + // Case insensitive. + Name *string `json:"name,omitempty"` + // Enabled - Indicates whether or the resource log category is enabled. + // Available values: true, false. + // Case insensitive. + Enabled *string `json:"enabled,omitempty"` +} + +// ResourceLogConfiguration resource log configuration of a Microsoft.SignalRService resource. +type ResourceLogConfiguration struct { + // Categories - Gets or sets the list of category configurations. + Categories *[]ResourceLogCategory `json:"categories,omitempty"` +} + +// ResourceSku the billing information of the resource. +type ResourceSku struct { + // Name - The name of the SKU. Required. + // + // Allowed values: Standard_S1, Free_F1 + Name *string `json:"name,omitempty"` + // Tier - Optional tier of this particular SKU. 'Standard' or 'Free'. + // + // `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - READ-ONLY; Not used. Retained for future use. + Size *string `json:"size,omitempty"` + // Family - READ-ONLY; Not used. Retained for future use. + Family *string `json:"family,omitempty"` + // Capacity - 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"` +} + +// MarshalJSON is the custom marshaler for ResourceSku. +func (rs ResourceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Tier != "" { + objectMap["tier"] = rs.Tier + } + if rs.Capacity != nil { + objectMap["capacity"] = rs.Capacity + } + return json.Marshal(objectMap) +} + +// ResourceType a class represent a resource. +type ResourceType struct { + autorest.Response `json:"-"` + // Sku - The billing information of the resource.(e.g. Free, Standard) + Sku *ResourceSku `json:"sku,omitempty"` + // Properties - Settings used to provision or configure the resource + *Properties `json:"properties,omitempty"` + // Kind - The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets' + Kind ServiceKind `json:"kind,omitempty"` + // Identity - The managed identity response + Identity *ManagedIdentity `json:"identity,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Location - The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceType. +func (rt ResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rt.Sku != nil { + objectMap["sku"] = rt.Sku + } + if rt.Properties != nil { + objectMap["properties"] = rt.Properties + } + if rt.Kind != "" { + objectMap["kind"] = rt.Kind + } + if rt.Identity != nil { + objectMap["identity"] = rt.Identity + } + if rt.Location != nil { + objectMap["location"] = rt.Location + } + if rt.Tags != nil { + objectMap["tags"] = rt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceType struct. +func (rt *ResourceType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ResourceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + rt.Sku = &sku + } + case "properties": + if v != nil { + var properties Properties + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + rt.Properties = &properties + } + case "kind": + if v != nil { + var kind ServiceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rt.Kind = kind + } + case "identity": + if v != nil { + var identity ManagedIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + rt.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rt.SystemData = &systemData + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rt.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rt.Type = &typeVar + } + } + } + + return nil +} + +// RestartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RestartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RestartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RestartFuture.Result. +func (future *RestartFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.RestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.RestartFuture") + return + } + ar.Response = future.Response() + return +} + +// ServerlessUpstreamSettings the settings for the Upstream when the service is in server-less mode. +type ServerlessUpstreamSettings struct { + // Templates - Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. + Templates *[]UpstreamTemplate `json:"templates,omitempty"` +} + +// ServiceSpecification an object that describes a specification. +type ServiceSpecification struct { + // MetricSpecifications - Specifications of the Metrics for Azure Monitoring. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` + // LogSpecifications - Specifications of the Logs for Azure Monitoring. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` +} + +// ShareablePrivateLinkResourceProperties describes the properties of a resource type that has been +// onboarded to private link service +type ShareablePrivateLinkResourceProperties struct { + // Description - The description of the resource type that has been onboarded to private link service + Description *string `json:"description,omitempty"` + // GroupID - The resource provider group id for the resource that has been onboarded to private link service + GroupID *string `json:"groupId,omitempty"` + // Type - 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 { + // Name - The name of the resource type that has been onboarded to private link service + Name *string `json:"name,omitempty"` + // Properties - 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 { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // SharedPrivateLinkResourceProperties - Describes the properties of a Shared Private Link Resource + *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SharedPrivateLinkResource. +func (splr SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splr.SharedPrivateLinkResourceProperties != nil { + objectMap["properties"] = splr.SharedPrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SharedPrivateLinkResource struct. +func (splr *SharedPrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + splr.SystemData = &systemData + } + case "properties": + if v != nil { + var sharedPrivateLinkResourceProperties SharedPrivateLinkResourceProperties + err = json.Unmarshal(*v, &sharedPrivateLinkResourceProperties) + if err != nil { + return err + } + splr.SharedPrivateLinkResourceProperties = &sharedPrivateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + splr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + splr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + splr.Type = &typeVar + } + } + } + + return nil +} + +// SharedPrivateLinkResourceList a list of shared private link resources +type SharedPrivateLinkResourceList struct { + autorest.Response `json:"-"` + // Value - The list of the shared private link resources + Value *[]SharedPrivateLinkResource `json:"value,omitempty"` + // NextLink - 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"` +} + +// SharedPrivateLinkResourceListIterator provides access to a complete listing of SharedPrivateLinkResource +// values. +type SharedPrivateLinkResourceListIterator struct { + i int + page SharedPrivateLinkResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SharedPrivateLinkResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SharedPrivateLinkResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SharedPrivateLinkResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SharedPrivateLinkResourceListIterator) Response() SharedPrivateLinkResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SharedPrivateLinkResourceListIterator) Value() SharedPrivateLinkResource { + if !iter.page.NotDone() { + return SharedPrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SharedPrivateLinkResourceListIterator type. +func NewSharedPrivateLinkResourceListIterator(page SharedPrivateLinkResourceListPage) SharedPrivateLinkResourceListIterator { + return SharedPrivateLinkResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (splrl SharedPrivateLinkResourceList) IsEmpty() bool { + return splrl.Value == nil || len(*splrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (splrl SharedPrivateLinkResourceList) hasNextLink() bool { + return splrl.NextLink != nil && len(*splrl.NextLink) != 0 +} + +// sharedPrivateLinkResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (splrl SharedPrivateLinkResourceList) sharedPrivateLinkResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !splrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(splrl.NextLink))) +} + +// SharedPrivateLinkResourceListPage contains a page of SharedPrivateLinkResource values. +type SharedPrivateLinkResourceListPage struct { + fn func(context.Context, SharedPrivateLinkResourceList) (SharedPrivateLinkResourceList, error) + splrl SharedPrivateLinkResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SharedPrivateLinkResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.splrl) + if err != nil { + return err + } + page.splrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SharedPrivateLinkResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SharedPrivateLinkResourceListPage) NotDone() bool { + return !page.splrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SharedPrivateLinkResourceListPage) Response() SharedPrivateLinkResourceList { + return page.splrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SharedPrivateLinkResourceListPage) Values() []SharedPrivateLinkResource { + if page.splrl.IsEmpty() { + return nil + } + return *page.splrl.Value +} + +// Creates a new instance of the SharedPrivateLinkResourceListPage type. +func NewSharedPrivateLinkResourceListPage(cur SharedPrivateLinkResourceList, getNextPage func(context.Context, SharedPrivateLinkResourceList) (SharedPrivateLinkResourceList, error)) SharedPrivateLinkResourceListPage { + return SharedPrivateLinkResourceListPage{ + fn: getNextPage, + splrl: cur, + } +} + +// SharedPrivateLinkResourceProperties describes the properties of an existing Shared Private Link Resource +type SharedPrivateLinkResourceProperties struct { + // GroupID - The group id from the provider of resource the shared private link resource is for + GroupID *string `json:"groupId,omitempty"` + // PrivateLinkResourceID - The resource id of the resource the shared private link resource is for + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the shared private link resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // RequestMessage - The request message for requesting approval of the shared private link resource + RequestMessage *string `json:"requestMessage,omitempty"` + // Status - READ-ONLY; Status of the shared private link resource. Possible values include: 'SharedPrivateLinkResourceStatusPending', 'SharedPrivateLinkResourceStatusApproved', 'SharedPrivateLinkResourceStatusRejected', 'SharedPrivateLinkResourceStatusDisconnected', 'SharedPrivateLinkResourceStatusTimeout' + Status SharedPrivateLinkResourceStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for SharedPrivateLinkResourceProperties. +func (splrp SharedPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splrp.GroupID != nil { + objectMap["groupId"] = splrp.GroupID + } + if splrp.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = splrp.PrivateLinkResourceID + } + if splrp.RequestMessage != nil { + objectMap["requestMessage"] = splrp.RequestMessage + } + return json.Marshal(objectMap) +} + +// SharedPrivateLinkResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type SharedPrivateLinkResourcesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharedPrivateLinkResourcesClient) (SharedPrivateLinkResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SharedPrivateLinkResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SharedPrivateLinkResourcesCreateOrUpdateFuture.Result. +func (future *SharedPrivateLinkResourcesCreateOrUpdateFuture) result(client SharedPrivateLinkResourcesClient) (splr SharedPrivateLinkResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + splr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if splr.Response.Response, err = future.GetResult(sender); err == nil && splr.Response.Response.StatusCode != http.StatusNoContent { + splr, err = client.CreateOrUpdateResponder(splr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture", "Result", splr.Response.Response, "Failure responding to request") + } + } + return +} + +// SharedPrivateLinkResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SharedPrivateLinkResourcesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharedPrivateLinkResourcesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SharedPrivateLinkResourcesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SharedPrivateLinkResourcesDeleteFuture.Result. +func (future *SharedPrivateLinkResourcesDeleteFuture) result(client SharedPrivateLinkResourcesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.SharedPrivateLinkResourcesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Sku describes an available sku." +type Sku struct { + // ResourceType - READ-ONLY; The resource type that this object applies to + ResourceType *string `json:"resourceType,omitempty"` + // Sku - READ-ONLY; The exact set of keys that define this sku. + Sku *ResourceSku `json:"sku,omitempty"` + // Capacity - READ-ONLY; Specifies the unit of the resource. + Capacity *SkuCapacity `json:"capacity,omitempty"` +} + +// MarshalJSON is the custom marshaler for Sku. +func (s Sku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuCapacity describes scaling information of a sku. +type SkuCapacity struct { + // Minimum - READ-ONLY; The lowest permitted capacity for this resource + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - READ-ONLY; The highest permitted capacity for this resource + Maximum *int32 `json:"maximum,omitempty"` + // Default - READ-ONLY; The default capacity. + Default *int32 `json:"default,omitempty"` + // AllowedValues - READ-ONLY; Allows capacity value list. + AllowedValues *[]int32 `json:"allowedValues,omitempty"` + // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'ScaleTypeNone', 'ScaleTypeManual', 'ScaleTypeAutomatic' + ScaleType ScaleType `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuCapacity. +func (sc SkuCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuList the list skus operation response +type SkuList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of skus available for the resource. + Value *[]Sku `json:"value,omitempty"` + // NextLink - 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"` +} + +// MarshalJSON is the custom marshaler for SkuList. +func (sl SkuList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TLSSettings TLS settings for the resource +type TLSSettings struct { + // ClientCertEnabled - Request client certificate during TLS handshake if enabled + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (ResourceType, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *UpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for UpdateFuture.Result. +func (future *UpdateFuture) result(client Client) (rt ResourceType, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("signalr.UpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.UpdateResponder(rt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UpdateFuture", "Result", rt.Response.Response, "Failure responding to request") + } + } + return +} + +// UpstreamAuthSettings upstream auth settings. +type UpstreamAuthSettings struct { + // Type - Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible values include: 'UpstreamAuthTypeNone', 'UpstreamAuthTypeManagedIdentity' + Type UpstreamAuthType `json:"type,omitempty"` + // ManagedIdentity - Gets or sets the managed identity settings. It's required if the auth type is set to ManagedIdentity. + ManagedIdentity *ManagedIdentitySettings `json:"managedIdentity,omitempty"` +} + +// UpstreamTemplate upstream template item settings. It defines the Upstream URL of the incoming requests. +// The template defines the pattern of the event, the hub or the category of the incoming request that +// matches current URL template. +type UpstreamTemplate struct { + // HubPattern - Gets or sets the matching pattern for hub names. If not set, it matches any hub. + // There are 3 kind of patterns supported: + // 1. "*", it to matches any hub name + // 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" + // 3. The single hub name, for example, "hub1", it matches "hub1" + HubPattern *string `json:"hubPattern,omitempty"` + // EventPattern - Gets or sets the matching pattern for event names. If not set, it matches any event. + // There are 3 kind of patterns supported: + // 1. "*", it to matches any event name + // 2. Combine multiple events with ",", for example "connect,disconnect", it matches event "connect" and "disconnect" + // 3. The single event name, for example, "connect", it matches "connect" + EventPattern *string `json:"eventPattern,omitempty"` + // CategoryPattern - Gets or sets the matching pattern for category names. If not set, it matches any category. + // There are 3 kind of patterns supported: + // 1. "*", it to matches any category name + // 2. Combine multiple categories with ",", for example "connections,messages", it matches category "connections" and "messages" + // 3. The single category name, for example, "connections", it matches the category "connections" + CategoryPattern *string `json:"categoryPattern,omitempty"` + // URLTemplate - Gets or sets the Upstream URL template. You can use 3 predefined parameters {hub}, {category} {event} inside the template, the value of the Upstream URL is dynamically calculated when the client request comes in. + // For example, if the urlTemplate is `http://example.com/{hub}/api/{event}`, with a client request from hub `chat` connects, it will first POST to this URL: `http://example.com/chat/api/connect`. + URLTemplate *string `json:"urlTemplate,omitempty"` + // Auth - Gets or sets the auth settings for an upstream. If not set, no auth is used for upstream messages. + Auth *UpstreamAuthSettings `json:"auth,omitempty"` +} + +// Usage object that describes a specific usage of the resources. +type Usage struct { + // ID - Fully qualified ARM resource id + ID *string `json:"id,omitempty"` + // CurrentValue - Current value for the usage quota. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The maximum permitted value for the usage quota. If there is no limit, this value will be -1. + Limit *int64 `json:"limit,omitempty"` + // Name - Localizable String object containing the name and a localized value. + Name *UsageName `json:"name,omitempty"` + // Unit - Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + Unit *string `json:"unit,omitempty"` +} + +// UsageList object that includes an array of the resource usages and a possible link for next set. +type UsageList struct { + autorest.Response `json:"-"` + // Value - List of the resource usages + Value *[]Usage `json:"value,omitempty"` + // NextLink - 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"` +} + +// UsageListIterator provides access to a complete listing of Usage values. +type UsageListIterator struct { + i int + page UsageListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsageListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsageListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsageListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsageListIterator) Response() UsageList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsageListIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsageListIterator type. +func NewUsageListIterator(page UsageListPage) UsageListIterator { + return UsageListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ul UsageList) IsEmpty() bool { + return ul.Value == nil || len(*ul.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ul UsageList) hasNextLink() bool { + return ul.NextLink != nil && len(*ul.NextLink) != 0 +} + +// usageListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ul UsageList) usageListPreparer(ctx context.Context) (*http.Request, error) { + if !ul.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ul.NextLink))) +} + +// UsageListPage contains a page of Usage values. +type UsageListPage struct { + fn func(context.Context, UsageList) (UsageList, error) + ul UsageList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsageListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ul) + if err != nil { + return err + } + page.ul = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsageListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsageListPage) NotDone() bool { + return !page.ul.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsageListPage) Response() UsageList { + return page.ul +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsageListPage) Values() []Usage { + if page.ul.IsEmpty() { + return nil + } + return *page.ul.Value +} + +// Creates a new instance of the UsageListPage type. +func NewUsageListPage(cur UsageList, getNextPage func(context.Context, UsageList) (UsageList, error)) UsageListPage { + return UsageListPage{ + fn: getNextPage, + ul: cur, + } +} + +// UsageName localizable String object containing the name and a localized value. +type UsageName struct { + // Value - The identifier of the usage. + Value *string `json:"value,omitempty"` + // LocalizedValue - Localized name of the usage. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UserAssignedIdentityProperty properties of user assigned identity. +type UserAssignedIdentityProperty struct { + // PrincipalID - READ-ONLY; Get the principal id for the user assigned identity + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; Get the client id for the user assigned identity + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentityProperty. +func (uaip UserAssignedIdentityProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/operations.go b/services/signalr/mgmt/2021-10-01/signalr/operations.go new file mode 100644 index 000000000000..a539fedc904e --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/operations.go @@ -0,0 +1,140 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the REST API for Azure SignalR Service +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.SignalRService provider. +func (client OperationsClient) List(ctx context.Context) (result OperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.SignalRService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationList) (result OperationList, err error) { + req, err := lastResults.operationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/privateendpointconnections.go b/services/signalr/mgmt/2021-10-01/signalr/privateendpointconnections.go new file mode 100644 index 000000000000..e88800961845 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/privateendpointconnections.go @@ -0,0 +1,394 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the REST API for Azure SignalR Service +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete the specified private endpoint connection +// Parameters: +// privateEndpointConnectionName - the name of the private endpoint connection +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, privateEndpointConnectionName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified private endpoint connection +// Parameters: +// privateEndpointConnectionName - the name of the private endpoint connection +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, privateEndpointConnectionName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private endpoint connections +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.pecl.Response.Response != nil { + sc = result.pecl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pecl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.pecl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.pecl.hasNextLink() && result.pecl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionList) (result PrivateEndpointConnectionList, err error) { + req, err := lastResults.privateEndpointConnectionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// Update update the state of specified private endpoint connection +// Parameters: +// privateEndpointConnectionName - the name of the private endpoint connection +// parameters - the resource of private endpoint and its properties +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, privateEndpointConnectionName string, parameters PrivateEndpointConnection, resourceGroupName string, resourceName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, privateEndpointConnectionName, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, privateEndpointConnectionName string, parameters PrivateEndpointConnection, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/privatelinkresources.go b/services/signalr/mgmt/2021-10-01/signalr/privatelinkresources.go new file mode 100644 index 000000000000..ef26b45c2871 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/privatelinkresources.go @@ -0,0 +1,151 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the REST API for Azure SignalR Service +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get the private link resources that need to be created for a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.plrl.Response.Response != nil { + sc = result.plrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.plrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.plrl.hasNextLink() && result.plrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourceList) (result PrivateLinkResourceList, err error) { + req, err := lastResults.privateLinkResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/sharedprivatelinkresources.go b/services/signalr/mgmt/2021-10-01/signalr/sharedprivatelinkresources.go new file mode 100644 index 000000000000..91165bd7c286 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/sharedprivatelinkresources.go @@ -0,0 +1,407 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SharedPrivateLinkResourcesClient is the REST API for Azure SignalR Service +type SharedPrivateLinkResourcesClient struct { + BaseClient +} + +// NewSharedPrivateLinkResourcesClient creates an instance of the SharedPrivateLinkResourcesClient client. +func NewSharedPrivateLinkResourcesClient(subscriptionID string) SharedPrivateLinkResourcesClient { + return NewSharedPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSharedPrivateLinkResourcesClientWithBaseURI creates an instance of the SharedPrivateLinkResourcesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewSharedPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) SharedPrivateLinkResourcesClient { + return SharedPrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a shared private link resource +// Parameters: +// sharedPrivateLinkResourceName - the name of the shared private link resource +// parameters - the shared private link resource +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourcesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedPrivateLinkResourceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedPrivateLinkResourceProperties.GroupID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.SharedPrivateLinkResourceProperties.PrivateLinkResourceID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("signalr.SharedPrivateLinkResourcesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, sharedPrivateLinkResourceName, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdatePreparer(ctx context.Context, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "sharedPrivateLinkResourceName": autorest.Encode("path", sharedPrivateLinkResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdateSender(req *http.Request) (future SharedPrivateLinkResourcesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) CreateOrUpdateResponder(resp *http.Response) (result SharedPrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified shared private link resource +// Parameters: +// sharedPrivateLinkResourceName - the name of the shared private link resource +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) Delete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourcesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SharedPrivateLinkResourcesClient) DeletePreparer(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "sharedPrivateLinkResourceName": autorest.Encode("path", sharedPrivateLinkResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) DeleteSender(req *http.Request) (future SharedPrivateLinkResourcesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified shared private link resource +// Parameters: +// sharedPrivateLinkResourceName - the name of the shared private link resource +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result SharedPrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SharedPrivateLinkResourcesClient) GetPreparer(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "sharedPrivateLinkResourceName": autorest.Encode("path", sharedPrivateLinkResourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) GetResponder(resp *http.Response) (result SharedPrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list shared private link resources +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client SharedPrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.splrl.Response.Response != nil { + sc = result.splrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.splrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.splrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.splrl.hasNextLink() && result.splrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SharedPrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SharedPrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SharedPrivateLinkResourcesClient) ListResponder(resp *http.Response) (result SharedPrivateLinkResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SharedPrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults SharedPrivateLinkResourceList) (result SharedPrivateLinkResourceList, err error) { + req, err := lastResults.sharedPrivateLinkResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SharedPrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SharedPrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SharedPrivateLinkResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/signalr.go b/services/signalr/mgmt/2021-10-01/signalr/signalr.go new file mode 100644 index 000000000000..3b0af7f67df2 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/signalr.go @@ -0,0 +1,994 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// Client is the REST API for Azure SignalR Service +type Client struct { + BaseClient +} + +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the resource name is valid and is not already in use. +// Parameters: +// location - the region +// parameters - parameters supplied to the operation. +func (client Client) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityParameters) (result NameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("signalr.Client", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, location string, parameters NameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a resource. +// Parameters: +// parameters - parameters for the create or update operation +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) CreateOrUpdate(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (result CreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("signalr.Client", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client Client) CreateOrUpdatePreparer(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client Client) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result DeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the resource and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ResourceType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup handles requests to list all resources in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ResourceList) (result ResourceList, err error) { + req, err := lastResults.resourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription handles requests to list all resources in a subscription. +func (client Client) ListBySubscription(ctx context.Context) (result ResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListBySubscription", resp, "Failure sending request") + return + } + + result.rl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client Client) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client Client) ListBySubscriptionResponder(resp *http.Response) (result ResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client Client) listBySubscriptionNextResults(ctx context.Context, lastResults ResourceList) (result ResourceList, err error) { + req, err := lastResults.resourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.Client", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.Client", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListBySubscriptionComplete(ctx context.Context) (result ResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListKeys get the access keys of the resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) ListKeys(ctx context.Context, resourceGroupName string, resourceName string) (result Keys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListKeysPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client Client) ListKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client Client) ListKeysResponder(resp *http.Response) (result Keys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkus list all available skus of the resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) ListSkus(ctx context.Context, resourceGroupName string, resourceName string) (result SkuList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.Client", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "ListSkus", resp, "Failure responding to request") + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client Client) ListSkusPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client Client) ListSkusResponder(resp *http.Response) (result SkuList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the +// same time. +// Parameters: +// parameters - parameter that describes the Regenerate Key Operation. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) RegenerateKey(ctx context.Context, parameters RegenerateKeyParameters, resourceGroupName string, resourceName string) (result RegenerateKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.RegenerateKey") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegenerateKeyPreparer(ctx, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "RegenerateKey", nil, "Failure preparing request") + return + } + + result, err = client.RegenerateKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "RegenerateKey", result.Response(), "Failure sending request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client Client) RegenerateKeyPreparer(ctx context.Context, parameters RegenerateKeyParameters, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client Client) RegenerateKeySender(req *http.Request) (future RegenerateKeyFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client Client) RegenerateKeyResponder(resp *http.Response) (result Keys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Restart operation to restart a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Restart(ctx context.Context, resourceGroupName string, resourceName string) (result RestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Restart") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client Client) RestartPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client Client) RestartSender(req *http.Request) (future RestartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client Client) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update operation to update an exiting resource. +// Parameters: +// parameters - parameters for the update operation +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// resourceName - the name of the resource. +func (client Client) Update(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (result UpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, parameters, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.Client", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client Client) UpdatePreparer(ctx context.Context, parameters ResourceType, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client Client) UpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/signalrapi/interfaces.go b/services/signalr/mgmt/2021-10-01/signalr/signalrapi/interfaces.go new file mode 100644 index 000000000000..199d9e5c7b41 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/signalrapi/interfaces.go @@ -0,0 +1,77 @@ +package signalrapi + +// 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/signalr/mgmt/2021-10-01/signalr" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result signalr.OperationListPage, err error) + ListComplete(ctx context.Context) (result signalr.OperationListIterator, err error) +} + +var _ OperationsClientAPI = (*signalr.OperationsClient)(nil) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + CheckNameAvailability(ctx context.Context, location string, parameters signalr.NameAvailabilityParameters) (result signalr.NameAvailability, err error) + CreateOrUpdate(ctx context.Context, parameters signalr.ResourceType, resourceGroupName string, resourceName string) (result signalr.CreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.DeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.ResourceType, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result signalr.ResourceListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result signalr.ResourceListIterator, err error) + ListBySubscription(ctx context.Context) (result signalr.ResourceListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result signalr.ResourceListIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.Keys, err error) + ListSkus(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.SkuList, err error) + RegenerateKey(ctx context.Context, parameters signalr.RegenerateKeyParameters, resourceGroupName string, resourceName string) (result signalr.RegenerateKeyFuture, err error) + Restart(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.RestartFuture, err error) + Update(ctx context.Context, parameters signalr.ResourceType, resourceGroupName string, resourceName string) (result signalr.UpdateFuture, err error) +} + +var _ ClientAPI = (*signalr.Client)(nil) + +// UsagesClientAPI contains the set of methods on the UsagesClient type. +type UsagesClientAPI interface { + List(ctx context.Context, location string) (result signalr.UsageListPage, err error) + ListComplete(ctx context.Context, location string) (result signalr.UsageListIterator, err error) +} + +var _ UsagesClientAPI = (*signalr.UsagesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnectionListIterator, err error) + Update(ctx context.Context, privateEndpointConnectionName string, parameters signalr.PrivateEndpointConnection, resourceGroupName string, resourceName string) (result signalr.PrivateEndpointConnection, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*signalr.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateLinkResourceListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.PrivateLinkResourceListIterator, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*signalr.PrivateLinkResourcesClient)(nil) + +// SharedPrivateLinkResourcesClientAPI contains the set of methods on the SharedPrivateLinkResourcesClient type. +type SharedPrivateLinkResourcesClientAPI interface { + CreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, parameters signalr.SharedPrivateLinkResource, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourcesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourcesDeleteFuture, err error) + Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResource, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourceListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result signalr.SharedPrivateLinkResourceListIterator, err error) +} + +var _ SharedPrivateLinkResourcesClientAPI = (*signalr.SharedPrivateLinkResourcesClient)(nil) diff --git a/services/signalr/mgmt/2021-10-01/signalr/usages.go b/services/signalr/mgmt/2021-10-01/signalr/usages.go new file mode 100644 index 000000000000..1b0ad4948ef7 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/usages.go @@ -0,0 +1,147 @@ +package signalr + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsagesClient is the REST API for Azure SignalR Service +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list resource usage quotas by location. +// Parameters: +// location - the location like "eastus" +func (client UsagesClient) List(ctx context.Context, location string) (result UsageListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.ul.Response.Response != nil { + sc = result.ul.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ul.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.ul, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "List", resp, "Failure responding to request") + return + } + if result.ul.hasNextLink() && result.ul.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result UsageList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesClient) listNextResults(ctx context.Context, lastResults UsageList) (result UsageList, err error) { + req, err := lastResults.usageListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "signalr.UsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "signalr.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, location string) (result UsageListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/signalr/mgmt/2021-10-01/signalr/version.go b/services/signalr/mgmt/2021-10-01/signalr/version.go new file mode 100644 index 000000000000..b1fdec172211 --- /dev/null +++ b/services/signalr/mgmt/2021-10-01/signalr/version.go @@ -0,0 +1,19 @@ +package signalr + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " signalr/2021-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}