1package signalr
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/to"
26	"github.com/Azure/go-autorest/tracing"
27	"net/http"
28)
29
30// The package's fully qualified name.
31const fqdn = "github.com/Azure/azure-sdk-for-go/services/signalr/mgmt/2020-05-01/signalr"
32
33// CorsSettings cross-Origin Resource Sharing (CORS) settings.
34type CorsSettings struct {
35	// 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.
36	AllowedOrigins *[]string `json:"allowedOrigins,omitempty"`
37}
38
39// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
40// operation.
41type CreateOrUpdateFuture struct {
42	azure.FutureAPI
43	// Result returns the result of the asynchronous operation.
44	// If the operation has not completed it will return an error.
45	Result func(Client) (ResourceType, error)
46}
47
48// CreateOrUpdateProperties settings used to provision or configure the resource.
49type CreateOrUpdateProperties struct {
50	// HostNamePrefix - Prefix for the hostName of the SignalR service. Retained for future use.
51	// The hostname will be of format: <hostNamePrefix>.service.signalr.net.
52	HostNamePrefix *string `json:"hostNamePrefix,omitempty"`
53	// Features - List of SignalR featureFlags. e.g. ServiceMode.
54	//
55	// FeatureFlags that are not included in the parameters for the update operation will not be modified.
56	// And the response will only include featureFlags that are explicitly set.
57	// When a featureFlag is not explicitly set, SignalR service will use its globally default value.
58	// But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags.
59	Features *[]Feature `json:"features,omitempty"`
60	// Cors - Cross-Origin Resource Sharing (CORS) settings.
61	Cors *CorsSettings `json:"cors,omitempty"`
62	// Upstream - Upstream settings when the Azure SignalR is in server-less mode.
63	Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"`
64	// NetworkACLs - Network ACLs
65	NetworkACLs *NetworkACLs `json:"networkACLs,omitempty"`
66}
67
68// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
69type DeleteFuture struct {
70	azure.FutureAPI
71	// Result returns the result of the asynchronous operation.
72	// If the operation has not completed it will return an error.
73	Result func(Client) (autorest.Response, error)
74}
75
76// Dimension specifications of the Dimension of metrics.
77type Dimension struct {
78	// Name - The public facing name of the dimension.
79	Name *string `json:"name,omitempty"`
80	// DisplayName - Localized friendly display name of the dimension.
81	DisplayName *string `json:"displayName,omitempty"`
82	// InternalName - Name of the dimension as it appears in MDM.
83	InternalName *string `json:"internalName,omitempty"`
84	// ToBeExportedForShoebox - A Boolean flag indicating whether this dimension should be included for the shoebox export scenario.
85	ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"`
86}
87
88// ErrorResponse contains information about an API error.
89type ErrorResponse struct {
90	// Error - Describes a particular API error with an error code and a message.
91	Error *ErrorResponseBody `json:"error,omitempty"`
92}
93
94// ErrorResponseBody describes a particular API error with an error code and a message.
95type ErrorResponseBody struct {
96	// Code - An error code that describes the error condition more precisely than an HTTP status code.
97	// Can be used to programmatically handle specific error cases.
98	Code *string `json:"code,omitempty"`
99	// Message - A message that describes the error in detail and provides debugging information.
100	Message *string `json:"message,omitempty"`
101	// Target - The target of the particular error (for example, the name of the property in error).
102	Target *string `json:"target,omitempty"`
103	// Details - Contains nested errors that are related to this error.
104	Details *[]ErrorResponseBody `json:"details,omitempty"`
105}
106
107// Feature feature of a SignalR resource, which controls the SignalR runtime behavior.
108type Feature struct {
109	// Flag - FeatureFlags is the supported features of Azure SignalR service.
110	// - 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.
111	// - EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category respectively. Possible values include: 'ServiceMode', 'EnableConnectivityLogs', 'EnableMessagingLogs'
112	Flag FeatureFlags `json:"flag,omitempty"`
113	// Value - Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values.
114	Value *string `json:"value,omitempty"`
115	// Properties - Optional properties related to this feature.
116	Properties map[string]*string `json:"properties"`
117}
118
119// MarshalJSON is the custom marshaler for Feature.
120func (f Feature) MarshalJSON() ([]byte, error) {
121	objectMap := make(map[string]interface{})
122	if f.Flag != "" {
123		objectMap["flag"] = f.Flag
124	}
125	if f.Value != nil {
126		objectMap["value"] = f.Value
127	}
128	if f.Properties != nil {
129		objectMap["properties"] = f.Properties
130	}
131	return json.Marshal(objectMap)
132}
133
134// Keys a class represents the access keys of SignalR service.
135type Keys struct {
136	autorest.Response `json:"-"`
137	// PrimaryKey - The primary access key.
138	PrimaryKey *string `json:"primaryKey,omitempty"`
139	// SecondaryKey - The secondary access key.
140	SecondaryKey *string `json:"secondaryKey,omitempty"`
141	// PrimaryConnectionString - SignalR connection string constructed via the primaryKey
142	PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"`
143	// SecondaryConnectionString - SignalR connection string constructed via the secondaryKey
144	SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"`
145}
146
147// LogSpecification specifications of the Logs for Azure Monitoring.
148type LogSpecification struct {
149	// Name - Name of the log.
150	Name *string `json:"name,omitempty"`
151	// DisplayName - Localized friendly display name of the log.
152	DisplayName *string `json:"displayName,omitempty"`
153}
154
155// MetricSpecification specifications of the Metrics for Azure Monitoring.
156type MetricSpecification struct {
157	// Name - Name of the metric.
158	Name *string `json:"name,omitempty"`
159	// DisplayName - Localized friendly display name of the metric.
160	DisplayName *string `json:"displayName,omitempty"`
161	// DisplayDescription - Localized friendly description of the metric.
162	DisplayDescription *string `json:"displayDescription,omitempty"`
163	// Unit - The unit that makes sense for the metric.
164	Unit *string `json:"unit,omitempty"`
165	// AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count.
166	AggregationType *string `json:"aggregationType,omitempty"`
167	// FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published.
168	// Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear
169	// often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted.
170	FillGapWithZero *string `json:"fillGapWithZero,omitempty"`
171	// Category - The name of the metric category that the metric belongs to. A metric can only belong to a single category.
172	Category *string `json:"category,omitempty"`
173	// Dimensions - The dimensions of the metrics.
174	Dimensions *[]Dimension `json:"dimensions,omitempty"`
175}
176
177// NameAvailability result of the request to check name availability. It contains a flag and possible
178// reason of failure.
179type NameAvailability struct {
180	autorest.Response `json:"-"`
181	// NameAvailable - Indicates whether the name is available or not.
182	NameAvailable *bool `json:"nameAvailable,omitempty"`
183	// Reason - The reason of the availability. Required if name is not available.
184	Reason *string `json:"reason,omitempty"`
185	// Message - The message of the operation.
186	Message *string `json:"message,omitempty"`
187}
188
189// NameAvailabilityParameters data POST-ed to the nameAvailability action
190type NameAvailabilityParameters struct {
191	// Type - The resource type. Should be always "Microsoft.SignalRService/SignalR".
192	Type *string `json:"type,omitempty"`
193	// Name - The SignalR service name to validate. e.g."my-signalR-name-here"
194	Name *string `json:"name,omitempty"`
195}
196
197// NetworkACL network ACL
198type NetworkACL struct {
199	// Allow - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI.
200	Allow *[]RequestType `json:"allow,omitempty"`
201	// Deny - Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI.
202	Deny *[]RequestType `json:"deny,omitempty"`
203}
204
205// NetworkACLs network ACLs for SignalR
206type NetworkACLs struct {
207	// DefaultAction - Default action when no other rule matches. Possible values include: 'Allow', 'Deny'
208	DefaultAction ACLAction `json:"defaultAction,omitempty"`
209	// PublicNetwork - ACL for requests from public network
210	PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"`
211	// PrivateEndpoints - ACLs for requests from private endpoints
212	PrivateEndpoints *[]PrivateEndpointACL `json:"privateEndpoints,omitempty"`
213}
214
215// Operation REST API operation supported by SignalR resource provider.
216type Operation struct {
217	// Name - Name of the operation with format: {provider}/{resource}/{operation}
218	Name *string `json:"name,omitempty"`
219	// IsDataAction - If the operation is a data action. (for data plane rbac)
220	IsDataAction *bool `json:"isDataAction,omitempty"`
221	// Display - The object that describes the operation.
222	Display *OperationDisplay `json:"display,omitempty"`
223	// Origin - Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX.
224	Origin *string `json:"origin,omitempty"`
225	// Properties - Extra properties for the operation.
226	Properties *OperationProperties `json:"properties,omitempty"`
227}
228
229// OperationDisplay the object that describes a operation.
230type OperationDisplay struct {
231	// Provider - Friendly name of the resource provider
232	Provider *string `json:"provider,omitempty"`
233	// Resource - Resource type on which the operation is performed.
234	Resource *string `json:"resource,omitempty"`
235	// Operation - The localized friendly name for the operation.
236	Operation *string `json:"operation,omitempty"`
237	// Description - The localized friendly description for the operation
238	Description *string `json:"description,omitempty"`
239}
240
241// OperationList result of the request to list REST API operations. It contains a list of operations.
242type OperationList struct {
243	autorest.Response `json:"-"`
244	// Value - List of operations supported by the resource provider.
245	Value *[]Operation `json:"value,omitempty"`
246	// NextLink - The URL the client should use to fetch the next page (per server side paging).
247	// It's null for now, added for future use.
248	NextLink *string `json:"nextLink,omitempty"`
249}
250
251// OperationListIterator provides access to a complete listing of Operation values.
252type OperationListIterator struct {
253	i    int
254	page OperationListPage
255}
256
257// NextWithContext advances to the next value.  If there was an error making
258// the request the iterator does not advance and the error is returned.
259func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) {
260	if tracing.IsEnabled() {
261		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext")
262		defer func() {
263			sc := -1
264			if iter.Response().Response.Response != nil {
265				sc = iter.Response().Response.Response.StatusCode
266			}
267			tracing.EndSpan(ctx, sc, err)
268		}()
269	}
270	iter.i++
271	if iter.i < len(iter.page.Values()) {
272		return nil
273	}
274	err = iter.page.NextWithContext(ctx)
275	if err != nil {
276		iter.i--
277		return err
278	}
279	iter.i = 0
280	return nil
281}
282
283// Next advances to the next value.  If there was an error making
284// the request the iterator does not advance and the error is returned.
285// Deprecated: Use NextWithContext() instead.
286func (iter *OperationListIterator) Next() error {
287	return iter.NextWithContext(context.Background())
288}
289
290// NotDone returns true if the enumeration should be started or is not yet complete.
291func (iter OperationListIterator) NotDone() bool {
292	return iter.page.NotDone() && iter.i < len(iter.page.Values())
293}
294
295// Response returns the raw server response from the last page request.
296func (iter OperationListIterator) Response() OperationList {
297	return iter.page.Response()
298}
299
300// Value returns the current value or a zero-initialized value if the
301// iterator has advanced beyond the end of the collection.
302func (iter OperationListIterator) Value() Operation {
303	if !iter.page.NotDone() {
304		return Operation{}
305	}
306	return iter.page.Values()[iter.i]
307}
308
309// Creates a new instance of the OperationListIterator type.
310func NewOperationListIterator(page OperationListPage) OperationListIterator {
311	return OperationListIterator{page: page}
312}
313
314// IsEmpty returns true if the ListResult contains no values.
315func (ol OperationList) IsEmpty() bool {
316	return ol.Value == nil || len(*ol.Value) == 0
317}
318
319// hasNextLink returns true if the NextLink is not empty.
320func (ol OperationList) hasNextLink() bool {
321	return ol.NextLink != nil && len(*ol.NextLink) != 0
322}
323
324// operationListPreparer prepares a request to retrieve the next set of results.
325// It returns nil if no more results exist.
326func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {
327	if !ol.hasNextLink() {
328		return nil, nil
329	}
330	return autorest.Prepare((&http.Request{}).WithContext(ctx),
331		autorest.AsJSON(),
332		autorest.AsGet(),
333		autorest.WithBaseURL(to.String(ol.NextLink)))
334}
335
336// OperationListPage contains a page of Operation values.
337type OperationListPage struct {
338	fn func(context.Context, OperationList) (OperationList, error)
339	ol OperationList
340}
341
342// NextWithContext advances to the next page of values.  If there was an error making
343// the request the page does not advance and the error is returned.
344func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) {
345	if tracing.IsEnabled() {
346		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext")
347		defer func() {
348			sc := -1
349			if page.Response().Response.Response != nil {
350				sc = page.Response().Response.Response.StatusCode
351			}
352			tracing.EndSpan(ctx, sc, err)
353		}()
354	}
355	for {
356		next, err := page.fn(ctx, page.ol)
357		if err != nil {
358			return err
359		}
360		page.ol = next
361		if !next.hasNextLink() || !next.IsEmpty() {
362			break
363		}
364	}
365	return nil
366}
367
368// Next advances to the next page of values.  If there was an error making
369// the request the page does not advance and the error is returned.
370// Deprecated: Use NextWithContext() instead.
371func (page *OperationListPage) Next() error {
372	return page.NextWithContext(context.Background())
373}
374
375// NotDone returns true if the page enumeration should be started or is not yet complete.
376func (page OperationListPage) NotDone() bool {
377	return !page.ol.IsEmpty()
378}
379
380// Response returns the raw server response from the last page request.
381func (page OperationListPage) Response() OperationList {
382	return page.ol
383}
384
385// Values returns the slice of values for the current page or nil if there are no values.
386func (page OperationListPage) Values() []Operation {
387	if page.ol.IsEmpty() {
388		return nil
389	}
390	return *page.ol.Value
391}
392
393// Creates a new instance of the OperationListPage type.
394func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {
395	return OperationListPage{
396		fn: getNextPage,
397		ol: cur,
398	}
399}
400
401// OperationProperties extra Operation properties.
402type OperationProperties struct {
403	// ServiceSpecification - The service specifications.
404	ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"`
405}
406
407// PrivateEndpoint private endpoint
408type PrivateEndpoint struct {
409	// ID - Full qualified Id of the private endpoint
410	ID *string `json:"id,omitempty"`
411}
412
413// PrivateEndpointACL ACL for a private endpoint
414type PrivateEndpointACL struct {
415	// Name - Name of the private endpoint connection
416	Name *string `json:"name,omitempty"`
417	// Allow - Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI.
418	Allow *[]RequestType `json:"allow,omitempty"`
419	// Deny - Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI.
420	Deny *[]RequestType `json:"deny,omitempty"`
421}
422
423// PrivateEndpointConnection a private endpoint connection to SignalR resource
424type PrivateEndpointConnection struct {
425	autorest.Response `json:"-"`
426	// PrivateEndpointConnectionProperties - Properties of the private endpoint connection
427	*PrivateEndpointConnectionProperties `json:"properties,omitempty"`
428	// ID - READ-ONLY; Fully qualified resource Id for the resource.
429	ID *string `json:"id,omitempty"`
430	// Name - READ-ONLY; The name of the resource.
431	Name *string `json:"name,omitempty"`
432	// Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR"
433	Type *string `json:"type,omitempty"`
434}
435
436// MarshalJSON is the custom marshaler for PrivateEndpointConnection.
437func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
438	objectMap := make(map[string]interface{})
439	if pec.PrivateEndpointConnectionProperties != nil {
440		objectMap["properties"] = pec.PrivateEndpointConnectionProperties
441	}
442	return json.Marshal(objectMap)
443}
444
445// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct.
446func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error {
447	var m map[string]*json.RawMessage
448	err := json.Unmarshal(body, &m)
449	if err != nil {
450		return err
451	}
452	for k, v := range m {
453		switch k {
454		case "properties":
455			if v != nil {
456				var privateEndpointConnectionProperties PrivateEndpointConnectionProperties
457				err = json.Unmarshal(*v, &privateEndpointConnectionProperties)
458				if err != nil {
459					return err
460				}
461				pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties
462			}
463		case "id":
464			if v != nil {
465				var ID string
466				err = json.Unmarshal(*v, &ID)
467				if err != nil {
468					return err
469				}
470				pec.ID = &ID
471			}
472		case "name":
473			if v != nil {
474				var name string
475				err = json.Unmarshal(*v, &name)
476				if err != nil {
477					return err
478				}
479				pec.Name = &name
480			}
481		case "type":
482			if v != nil {
483				var typeVar string
484				err = json.Unmarshal(*v, &typeVar)
485				if err != nil {
486					return err
487				}
488				pec.Type = &typeVar
489			}
490		}
491	}
492
493	return nil
494}
495
496// PrivateEndpointConnectionProperties private endpoint connection properties
497type PrivateEndpointConnectionProperties struct {
498	// ProvisioningState - READ-ONLY; Provisioning state of the private endpoint connection. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving'
499	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
500	// PrivateEndpoint - Private endpoint associated with the private endpoint connection
501	PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"`
502	// PrivateLinkServiceConnectionState - Connection state
503	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"`
504}
505
506// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties.
507func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
508	objectMap := make(map[string]interface{})
509	if pecp.PrivateEndpoint != nil {
510		objectMap["privateEndpoint"] = pecp.PrivateEndpoint
511	}
512	if pecp.PrivateLinkServiceConnectionState != nil {
513		objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState
514	}
515	return json.Marshal(objectMap)
516}
517
518// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a
519// long-running operation.
520type PrivateEndpointConnectionsDeleteFuture struct {
521	azure.FutureAPI
522	// Result returns the result of the asynchronous operation.
523	// If the operation has not completed it will return an error.
524	Result func(PrivateEndpointConnectionsClient) (autorest.Response, error)
525}
526
527// PrivateLinkResource private link resource
528type PrivateLinkResource struct {
529	// PrivateLinkResourceProperties - Properties of a private link resource
530	*PrivateLinkResourceProperties `json:"properties,omitempty"`
531	// ID - READ-ONLY; Fully qualified resource Id for the resource.
532	ID *string `json:"id,omitempty"`
533	// Name - READ-ONLY; The name of the resource.
534	Name *string `json:"name,omitempty"`
535	// Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR"
536	Type *string `json:"type,omitempty"`
537}
538
539// MarshalJSON is the custom marshaler for PrivateLinkResource.
540func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) {
541	objectMap := make(map[string]interface{})
542	if plr.PrivateLinkResourceProperties != nil {
543		objectMap["properties"] = plr.PrivateLinkResourceProperties
544	}
545	return json.Marshal(objectMap)
546}
547
548// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct.
549func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {
550	var m map[string]*json.RawMessage
551	err := json.Unmarshal(body, &m)
552	if err != nil {
553		return err
554	}
555	for k, v := range m {
556		switch k {
557		case "properties":
558			if v != nil {
559				var privateLinkResourceProperties PrivateLinkResourceProperties
560				err = json.Unmarshal(*v, &privateLinkResourceProperties)
561				if err != nil {
562					return err
563				}
564				plr.PrivateLinkResourceProperties = &privateLinkResourceProperties
565			}
566		case "id":
567			if v != nil {
568				var ID string
569				err = json.Unmarshal(*v, &ID)
570				if err != nil {
571					return err
572				}
573				plr.ID = &ID
574			}
575		case "name":
576			if v != nil {
577				var name string
578				err = json.Unmarshal(*v, &name)
579				if err != nil {
580					return err
581				}
582				plr.Name = &name
583			}
584		case "type":
585			if v != nil {
586				var typeVar string
587				err = json.Unmarshal(*v, &typeVar)
588				if err != nil {
589					return err
590				}
591				plr.Type = &typeVar
592			}
593		}
594	}
595
596	return nil
597}
598
599// PrivateLinkResourceList contains a list of AzSignalR.Models.Response.PrivateLink.PrivateLinkResource and
600// a possible link to query more results
601type PrivateLinkResourceList struct {
602	autorest.Response `json:"-"`
603	// Value - List of PrivateLinkResource
604	Value *[]PrivateLinkResource `json:"value,omitempty"`
605	// NextLink - The URL the client should use to fetch the next page (per server side paging).
606	// It's null for now, added for future use.
607	NextLink *string `json:"nextLink,omitempty"`
608}
609
610// PrivateLinkResourceListIterator provides access to a complete listing of PrivateLinkResource values.
611type PrivateLinkResourceListIterator struct {
612	i    int
613	page PrivateLinkResourceListPage
614}
615
616// NextWithContext advances to the next value.  If there was an error making
617// the request the iterator does not advance and the error is returned.
618func (iter *PrivateLinkResourceListIterator) NextWithContext(ctx context.Context) (err error) {
619	if tracing.IsEnabled() {
620		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListIterator.NextWithContext")
621		defer func() {
622			sc := -1
623			if iter.Response().Response.Response != nil {
624				sc = iter.Response().Response.Response.StatusCode
625			}
626			tracing.EndSpan(ctx, sc, err)
627		}()
628	}
629	iter.i++
630	if iter.i < len(iter.page.Values()) {
631		return nil
632	}
633	err = iter.page.NextWithContext(ctx)
634	if err != nil {
635		iter.i--
636		return err
637	}
638	iter.i = 0
639	return nil
640}
641
642// Next advances to the next value.  If there was an error making
643// the request the iterator does not advance and the error is returned.
644// Deprecated: Use NextWithContext() instead.
645func (iter *PrivateLinkResourceListIterator) Next() error {
646	return iter.NextWithContext(context.Background())
647}
648
649// NotDone returns true if the enumeration should be started or is not yet complete.
650func (iter PrivateLinkResourceListIterator) NotDone() bool {
651	return iter.page.NotDone() && iter.i < len(iter.page.Values())
652}
653
654// Response returns the raw server response from the last page request.
655func (iter PrivateLinkResourceListIterator) Response() PrivateLinkResourceList {
656	return iter.page.Response()
657}
658
659// Value returns the current value or a zero-initialized value if the
660// iterator has advanced beyond the end of the collection.
661func (iter PrivateLinkResourceListIterator) Value() PrivateLinkResource {
662	if !iter.page.NotDone() {
663		return PrivateLinkResource{}
664	}
665	return iter.page.Values()[iter.i]
666}
667
668// Creates a new instance of the PrivateLinkResourceListIterator type.
669func NewPrivateLinkResourceListIterator(page PrivateLinkResourceListPage) PrivateLinkResourceListIterator {
670	return PrivateLinkResourceListIterator{page: page}
671}
672
673// IsEmpty returns true if the ListResult contains no values.
674func (plrl PrivateLinkResourceList) IsEmpty() bool {
675	return plrl.Value == nil || len(*plrl.Value) == 0
676}
677
678// hasNextLink returns true if the NextLink is not empty.
679func (plrl PrivateLinkResourceList) hasNextLink() bool {
680	return plrl.NextLink != nil && len(*plrl.NextLink) != 0
681}
682
683// privateLinkResourceListPreparer prepares a request to retrieve the next set of results.
684// It returns nil if no more results exist.
685func (plrl PrivateLinkResourceList) privateLinkResourceListPreparer(ctx context.Context) (*http.Request, error) {
686	if !plrl.hasNextLink() {
687		return nil, nil
688	}
689	return autorest.Prepare((&http.Request{}).WithContext(ctx),
690		autorest.AsJSON(),
691		autorest.AsGet(),
692		autorest.WithBaseURL(to.String(plrl.NextLink)))
693}
694
695// PrivateLinkResourceListPage contains a page of PrivateLinkResource values.
696type PrivateLinkResourceListPage struct {
697	fn   func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error)
698	plrl PrivateLinkResourceList
699}
700
701// NextWithContext advances to the next page of values.  If there was an error making
702// the request the page does not advance and the error is returned.
703func (page *PrivateLinkResourceListPage) NextWithContext(ctx context.Context) (err error) {
704	if tracing.IsEnabled() {
705		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListPage.NextWithContext")
706		defer func() {
707			sc := -1
708			if page.Response().Response.Response != nil {
709				sc = page.Response().Response.Response.StatusCode
710			}
711			tracing.EndSpan(ctx, sc, err)
712		}()
713	}
714	for {
715		next, err := page.fn(ctx, page.plrl)
716		if err != nil {
717			return err
718		}
719		page.plrl = next
720		if !next.hasNextLink() || !next.IsEmpty() {
721			break
722		}
723	}
724	return nil
725}
726
727// Next advances to the next page of values.  If there was an error making
728// the request the page does not advance and the error is returned.
729// Deprecated: Use NextWithContext() instead.
730func (page *PrivateLinkResourceListPage) Next() error {
731	return page.NextWithContext(context.Background())
732}
733
734// NotDone returns true if the page enumeration should be started or is not yet complete.
735func (page PrivateLinkResourceListPage) NotDone() bool {
736	return !page.plrl.IsEmpty()
737}
738
739// Response returns the raw server response from the last page request.
740func (page PrivateLinkResourceListPage) Response() PrivateLinkResourceList {
741	return page.plrl
742}
743
744// Values returns the slice of values for the current page or nil if there are no values.
745func (page PrivateLinkResourceListPage) Values() []PrivateLinkResource {
746	if page.plrl.IsEmpty() {
747		return nil
748	}
749	return *page.plrl.Value
750}
751
752// Creates a new instance of the PrivateLinkResourceListPage type.
753func NewPrivateLinkResourceListPage(cur PrivateLinkResourceList, getNextPage func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error)) PrivateLinkResourceListPage {
754	return PrivateLinkResourceListPage{
755		fn:   getNextPage,
756		plrl: cur,
757	}
758}
759
760// PrivateLinkResourceProperties private link resource properties
761type PrivateLinkResourceProperties struct {
762	// GroupID - Group Id of the private link resource
763	GroupID *string `json:"groupId,omitempty"`
764	// RequiredMembers - Required members of the private link resource
765	RequiredMembers *[]string `json:"requiredMembers,omitempty"`
766	// RequiredZoneNames - Required private DNS zone names
767	RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"`
768}
769
770// PrivateLinkServiceConnectionState connection state of the private endpoint connection
771type PrivateLinkServiceConnectionState struct {
772	// Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'
773	Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"`
774	// Description - The reason for approval/rejection of the connection.
775	Description *string `json:"description,omitempty"`
776	// ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer.
777	ActionsRequired *string `json:"actionsRequired,omitempty"`
778}
779
780// Properties a class that describes the properties of the SignalR service that should contain more
781// read-only properties than AzSignalR.Models.SignalRCreateOrUpdateProperties
782type Properties struct {
783	// ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving'
784	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
785	// ExternalIP - READ-ONLY; The publicly accessible IP of the SignalR service.
786	ExternalIP *string `json:"externalIP,omitempty"`
787	// HostName - READ-ONLY; FQDN of the SignalR service instance. Format: xxx.service.signalr.net
788	HostName *string `json:"hostName,omitempty"`
789	// PublicPort - READ-ONLY; The publicly accessible port of the SignalR service which is designed for browser/client side usage.
790	PublicPort *int32 `json:"publicPort,omitempty"`
791	// ServerPort - READ-ONLY; The publicly accessible port of the SignalR service which is designed for customer server side usage.
792	ServerPort *int32 `json:"serverPort,omitempty"`
793	// Version - READ-ONLY; Version of the SignalR resource. Probably you need the same or higher version of client SDKs.
794	Version *string `json:"version,omitempty"`
795	// PrivateEndpointConnections - READ-ONLY; Private endpoint connections to the SignalR resource.
796	PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"`
797	// HostNamePrefix - Prefix for the hostName of the SignalR service. Retained for future use.
798	// The hostname will be of format: &lt;hostNamePrefix&gt;.service.signalr.net.
799	HostNamePrefix *string `json:"hostNamePrefix,omitempty"`
800	// Features - List of SignalR featureFlags. e.g. ServiceMode.
801	//
802	// FeatureFlags that are not included in the parameters for the update operation will not be modified.
803	// And the response will only include featureFlags that are explicitly set.
804	// When a featureFlag is not explicitly set, SignalR service will use its globally default value.
805	// But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags.
806	Features *[]Feature `json:"features,omitempty"`
807	// Cors - Cross-Origin Resource Sharing (CORS) settings.
808	Cors *CorsSettings `json:"cors,omitempty"`
809	// Upstream - Upstream settings when the Azure SignalR is in server-less mode.
810	Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"`
811	// NetworkACLs - Network ACLs
812	NetworkACLs *NetworkACLs `json:"networkACLs,omitempty"`
813}
814
815// MarshalJSON is the custom marshaler for Properties.
816func (p Properties) MarshalJSON() ([]byte, error) {
817	objectMap := make(map[string]interface{})
818	if p.HostNamePrefix != nil {
819		objectMap["hostNamePrefix"] = p.HostNamePrefix
820	}
821	if p.Features != nil {
822		objectMap["features"] = p.Features
823	}
824	if p.Cors != nil {
825		objectMap["cors"] = p.Cors
826	}
827	if p.Upstream != nil {
828		objectMap["upstream"] = p.Upstream
829	}
830	if p.NetworkACLs != nil {
831		objectMap["networkACLs"] = p.NetworkACLs
832	}
833	return json.Marshal(objectMap)
834}
835
836// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
837// required location and tags
838type ProxyResource struct {
839	// ID - READ-ONLY; Fully qualified resource Id for the resource.
840	ID *string `json:"id,omitempty"`
841	// Name - READ-ONLY; The name of the resource.
842	Name *string `json:"name,omitempty"`
843	// Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR"
844	Type *string `json:"type,omitempty"`
845}
846
847// RegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running
848// operation.
849type RegenerateKeyFuture struct {
850	azure.FutureAPI
851	// Result returns the result of the asynchronous operation.
852	// If the operation has not completed it will return an error.
853	Result func(Client) (Keys, error)
854}
855
856// RegenerateKeyParameters parameters describes the request to regenerate access keys
857type RegenerateKeyParameters struct {
858	// KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary'
859	KeyType KeyType `json:"keyType,omitempty"`
860}
861
862// Resource the core properties of ARM resources.
863type Resource struct {
864	// ID - READ-ONLY; Fully qualified resource Id for the resource.
865	ID *string `json:"id,omitempty"`
866	// Name - READ-ONLY; The name of the resource.
867	Name *string `json:"name,omitempty"`
868	// Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR"
869	Type *string `json:"type,omitempty"`
870}
871
872// ResourceList object that includes an array of SignalR services and a possible link for next set.
873type ResourceList struct {
874	autorest.Response `json:"-"`
875	// Value - List of SignalR services
876	Value *[]ResourceType `json:"value,omitempty"`
877	// NextLink - The URL the client should use to fetch the next page (per server side paging).
878	// It's null for now, added for future use.
879	NextLink *string `json:"nextLink,omitempty"`
880}
881
882// ResourceListIterator provides access to a complete listing of ResourceType values.
883type ResourceListIterator struct {
884	i    int
885	page ResourceListPage
886}
887
888// NextWithContext advances to the next value.  If there was an error making
889// the request the iterator does not advance and the error is returned.
890func (iter *ResourceListIterator) NextWithContext(ctx context.Context) (err error) {
891	if tracing.IsEnabled() {
892		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListIterator.NextWithContext")
893		defer func() {
894			sc := -1
895			if iter.Response().Response.Response != nil {
896				sc = iter.Response().Response.Response.StatusCode
897			}
898			tracing.EndSpan(ctx, sc, err)
899		}()
900	}
901	iter.i++
902	if iter.i < len(iter.page.Values()) {
903		return nil
904	}
905	err = iter.page.NextWithContext(ctx)
906	if err != nil {
907		iter.i--
908		return err
909	}
910	iter.i = 0
911	return nil
912}
913
914// Next advances to the next value.  If there was an error making
915// the request the iterator does not advance and the error is returned.
916// Deprecated: Use NextWithContext() instead.
917func (iter *ResourceListIterator) Next() error {
918	return iter.NextWithContext(context.Background())
919}
920
921// NotDone returns true if the enumeration should be started or is not yet complete.
922func (iter ResourceListIterator) NotDone() bool {
923	return iter.page.NotDone() && iter.i < len(iter.page.Values())
924}
925
926// Response returns the raw server response from the last page request.
927func (iter ResourceListIterator) Response() ResourceList {
928	return iter.page.Response()
929}
930
931// Value returns the current value or a zero-initialized value if the
932// iterator has advanced beyond the end of the collection.
933func (iter ResourceListIterator) Value() ResourceType {
934	if !iter.page.NotDone() {
935		return ResourceType{}
936	}
937	return iter.page.Values()[iter.i]
938}
939
940// Creates a new instance of the ResourceListIterator type.
941func NewResourceListIterator(page ResourceListPage) ResourceListIterator {
942	return ResourceListIterator{page: page}
943}
944
945// IsEmpty returns true if the ListResult contains no values.
946func (rl ResourceList) IsEmpty() bool {
947	return rl.Value == nil || len(*rl.Value) == 0
948}
949
950// hasNextLink returns true if the NextLink is not empty.
951func (rl ResourceList) hasNextLink() bool {
952	return rl.NextLink != nil && len(*rl.NextLink) != 0
953}
954
955// resourceListPreparer prepares a request to retrieve the next set of results.
956// It returns nil if no more results exist.
957func (rl ResourceList) resourceListPreparer(ctx context.Context) (*http.Request, error) {
958	if !rl.hasNextLink() {
959		return nil, nil
960	}
961	return autorest.Prepare((&http.Request{}).WithContext(ctx),
962		autorest.AsJSON(),
963		autorest.AsGet(),
964		autorest.WithBaseURL(to.String(rl.NextLink)))
965}
966
967// ResourceListPage contains a page of ResourceType values.
968type ResourceListPage struct {
969	fn func(context.Context, ResourceList) (ResourceList, error)
970	rl ResourceList
971}
972
973// NextWithContext advances to the next page of values.  If there was an error making
974// the request the page does not advance and the error is returned.
975func (page *ResourceListPage) NextWithContext(ctx context.Context) (err error) {
976	if tracing.IsEnabled() {
977		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListPage.NextWithContext")
978		defer func() {
979			sc := -1
980			if page.Response().Response.Response != nil {
981				sc = page.Response().Response.Response.StatusCode
982			}
983			tracing.EndSpan(ctx, sc, err)
984		}()
985	}
986	for {
987		next, err := page.fn(ctx, page.rl)
988		if err != nil {
989			return err
990		}
991		page.rl = next
992		if !next.hasNextLink() || !next.IsEmpty() {
993			break
994		}
995	}
996	return nil
997}
998
999// Next advances to the next page of values.  If there was an error making
1000// the request the page does not advance and the error is returned.
1001// Deprecated: Use NextWithContext() instead.
1002func (page *ResourceListPage) Next() error {
1003	return page.NextWithContext(context.Background())
1004}
1005
1006// NotDone returns true if the page enumeration should be started or is not yet complete.
1007func (page ResourceListPage) NotDone() bool {
1008	return !page.rl.IsEmpty()
1009}
1010
1011// Response returns the raw server response from the last page request.
1012func (page ResourceListPage) Response() ResourceList {
1013	return page.rl
1014}
1015
1016// Values returns the slice of values for the current page or nil if there are no values.
1017func (page ResourceListPage) Values() []ResourceType {
1018	if page.rl.IsEmpty() {
1019		return nil
1020	}
1021	return *page.rl.Value
1022}
1023
1024// Creates a new instance of the ResourceListPage type.
1025func NewResourceListPage(cur ResourceList, getNextPage func(context.Context, ResourceList) (ResourceList, error)) ResourceListPage {
1026	return ResourceListPage{
1027		fn: getNextPage,
1028		rl: cur,
1029	}
1030}
1031
1032// ResourceSku the billing information of the SignalR resource.
1033type ResourceSku struct {
1034	// Name - The name of the SKU. Required.
1035	//
1036	// Allowed values: Standard_S1, Free_F1
1037	Name *string `json:"name,omitempty"`
1038	// Tier - Optional tier of this particular SKU. 'Standard' or 'Free'.
1039	//
1040	// `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium'
1041	Tier SkuTier `json:"tier,omitempty"`
1042	// Size - Optional string. For future use.
1043	Size *string `json:"size,omitempty"`
1044	// Family - Optional string. For future use.
1045	Family *string `json:"family,omitempty"`
1046	// Capacity - Optional, integer. The unit count of SignalR resource. 1 by default.
1047	//
1048	// If present, following values are allowed:
1049	//     Free: 1
1050	//     Standard: 1,2,5,10,20,50,100
1051	Capacity *int32 `json:"capacity,omitempty"`
1052}
1053
1054// ResourceType a class represent a SignalR service resource.
1055type ResourceType struct {
1056	autorest.Response `json:"-"`
1057	// Sku - The billing information of the resource.(e.g. Free, Standard)
1058	Sku *ResourceSku `json:"sku,omitempty"`
1059	// Properties - Settings used to provision or configure the resource
1060	*Properties `json:"properties,omitempty"`
1061	// Kind - The kind of the service - e.g. "SignalR", or "RawWebSockets" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets'
1062	Kind ServiceKind `json:"kind,omitempty"`
1063	// Location - The GEO location of the SignalR service. e.g. West US | East US | North Central US | South Central US.
1064	Location *string `json:"location,omitempty"`
1065	// Tags - Tags of the service which is a list of key value pairs that describe the resource.
1066	Tags map[string]*string `json:"tags"`
1067	// ID - READ-ONLY; Fully qualified resource Id for the resource.
1068	ID *string `json:"id,omitempty"`
1069	// Name - READ-ONLY; The name of the resource.
1070	Name *string `json:"name,omitempty"`
1071	// Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR"
1072	Type *string `json:"type,omitempty"`
1073}
1074
1075// MarshalJSON is the custom marshaler for ResourceType.
1076func (rt ResourceType) MarshalJSON() ([]byte, error) {
1077	objectMap := make(map[string]interface{})
1078	if rt.Sku != nil {
1079		objectMap["sku"] = rt.Sku
1080	}
1081	if rt.Properties != nil {
1082		objectMap["properties"] = rt.Properties
1083	}
1084	if rt.Kind != "" {
1085		objectMap["kind"] = rt.Kind
1086	}
1087	if rt.Location != nil {
1088		objectMap["location"] = rt.Location
1089	}
1090	if rt.Tags != nil {
1091		objectMap["tags"] = rt.Tags
1092	}
1093	return json.Marshal(objectMap)
1094}
1095
1096// UnmarshalJSON is the custom unmarshaler for ResourceType struct.
1097func (rt *ResourceType) UnmarshalJSON(body []byte) error {
1098	var m map[string]*json.RawMessage
1099	err := json.Unmarshal(body, &m)
1100	if err != nil {
1101		return err
1102	}
1103	for k, v := range m {
1104		switch k {
1105		case "sku":
1106			if v != nil {
1107				var sku ResourceSku
1108				err = json.Unmarshal(*v, &sku)
1109				if err != nil {
1110					return err
1111				}
1112				rt.Sku = &sku
1113			}
1114		case "properties":
1115			if v != nil {
1116				var properties Properties
1117				err = json.Unmarshal(*v, &properties)
1118				if err != nil {
1119					return err
1120				}
1121				rt.Properties = &properties
1122			}
1123		case "kind":
1124			if v != nil {
1125				var kind ServiceKind
1126				err = json.Unmarshal(*v, &kind)
1127				if err != nil {
1128					return err
1129				}
1130				rt.Kind = kind
1131			}
1132		case "location":
1133			if v != nil {
1134				var location string
1135				err = json.Unmarshal(*v, &location)
1136				if err != nil {
1137					return err
1138				}
1139				rt.Location = &location
1140			}
1141		case "tags":
1142			if v != nil {
1143				var tags map[string]*string
1144				err = json.Unmarshal(*v, &tags)
1145				if err != nil {
1146					return err
1147				}
1148				rt.Tags = tags
1149			}
1150		case "id":
1151			if v != nil {
1152				var ID string
1153				err = json.Unmarshal(*v, &ID)
1154				if err != nil {
1155					return err
1156				}
1157				rt.ID = &ID
1158			}
1159		case "name":
1160			if v != nil {
1161				var name string
1162				err = json.Unmarshal(*v, &name)
1163				if err != nil {
1164					return err
1165				}
1166				rt.Name = &name
1167			}
1168		case "type":
1169			if v != nil {
1170				var typeVar string
1171				err = json.Unmarshal(*v, &typeVar)
1172				if err != nil {
1173					return err
1174				}
1175				rt.Type = &typeVar
1176			}
1177		}
1178	}
1179
1180	return nil
1181}
1182
1183// RestartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1184type RestartFuture struct {
1185	azure.FutureAPI
1186	// Result returns the result of the asynchronous operation.
1187	// If the operation has not completed it will return an error.
1188	Result func(Client) (autorest.Response, error)
1189}
1190
1191// ServerlessUpstreamSettings the settings for the Upstream when the Azure SignalR is in server-less mode.
1192type ServerlessUpstreamSettings struct {
1193	// Templates - Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects.
1194	Templates *[]UpstreamTemplate `json:"templates,omitempty"`
1195}
1196
1197// ServiceSpecification an object that describes a specification.
1198type ServiceSpecification struct {
1199	// MetricSpecifications - Specifications of the Metrics for Azure Monitoring.
1200	MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"`
1201	// LogSpecifications - Specifications of the Logs for Azure Monitoring.
1202	LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"`
1203}
1204
1205// TrackedResource the resource model definition for a ARM tracked top level resource.
1206type TrackedResource struct {
1207	// Location - The GEO location of the SignalR service. e.g. West US | East US | North Central US | South Central US.
1208	Location *string `json:"location,omitempty"`
1209	// Tags - Tags of the service which is a list of key value pairs that describe the resource.
1210	Tags map[string]*string `json:"tags"`
1211	// ID - READ-ONLY; Fully qualified resource Id for the resource.
1212	ID *string `json:"id,omitempty"`
1213	// Name - READ-ONLY; The name of the resource.
1214	Name *string `json:"name,omitempty"`
1215	// Type - READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR"
1216	Type *string `json:"type,omitempty"`
1217}
1218
1219// MarshalJSON is the custom marshaler for TrackedResource.
1220func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1221	objectMap := make(map[string]interface{})
1222	if tr.Location != nil {
1223		objectMap["location"] = tr.Location
1224	}
1225	if tr.Tags != nil {
1226		objectMap["tags"] = tr.Tags
1227	}
1228	return json.Marshal(objectMap)
1229}
1230
1231// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1232type UpdateFuture struct {
1233	azure.FutureAPI
1234	// Result returns the result of the asynchronous operation.
1235	// If the operation has not completed it will return an error.
1236	Result func(Client) (ResourceType, error)
1237}
1238
1239// UpstreamTemplate upstream template item settings. It defines the Upstream URL of the incoming requests.
1240// The template defines the pattern of the event, the hub or the category of the incoming request that
1241// matches current URL template.
1242type UpstreamTemplate struct {
1243	// HubPattern - Gets or sets the matching pattern for hub names. If not set, it matches any hub.
1244	// There are 3 kind of patterns supported:
1245	//     1. "*", it to matches any hub name
1246	//     2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2"
1247	//     3. The single hub name, for example, "hub1", it matches "hub1"
1248	HubPattern *string `json:"hubPattern,omitempty"`
1249	// EventPattern - Gets or sets the matching pattern for event names. If not set, it matches any event.
1250	// There are 3 kind of patterns supported:
1251	//     1. "*", it to matches any event name
1252	//     2. Combine multiple events with ",", for example "connect,disconnect", it matches event "connect" and "disconnect"
1253	//     3. The single event name, for example, "connect", it matches "connect"
1254	EventPattern *string `json:"eventPattern,omitempty"`
1255	// CategoryPattern - Gets or sets the matching pattern for category names. If not set, it matches any category.
1256	// There are 3 kind of patterns supported:
1257	//     1. "*", it to matches any category name
1258	//     2. Combine multiple categories with ",", for example "connections,messages", it matches category "connections" and "messages"
1259	//     3. The single category name, for example, "connections", it matches the category "connections"
1260	CategoryPattern *string `json:"categoryPattern,omitempty"`
1261	// 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.
1262	// 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`.
1263	URLTemplate *string `json:"urlTemplate,omitempty"`
1264}
1265
1266// Usage object that describes a specific usage of SignalR resources.
1267type Usage struct {
1268	// ID - Fully qualified ARM resource id
1269	ID *string `json:"id,omitempty"`
1270	// CurrentValue - Current value for the usage quota.
1271	CurrentValue *int64 `json:"currentValue,omitempty"`
1272	// Limit - The maximum permitted value for the usage quota. If there is no limit, this value will be -1.
1273	Limit *int64 `json:"limit,omitempty"`
1274	// Name - Localizable String object containing the name and a localized value.
1275	Name *UsageName `json:"name,omitempty"`
1276	// Unit - Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond.
1277	Unit *string `json:"unit,omitempty"`
1278}
1279
1280// UsageList object that includes an array of SignalR resource usages and a possible link for next set.
1281type UsageList struct {
1282	autorest.Response `json:"-"`
1283	// Value - List of SignalR usages
1284	Value *[]Usage `json:"value,omitempty"`
1285	// NextLink - The URL the client should use to fetch the next page (per server side paging).
1286	// It's null for now, added for future use.
1287	NextLink *string `json:"nextLink,omitempty"`
1288}
1289
1290// UsageListIterator provides access to a complete listing of Usage values.
1291type UsageListIterator struct {
1292	i    int
1293	page UsageListPage
1294}
1295
1296// NextWithContext advances to the next value.  If there was an error making
1297// the request the iterator does not advance and the error is returned.
1298func (iter *UsageListIterator) NextWithContext(ctx context.Context) (err error) {
1299	if tracing.IsEnabled() {
1300		ctx = tracing.StartSpan(ctx, fqdn+"/UsageListIterator.NextWithContext")
1301		defer func() {
1302			sc := -1
1303			if iter.Response().Response.Response != nil {
1304				sc = iter.Response().Response.Response.StatusCode
1305			}
1306			tracing.EndSpan(ctx, sc, err)
1307		}()
1308	}
1309	iter.i++
1310	if iter.i < len(iter.page.Values()) {
1311		return nil
1312	}
1313	err = iter.page.NextWithContext(ctx)
1314	if err != nil {
1315		iter.i--
1316		return err
1317	}
1318	iter.i = 0
1319	return nil
1320}
1321
1322// Next advances to the next value.  If there was an error making
1323// the request the iterator does not advance and the error is returned.
1324// Deprecated: Use NextWithContext() instead.
1325func (iter *UsageListIterator) Next() error {
1326	return iter.NextWithContext(context.Background())
1327}
1328
1329// NotDone returns true if the enumeration should be started or is not yet complete.
1330func (iter UsageListIterator) NotDone() bool {
1331	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1332}
1333
1334// Response returns the raw server response from the last page request.
1335func (iter UsageListIterator) Response() UsageList {
1336	return iter.page.Response()
1337}
1338
1339// Value returns the current value or a zero-initialized value if the
1340// iterator has advanced beyond the end of the collection.
1341func (iter UsageListIterator) Value() Usage {
1342	if !iter.page.NotDone() {
1343		return Usage{}
1344	}
1345	return iter.page.Values()[iter.i]
1346}
1347
1348// Creates a new instance of the UsageListIterator type.
1349func NewUsageListIterator(page UsageListPage) UsageListIterator {
1350	return UsageListIterator{page: page}
1351}
1352
1353// IsEmpty returns true if the ListResult contains no values.
1354func (ul UsageList) IsEmpty() bool {
1355	return ul.Value == nil || len(*ul.Value) == 0
1356}
1357
1358// hasNextLink returns true if the NextLink is not empty.
1359func (ul UsageList) hasNextLink() bool {
1360	return ul.NextLink != nil && len(*ul.NextLink) != 0
1361}
1362
1363// usageListPreparer prepares a request to retrieve the next set of results.
1364// It returns nil if no more results exist.
1365func (ul UsageList) usageListPreparer(ctx context.Context) (*http.Request, error) {
1366	if !ul.hasNextLink() {
1367		return nil, nil
1368	}
1369	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1370		autorest.AsJSON(),
1371		autorest.AsGet(),
1372		autorest.WithBaseURL(to.String(ul.NextLink)))
1373}
1374
1375// UsageListPage contains a page of Usage values.
1376type UsageListPage struct {
1377	fn func(context.Context, UsageList) (UsageList, error)
1378	ul UsageList
1379}
1380
1381// NextWithContext advances to the next page of values.  If there was an error making
1382// the request the page does not advance and the error is returned.
1383func (page *UsageListPage) NextWithContext(ctx context.Context) (err error) {
1384	if tracing.IsEnabled() {
1385		ctx = tracing.StartSpan(ctx, fqdn+"/UsageListPage.NextWithContext")
1386		defer func() {
1387			sc := -1
1388			if page.Response().Response.Response != nil {
1389				sc = page.Response().Response.Response.StatusCode
1390			}
1391			tracing.EndSpan(ctx, sc, err)
1392		}()
1393	}
1394	for {
1395		next, err := page.fn(ctx, page.ul)
1396		if err != nil {
1397			return err
1398		}
1399		page.ul = next
1400		if !next.hasNextLink() || !next.IsEmpty() {
1401			break
1402		}
1403	}
1404	return nil
1405}
1406
1407// Next advances to the next page of values.  If there was an error making
1408// the request the page does not advance and the error is returned.
1409// Deprecated: Use NextWithContext() instead.
1410func (page *UsageListPage) Next() error {
1411	return page.NextWithContext(context.Background())
1412}
1413
1414// NotDone returns true if the page enumeration should be started or is not yet complete.
1415func (page UsageListPage) NotDone() bool {
1416	return !page.ul.IsEmpty()
1417}
1418
1419// Response returns the raw server response from the last page request.
1420func (page UsageListPage) Response() UsageList {
1421	return page.ul
1422}
1423
1424// Values returns the slice of values for the current page or nil if there are no values.
1425func (page UsageListPage) Values() []Usage {
1426	if page.ul.IsEmpty() {
1427		return nil
1428	}
1429	return *page.ul.Value
1430}
1431
1432// Creates a new instance of the UsageListPage type.
1433func NewUsageListPage(cur UsageList, getNextPage func(context.Context, UsageList) (UsageList, error)) UsageListPage {
1434	return UsageListPage{
1435		fn: getNextPage,
1436		ul: cur,
1437	}
1438}
1439
1440// UsageName localizable String object containing the name and a localized value.
1441type UsageName struct {
1442	// Value - The identifier of the usage.
1443	Value *string `json:"value,omitempty"`
1444	// LocalizedValue - Localized name of the usage.
1445	LocalizedValue *string `json:"localizedValue,omitempty"`
1446}
1447