1package communication
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/date"
15	"github.com/Azure/go-autorest/autorest/to"
16	"github.com/Azure/go-autorest/tracing"
17	"net/http"
18)
19
20// The package's fully qualified name.
21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/communication/mgmt/2020-08-20-preview/communication"
22
23// Dimension specifications of the Dimension of metrics.
24type Dimension struct {
25	// Name - The public facing name of the dimension.
26	Name *string `json:"name,omitempty"`
27	// DisplayName - Localized friendly display name of the dimension.
28	DisplayName *string `json:"displayName,omitempty"`
29	// InternalName - Name of the dimension as it appears in MDM.
30	InternalName *string `json:"internalName,omitempty"`
31	// ToBeExportedForShoebox - A Boolean flag indicating whether this dimension should be included for the shoebox export scenario.
32	ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"`
33}
34
35// ErrorResponse error response indicating why the requested operation could not be performed.
36type ErrorResponse struct {
37	// Error - The error
38	Error *ErrorResponseError `json:"error,omitempty"`
39}
40
41// ErrorResponseError the error
42type ErrorResponseError struct {
43	// Code - Error code.
44	Code *string `json:"code,omitempty"`
45	// Message - Error message indicating why the operation failed.
46	Message *string `json:"message,omitempty"`
47}
48
49// LinkedNotificationHub a notification hub that has been linked to the communication service
50type LinkedNotificationHub struct {
51	autorest.Response `json:"-"`
52	// ResourceID - The resource ID of the notification hub
53	ResourceID *string `json:"resourceId,omitempty"`
54}
55
56// LinkNotificationHubParameters description of an Azure Notification Hub to link to the communication
57// service
58type LinkNotificationHubParameters struct {
59	// ResourceID - The resource ID of the notification hub
60	ResourceID *string `json:"resourceId,omitempty"`
61	// ConnectionString - Connection string for the notification hub
62	ConnectionString *string `json:"connectionString,omitempty"`
63}
64
65// LocationResource an ARM resource with its own location (not a global or an inherited location).
66type LocationResource struct {
67	// Location - The Azure location where the CommunicationService is running.
68	Location *string `json:"location,omitempty"`
69}
70
71// MetricSpecification specifications of the Metrics for Azure Monitoring.
72type MetricSpecification struct {
73	// Name - Name of the metric.
74	Name *string `json:"name,omitempty"`
75	// DisplayName - Localized friendly display name of the metric.
76	DisplayName *string `json:"displayName,omitempty"`
77	// DisplayDescription - Localized friendly description of the metric.
78	DisplayDescription *string `json:"displayDescription,omitempty"`
79	// Unit - The unit that makes sense for the metric.
80	Unit *string `json:"unit,omitempty"`
81	// AggregationType - The method for aggregating the metric. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count'
82	AggregationType AggregationType `json:"aggregationType,omitempty"`
83	// FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published.
84	// Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear
85	// often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted.
86	FillGapWithZero *string `json:"fillGapWithZero,omitempty"`
87	// Category - The name of the metric category that the metric belongs to. A metric can only belong to a single category.
88	Category *string `json:"category,omitempty"`
89	// Dimensions - The dimensions of the metrics.
90	Dimensions *[]Dimension `json:"dimensions,omitempty"`
91}
92
93// NameAvailability result of the request to check name availability. It contains a flag and possible
94// reason of failure.
95type NameAvailability struct {
96	autorest.Response `json:"-"`
97	// NameAvailable - Indicates whether the name is available or not.
98	NameAvailable *bool `json:"nameAvailable,omitempty"`
99	// Reason - The reason of the availability. Required if name is not available.
100	Reason *string `json:"reason,omitempty"`
101	// Message - The message of the operation.
102	Message *string `json:"message,omitempty"`
103}
104
105// NameAvailabilityParameters data POST-ed to the nameAvailability action
106type NameAvailabilityParameters struct {
107	// Type - The resource type. Should be always "Microsoft.Communication/CommunicationServices".
108	Type *string `json:"type,omitempty"`
109	// Name - The CommunicationService name to validate. e.g."my-CommunicationService-name-here"
110	Name *string `json:"name,omitempty"`
111}
112
113// Operation REST API operation supported by CommunicationService resource provider.
114type Operation struct {
115	// Name - Name of the operation with format: {provider}/{resource}/{operation}
116	Name *string `json:"name,omitempty"`
117	// Display - The object that describes the operation.
118	Display *OperationDisplay `json:"display,omitempty"`
119	// Origin - Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX.
120	Origin *string `json:"origin,omitempty"`
121	// Properties - Extra properties for the operation.
122	Properties *OperationProperties `json:"properties,omitempty"`
123}
124
125// OperationDisplay the object that describes a operation.
126type OperationDisplay struct {
127	// Provider - Friendly name of the resource provider
128	Provider *string `json:"provider,omitempty"`
129	// Resource - Resource type on which the operation is performed.
130	Resource *string `json:"resource,omitempty"`
131	// Operation - The localized friendly name for the operation.
132	Operation *string `json:"operation,omitempty"`
133	// Description - The localized friendly description for the operation
134	Description *string `json:"description,omitempty"`
135}
136
137// OperationList result of the request to list REST API operations. It contains a list of operations.
138type OperationList struct {
139	autorest.Response `json:"-"`
140	// Value - List of operations supported by the resource provider.
141	Value *[]Operation `json:"value,omitempty"`
142	// NextLink - The URL the client should use to fetch the next page (per server side paging).
143	// It's null for now, added for future use.
144	NextLink *string `json:"nextLink,omitempty"`
145}
146
147// OperationListIterator provides access to a complete listing of Operation values.
148type OperationListIterator struct {
149	i    int
150	page OperationListPage
151}
152
153// NextWithContext advances to the next value.  If there was an error making
154// the request the iterator does not advance and the error is returned.
155func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) {
156	if tracing.IsEnabled() {
157		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext")
158		defer func() {
159			sc := -1
160			if iter.Response().Response.Response != nil {
161				sc = iter.Response().Response.Response.StatusCode
162			}
163			tracing.EndSpan(ctx, sc, err)
164		}()
165	}
166	iter.i++
167	if iter.i < len(iter.page.Values()) {
168		return nil
169	}
170	err = iter.page.NextWithContext(ctx)
171	if err != nil {
172		iter.i--
173		return err
174	}
175	iter.i = 0
176	return nil
177}
178
179// Next advances to the next value.  If there was an error making
180// the request the iterator does not advance and the error is returned.
181// Deprecated: Use NextWithContext() instead.
182func (iter *OperationListIterator) Next() error {
183	return iter.NextWithContext(context.Background())
184}
185
186// NotDone returns true if the enumeration should be started or is not yet complete.
187func (iter OperationListIterator) NotDone() bool {
188	return iter.page.NotDone() && iter.i < len(iter.page.Values())
189}
190
191// Response returns the raw server response from the last page request.
192func (iter OperationListIterator) Response() OperationList {
193	return iter.page.Response()
194}
195
196// Value returns the current value or a zero-initialized value if the
197// iterator has advanced beyond the end of the collection.
198func (iter OperationListIterator) Value() Operation {
199	if !iter.page.NotDone() {
200		return Operation{}
201	}
202	return iter.page.Values()[iter.i]
203}
204
205// Creates a new instance of the OperationListIterator type.
206func NewOperationListIterator(page OperationListPage) OperationListIterator {
207	return OperationListIterator{page: page}
208}
209
210// IsEmpty returns true if the ListResult contains no values.
211func (ol OperationList) IsEmpty() bool {
212	return ol.Value == nil || len(*ol.Value) == 0
213}
214
215// hasNextLink returns true if the NextLink is not empty.
216func (ol OperationList) hasNextLink() bool {
217	return ol.NextLink != nil && len(*ol.NextLink) != 0
218}
219
220// operationListPreparer prepares a request to retrieve the next set of results.
221// It returns nil if no more results exist.
222func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {
223	if !ol.hasNextLink() {
224		return nil, nil
225	}
226	return autorest.Prepare((&http.Request{}).WithContext(ctx),
227		autorest.AsJSON(),
228		autorest.AsGet(),
229		autorest.WithBaseURL(to.String(ol.NextLink)))
230}
231
232// OperationListPage contains a page of Operation values.
233type OperationListPage struct {
234	fn func(context.Context, OperationList) (OperationList, error)
235	ol OperationList
236}
237
238// NextWithContext advances to the next page of values.  If there was an error making
239// the request the page does not advance and the error is returned.
240func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) {
241	if tracing.IsEnabled() {
242		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext")
243		defer func() {
244			sc := -1
245			if page.Response().Response.Response != nil {
246				sc = page.Response().Response.Response.StatusCode
247			}
248			tracing.EndSpan(ctx, sc, err)
249		}()
250	}
251	for {
252		next, err := page.fn(ctx, page.ol)
253		if err != nil {
254			return err
255		}
256		page.ol = next
257		if !next.hasNextLink() || !next.IsEmpty() {
258			break
259		}
260	}
261	return nil
262}
263
264// Next advances to the next page of values.  If there was an error making
265// the request the page does not advance and the error is returned.
266// Deprecated: Use NextWithContext() instead.
267func (page *OperationListPage) Next() error {
268	return page.NextWithContext(context.Background())
269}
270
271// NotDone returns true if the page enumeration should be started or is not yet complete.
272func (page OperationListPage) NotDone() bool {
273	return !page.ol.IsEmpty()
274}
275
276// Response returns the raw server response from the last page request.
277func (page OperationListPage) Response() OperationList {
278	return page.ol
279}
280
281// Values returns the slice of values for the current page or nil if there are no values.
282func (page OperationListPage) Values() []Operation {
283	if page.ol.IsEmpty() {
284		return nil
285	}
286	return *page.ol.Value
287}
288
289// Creates a new instance of the OperationListPage type.
290func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {
291	return OperationListPage{
292		fn: getNextPage,
293		ol: cur,
294	}
295}
296
297// OperationProperties extra Operation properties.
298type OperationProperties struct {
299	// ServiceSpecification - The service specifications.
300	ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"`
301}
302
303// OperationStatus the current status of an async operation
304type OperationStatus struct {
305	autorest.Response `json:"-"`
306	// ID - READ-ONLY; Fully qualified ID for the operation status.
307	ID *string `json:"id,omitempty"`
308	// Status - READ-ONLY; Provisioning state of the resource. Possible values include: 'StatusSucceeded', 'StatusFailed', 'StatusCanceled', 'StatusCreating', 'StatusDeleting', 'StatusMoving'
309	Status Status `json:"status,omitempty"`
310	// StartTime - READ-ONLY; The start time of the operation
311	StartTime *date.Time `json:"startTime,omitempty"`
312	// EndTime - READ-ONLY; The end time of the operation
313	EndTime *date.Time `json:"endTime,omitempty"`
314	// PercentComplete - READ-ONLY; Percent of the operation that is complete
315	PercentComplete *float64 `json:"percentComplete,omitempty"`
316	// ErrorResponse - Operation Error message
317	*ErrorResponse `json:"error,omitempty"`
318}
319
320// MarshalJSON is the custom marshaler for OperationStatus.
321func (osVar OperationStatus) MarshalJSON() ([]byte, error) {
322	objectMap := make(map[string]interface{})
323	if osVar.ErrorResponse != nil {
324		objectMap["error"] = osVar.ErrorResponse
325	}
326	return json.Marshal(objectMap)
327}
328
329// UnmarshalJSON is the custom unmarshaler for OperationStatus struct.
330func (osVar *OperationStatus) UnmarshalJSON(body []byte) error {
331	var m map[string]*json.RawMessage
332	err := json.Unmarshal(body, &m)
333	if err != nil {
334		return err
335	}
336	for k, v := range m {
337		switch k {
338		case "id":
339			if v != nil {
340				var ID string
341				err = json.Unmarshal(*v, &ID)
342				if err != nil {
343					return err
344				}
345				osVar.ID = &ID
346			}
347		case "status":
348			if v != nil {
349				var status Status
350				err = json.Unmarshal(*v, &status)
351				if err != nil {
352					return err
353				}
354				osVar.Status = status
355			}
356		case "startTime":
357			if v != nil {
358				var startTime date.Time
359				err = json.Unmarshal(*v, &startTime)
360				if err != nil {
361					return err
362				}
363				osVar.StartTime = &startTime
364			}
365		case "endTime":
366			if v != nil {
367				var endTime date.Time
368				err = json.Unmarshal(*v, &endTime)
369				if err != nil {
370					return err
371				}
372				osVar.EndTime = &endTime
373			}
374		case "percentComplete":
375			if v != nil {
376				var percentComplete float64
377				err = json.Unmarshal(*v, &percentComplete)
378				if err != nil {
379					return err
380				}
381				osVar.PercentComplete = &percentComplete
382			}
383		case "error":
384			if v != nil {
385				var errorResponse ErrorResponse
386				err = json.Unmarshal(*v, &errorResponse)
387				if err != nil {
388					return err
389				}
390				osVar.ErrorResponse = &errorResponse
391			}
392		}
393	}
394
395	return nil
396}
397
398// RegenerateKeyParameters parameters describes the request to regenerate access keys
399type RegenerateKeyParameters struct {
400	// KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary'
401	KeyType KeyType `json:"keyType,omitempty"`
402}
403
404// Resource the core properties of ARM resources.
405type Resource struct {
406	// ID - READ-ONLY; Fully qualified resource ID for the resource.
407	ID *string `json:"id,omitempty"`
408	// Name - READ-ONLY; The name of the resource.
409	Name *string `json:"name,omitempty"`
410	// Type - READ-ONLY; The type of the service - e.g. "Microsoft.Communication/CommunicationServices"
411	Type *string `json:"type,omitempty"`
412}
413
414// MarshalJSON is the custom marshaler for Resource.
415func (r Resource) MarshalJSON() ([]byte, error) {
416	objectMap := make(map[string]interface{})
417	return json.Marshal(objectMap)
418}
419
420// ServiceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
421// operation.
422type ServiceCreateOrUpdateFuture struct {
423	azure.FutureAPI
424	// Result returns the result of the asynchronous operation.
425	// If the operation has not completed it will return an error.
426	Result func(ServiceClient) (ServiceResource, error)
427}
428
429// UnmarshalJSON is the custom unmarshaller for CreateFuture.
430func (future *ServiceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
431	var azFuture azure.Future
432	if err := json.Unmarshal(body, &azFuture); err != nil {
433		return err
434	}
435	future.FutureAPI = &azFuture
436	future.Result = future.result
437	return nil
438}
439
440// result is the default implementation for ServiceCreateOrUpdateFuture.Result.
441func (future *ServiceCreateOrUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) {
442	var done bool
443	done, err = future.DoneWithContext(context.Background(), client)
444	if err != nil {
445		err = autorest.NewErrorWithError(err, "communication.ServiceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
446		return
447	}
448	if !done {
449		sr.Response.Response = future.Response()
450		err = azure.NewAsyncOpIncompleteError("communication.ServiceCreateOrUpdateFuture")
451		return
452	}
453	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
454	if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent {
455		sr, err = client.CreateOrUpdateResponder(sr.Response.Response)
456		if err != nil {
457			err = autorest.NewErrorWithError(err, "communication.ServiceCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request")
458		}
459	}
460	return
461}
462
463// ServiceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
464// operation.
465type ServiceDeleteFuture struct {
466	azure.FutureAPI
467	// Result returns the result of the asynchronous operation.
468	// If the operation has not completed it will return an error.
469	Result func(ServiceClient) (autorest.Response, error)
470}
471
472// UnmarshalJSON is the custom unmarshaller for CreateFuture.
473func (future *ServiceDeleteFuture) UnmarshalJSON(body []byte) error {
474	var azFuture azure.Future
475	if err := json.Unmarshal(body, &azFuture); err != nil {
476		return err
477	}
478	future.FutureAPI = &azFuture
479	future.Result = future.result
480	return nil
481}
482
483// result is the default implementation for ServiceDeleteFuture.Result.
484func (future *ServiceDeleteFuture) result(client ServiceClient) (ar autorest.Response, err error) {
485	var done bool
486	done, err = future.DoneWithContext(context.Background(), client)
487	if err != nil {
488		err = autorest.NewErrorWithError(err, "communication.ServiceDeleteFuture", "Result", future.Response(), "Polling failure")
489		return
490	}
491	if !done {
492		ar.Response = future.Response()
493		err = azure.NewAsyncOpIncompleteError("communication.ServiceDeleteFuture")
494		return
495	}
496	ar.Response = future.Response()
497	return
498}
499
500// ServiceKeys a class representing the access keys of a CommunicationService.
501type ServiceKeys struct {
502	autorest.Response `json:"-"`
503	// PrimaryKey - The primary access key.
504	PrimaryKey *string `json:"primaryKey,omitempty"`
505	// SecondaryKey - The secondary access key.
506	SecondaryKey *string `json:"secondaryKey,omitempty"`
507	// PrimaryConnectionString - CommunicationService connection string constructed via the primaryKey
508	PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"`
509	// SecondaryConnectionString - CommunicationService connection string constructed via the secondaryKey
510	SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"`
511}
512
513// ServiceProperties a class that describes the properties of the CommunicationService.
514type ServiceProperties struct {
515	// ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving'
516	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
517	// HostName - READ-ONLY; FQDN of the CommunicationService instance.
518	HostName *string `json:"hostName,omitempty"`
519	// DataLocation - The location where the communication service stores its data at rest.
520	DataLocation *string `json:"dataLocation,omitempty"`
521	// NotificationHubID - READ-ONLY; Resource ID of an Azure Notification Hub linked to this resource.
522	NotificationHubID *string `json:"notificationHubId,omitempty"`
523	// Version - READ-ONLY; Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs.
524	Version *string `json:"version,omitempty"`
525	// ImmutableResourceID - READ-ONLY; The immutable resource Id of the communication service.
526	ImmutableResourceID *string `json:"immutableResourceId,omitempty"`
527}
528
529// MarshalJSON is the custom marshaler for ServiceProperties.
530func (sp ServiceProperties) MarshalJSON() ([]byte, error) {
531	objectMap := make(map[string]interface{})
532	if sp.DataLocation != nil {
533		objectMap["dataLocation"] = sp.DataLocation
534	}
535	return json.Marshal(objectMap)
536}
537
538// ServiceResource a class representing a CommunicationService resource.
539type ServiceResource struct {
540	autorest.Response `json:"-"`
541	// ID - READ-ONLY; Fully qualified resource ID for the resource.
542	ID *string `json:"id,omitempty"`
543	// Name - READ-ONLY; The name of the resource.
544	Name *string `json:"name,omitempty"`
545	// Type - READ-ONLY; The type of the service - e.g. "Microsoft.Communication/CommunicationServices"
546	Type *string `json:"type,omitempty"`
547	// Location - The Azure location where the CommunicationService is running.
548	Location *string `json:"location,omitempty"`
549	// Tags - Tags of the service which is a list of key value pairs that describe the resource.
550	Tags map[string]*string `json:"tags"`
551	// ServiceProperties - The properties of the service.
552	*ServiceProperties `json:"properties,omitempty"`
553}
554
555// MarshalJSON is the custom marshaler for ServiceResource.
556func (sr ServiceResource) MarshalJSON() ([]byte, error) {
557	objectMap := make(map[string]interface{})
558	if sr.Location != nil {
559		objectMap["location"] = sr.Location
560	}
561	if sr.Tags != nil {
562		objectMap["tags"] = sr.Tags
563	}
564	if sr.ServiceProperties != nil {
565		objectMap["properties"] = sr.ServiceProperties
566	}
567	return json.Marshal(objectMap)
568}
569
570// UnmarshalJSON is the custom unmarshaler for ServiceResource struct.
571func (sr *ServiceResource) UnmarshalJSON(body []byte) error {
572	var m map[string]*json.RawMessage
573	err := json.Unmarshal(body, &m)
574	if err != nil {
575		return err
576	}
577	for k, v := range m {
578		switch k {
579		case "id":
580			if v != nil {
581				var ID string
582				err = json.Unmarshal(*v, &ID)
583				if err != nil {
584					return err
585				}
586				sr.ID = &ID
587			}
588		case "name":
589			if v != nil {
590				var name string
591				err = json.Unmarshal(*v, &name)
592				if err != nil {
593					return err
594				}
595				sr.Name = &name
596			}
597		case "type":
598			if v != nil {
599				var typeVar string
600				err = json.Unmarshal(*v, &typeVar)
601				if err != nil {
602					return err
603				}
604				sr.Type = &typeVar
605			}
606		case "location":
607			if v != nil {
608				var location string
609				err = json.Unmarshal(*v, &location)
610				if err != nil {
611					return err
612				}
613				sr.Location = &location
614			}
615		case "tags":
616			if v != nil {
617				var tags map[string]*string
618				err = json.Unmarshal(*v, &tags)
619				if err != nil {
620					return err
621				}
622				sr.Tags = tags
623			}
624		case "properties":
625			if v != nil {
626				var serviceProperties ServiceProperties
627				err = json.Unmarshal(*v, &serviceProperties)
628				if err != nil {
629					return err
630				}
631				sr.ServiceProperties = &serviceProperties
632			}
633		}
634	}
635
636	return nil
637}
638
639// ServiceResourceList object that includes an array of CommunicationServices and a possible link for next
640// set.
641type ServiceResourceList struct {
642	autorest.Response `json:"-"`
643	// Value - List of CommunicationService
644	Value *[]ServiceResource `json:"value,omitempty"`
645	// NextLink - The URL the client should use to fetch the next page (per server side paging).
646	// It's null for now, added for future use.
647	NextLink *string `json:"nextLink,omitempty"`
648}
649
650// ServiceResourceListIterator provides access to a complete listing of ServiceResource values.
651type ServiceResourceListIterator struct {
652	i    int
653	page ServiceResourceListPage
654}
655
656// NextWithContext advances to the next value.  If there was an error making
657// the request the iterator does not advance and the error is returned.
658func (iter *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) {
659	if tracing.IsEnabled() {
660		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.NextWithContext")
661		defer func() {
662			sc := -1
663			if iter.Response().Response.Response != nil {
664				sc = iter.Response().Response.Response.StatusCode
665			}
666			tracing.EndSpan(ctx, sc, err)
667		}()
668	}
669	iter.i++
670	if iter.i < len(iter.page.Values()) {
671		return nil
672	}
673	err = iter.page.NextWithContext(ctx)
674	if err != nil {
675		iter.i--
676		return err
677	}
678	iter.i = 0
679	return nil
680}
681
682// Next advances to the next value.  If there was an error making
683// the request the iterator does not advance and the error is returned.
684// Deprecated: Use NextWithContext() instead.
685func (iter *ServiceResourceListIterator) Next() error {
686	return iter.NextWithContext(context.Background())
687}
688
689// NotDone returns true if the enumeration should be started or is not yet complete.
690func (iter ServiceResourceListIterator) NotDone() bool {
691	return iter.page.NotDone() && iter.i < len(iter.page.Values())
692}
693
694// Response returns the raw server response from the last page request.
695func (iter ServiceResourceListIterator) Response() ServiceResourceList {
696	return iter.page.Response()
697}
698
699// Value returns the current value or a zero-initialized value if the
700// iterator has advanced beyond the end of the collection.
701func (iter ServiceResourceListIterator) Value() ServiceResource {
702	if !iter.page.NotDone() {
703		return ServiceResource{}
704	}
705	return iter.page.Values()[iter.i]
706}
707
708// Creates a new instance of the ServiceResourceListIterator type.
709func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator {
710	return ServiceResourceListIterator{page: page}
711}
712
713// IsEmpty returns true if the ListResult contains no values.
714func (srl ServiceResourceList) IsEmpty() bool {
715	return srl.Value == nil || len(*srl.Value) == 0
716}
717
718// hasNextLink returns true if the NextLink is not empty.
719func (srl ServiceResourceList) hasNextLink() bool {
720	return srl.NextLink != nil && len(*srl.NextLink) != 0
721}
722
723// serviceResourceListPreparer prepares a request to retrieve the next set of results.
724// It returns nil if no more results exist.
725func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) {
726	if !srl.hasNextLink() {
727		return nil, nil
728	}
729	return autorest.Prepare((&http.Request{}).WithContext(ctx),
730		autorest.AsJSON(),
731		autorest.AsGet(),
732		autorest.WithBaseURL(to.String(srl.NextLink)))
733}
734
735// ServiceResourceListPage contains a page of ServiceResource values.
736type ServiceResourceListPage struct {
737	fn  func(context.Context, ServiceResourceList) (ServiceResourceList, error)
738	srl ServiceResourceList
739}
740
741// NextWithContext advances to the next page of values.  If there was an error making
742// the request the page does not advance and the error is returned.
743func (page *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) {
744	if tracing.IsEnabled() {
745		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.NextWithContext")
746		defer func() {
747			sc := -1
748			if page.Response().Response.Response != nil {
749				sc = page.Response().Response.Response.StatusCode
750			}
751			tracing.EndSpan(ctx, sc, err)
752		}()
753	}
754	for {
755		next, err := page.fn(ctx, page.srl)
756		if err != nil {
757			return err
758		}
759		page.srl = next
760		if !next.hasNextLink() || !next.IsEmpty() {
761			break
762		}
763	}
764	return nil
765}
766
767// Next advances to the next page of values.  If there was an error making
768// the request the page does not advance and the error is returned.
769// Deprecated: Use NextWithContext() instead.
770func (page *ServiceResourceListPage) Next() error {
771	return page.NextWithContext(context.Background())
772}
773
774// NotDone returns true if the page enumeration should be started or is not yet complete.
775func (page ServiceResourceListPage) NotDone() bool {
776	return !page.srl.IsEmpty()
777}
778
779// Response returns the raw server response from the last page request.
780func (page ServiceResourceListPage) Response() ServiceResourceList {
781	return page.srl
782}
783
784// Values returns the slice of values for the current page or nil if there are no values.
785func (page ServiceResourceListPage) Values() []ServiceResource {
786	if page.srl.IsEmpty() {
787		return nil
788	}
789	return *page.srl.Value
790}
791
792// Creates a new instance of the ServiceResourceListPage type.
793func NewServiceResourceListPage(cur ServiceResourceList, getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage {
794	return ServiceResourceListPage{
795		fn:  getNextPage,
796		srl: cur,
797	}
798}
799
800// ServiceSpecification an object that describes a specification.
801type ServiceSpecification struct {
802	// MetricSpecifications - Specifications of the Metrics for Azure Monitoring.
803	MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"`
804}
805
806// TaggedResource an ARM resource with that can accept tags
807type TaggedResource struct {
808	// Tags - Tags of the service which is a list of key value pairs that describe the resource.
809	Tags map[string]*string `json:"tags"`
810}
811
812// MarshalJSON is the custom marshaler for TaggedResource.
813func (tr TaggedResource) MarshalJSON() ([]byte, error) {
814	objectMap := make(map[string]interface{})
815	if tr.Tags != nil {
816		objectMap["tags"] = tr.Tags
817	}
818	return json.Marshal(objectMap)
819}
820