1package devices
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/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"net/http"
29)
30
31// The package's fully qualified name.
32const fqdn = "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2016-02-03/devices"
33
34// AccessRights enumerates the values for access rights.
35type AccessRights string
36
37const (
38	// DeviceConnect ...
39	DeviceConnect AccessRights = "DeviceConnect"
40	// RegistryRead ...
41	RegistryRead AccessRights = "RegistryRead"
42	// RegistryReadDeviceConnect ...
43	RegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect"
44	// RegistryReadRegistryWrite ...
45	RegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite"
46	// RegistryReadRegistryWriteDeviceConnect ...
47	RegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect"
48	// RegistryReadRegistryWriteServiceConnect ...
49	RegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect"
50	// RegistryReadRegistryWriteServiceConnectDeviceConnect ...
51	RegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"
52	// RegistryReadServiceConnect ...
53	RegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect"
54	// RegistryReadServiceConnectDeviceConnect ...
55	RegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect"
56	// RegistryWrite ...
57	RegistryWrite AccessRights = "RegistryWrite"
58	// RegistryWriteDeviceConnect ...
59	RegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect"
60	// RegistryWriteServiceConnect ...
61	RegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect"
62	// RegistryWriteServiceConnectDeviceConnect ...
63	RegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect"
64	// ServiceConnect ...
65	ServiceConnect AccessRights = "ServiceConnect"
66	// ServiceConnectDeviceConnect ...
67	ServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect"
68)
69
70// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type.
71func PossibleAccessRightsValues() []AccessRights {
72	return []AccessRights{DeviceConnect, RegistryRead, RegistryReadDeviceConnect, RegistryReadRegistryWrite, RegistryReadRegistryWriteDeviceConnect, RegistryReadRegistryWriteServiceConnect, RegistryReadRegistryWriteServiceConnectDeviceConnect, RegistryReadServiceConnect, RegistryReadServiceConnectDeviceConnect, RegistryWrite, RegistryWriteDeviceConnect, RegistryWriteServiceConnect, RegistryWriteServiceConnectDeviceConnect, ServiceConnect, ServiceConnectDeviceConnect}
73}
74
75// Capabilities enumerates the values for capabilities.
76type Capabilities string
77
78const (
79	// DeviceManagement ...
80	DeviceManagement Capabilities = "DeviceManagement"
81	// None ...
82	None Capabilities = "None"
83)
84
85// PossibleCapabilitiesValues returns an array of possible values for the Capabilities const type.
86func PossibleCapabilitiesValues() []Capabilities {
87	return []Capabilities{DeviceManagement, None}
88}
89
90// IotHubNameUnavailabilityReason enumerates the values for iot hub name unavailability reason.
91type IotHubNameUnavailabilityReason string
92
93const (
94	// AlreadyExists ...
95	AlreadyExists IotHubNameUnavailabilityReason = "AlreadyExists"
96	// Invalid ...
97	Invalid IotHubNameUnavailabilityReason = "Invalid"
98)
99
100// PossibleIotHubNameUnavailabilityReasonValues returns an array of possible values for the IotHubNameUnavailabilityReason const type.
101func PossibleIotHubNameUnavailabilityReasonValues() []IotHubNameUnavailabilityReason {
102	return []IotHubNameUnavailabilityReason{AlreadyExists, Invalid}
103}
104
105// IotHubScaleType enumerates the values for iot hub scale type.
106type IotHubScaleType string
107
108const (
109	// IotHubScaleTypeAutomatic ...
110	IotHubScaleTypeAutomatic IotHubScaleType = "Automatic"
111	// IotHubScaleTypeManual ...
112	IotHubScaleTypeManual IotHubScaleType = "Manual"
113	// IotHubScaleTypeNone ...
114	IotHubScaleTypeNone IotHubScaleType = "None"
115)
116
117// PossibleIotHubScaleTypeValues returns an array of possible values for the IotHubScaleType const type.
118func PossibleIotHubScaleTypeValues() []IotHubScaleType {
119	return []IotHubScaleType{IotHubScaleTypeAutomatic, IotHubScaleTypeManual, IotHubScaleTypeNone}
120}
121
122// IotHubSku enumerates the values for iot hub sku.
123type IotHubSku string
124
125const (
126	// F1 ...
127	F1 IotHubSku = "F1"
128	// S1 ...
129	S1 IotHubSku = "S1"
130	// S2 ...
131	S2 IotHubSku = "S2"
132	// S3 ...
133	S3 IotHubSku = "S3"
134)
135
136// PossibleIotHubSkuValues returns an array of possible values for the IotHubSku const type.
137func PossibleIotHubSkuValues() []IotHubSku {
138	return []IotHubSku{F1, S1, S2, S3}
139}
140
141// IotHubSkuTier enumerates the values for iot hub sku tier.
142type IotHubSkuTier string
143
144const (
145	// Free ...
146	Free IotHubSkuTier = "Free"
147	// Standard ...
148	Standard IotHubSkuTier = "Standard"
149)
150
151// PossibleIotHubSkuTierValues returns an array of possible values for the IotHubSkuTier const type.
152func PossibleIotHubSkuTierValues() []IotHubSkuTier {
153	return []IotHubSkuTier{Free, Standard}
154}
155
156// IPFilterActionType enumerates the values for ip filter action type.
157type IPFilterActionType string
158
159const (
160	// Accept ...
161	Accept IPFilterActionType = "Accept"
162	// Reject ...
163	Reject IPFilterActionType = "Reject"
164)
165
166// PossibleIPFilterActionTypeValues returns an array of possible values for the IPFilterActionType const type.
167func PossibleIPFilterActionTypeValues() []IPFilterActionType {
168	return []IPFilterActionType{Accept, Reject}
169}
170
171// JobStatus enumerates the values for job status.
172type JobStatus string
173
174const (
175	// Cancelled ...
176	Cancelled JobStatus = "cancelled"
177	// Completed ...
178	Completed JobStatus = "completed"
179	// Enqueued ...
180	Enqueued JobStatus = "enqueued"
181	// Failed ...
182	Failed JobStatus = "failed"
183	// Running ...
184	Running JobStatus = "running"
185	// Unknown ...
186	Unknown JobStatus = "unknown"
187)
188
189// PossibleJobStatusValues returns an array of possible values for the JobStatus const type.
190func PossibleJobStatusValues() []JobStatus {
191	return []JobStatus{Cancelled, Completed, Enqueued, Failed, Running, Unknown}
192}
193
194// JobType enumerates the values for job type.
195type JobType string
196
197const (
198	// JobTypeBackup ...
199	JobTypeBackup JobType = "backup"
200	// JobTypeExport ...
201	JobTypeExport JobType = "export"
202	// JobTypeFactoryResetDevice ...
203	JobTypeFactoryResetDevice JobType = "factoryResetDevice"
204	// JobTypeFirmwareUpdate ...
205	JobTypeFirmwareUpdate JobType = "firmwareUpdate"
206	// JobTypeImport ...
207	JobTypeImport JobType = "import"
208	// JobTypeReadDeviceProperties ...
209	JobTypeReadDeviceProperties JobType = "readDeviceProperties"
210	// JobTypeRebootDevice ...
211	JobTypeRebootDevice JobType = "rebootDevice"
212	// JobTypeUnknown ...
213	JobTypeUnknown JobType = "unknown"
214	// JobTypeUpdateDeviceConfiguration ...
215	JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration"
216	// JobTypeWriteDeviceProperties ...
217	JobTypeWriteDeviceProperties JobType = "writeDeviceProperties"
218)
219
220// PossibleJobTypeValues returns an array of possible values for the JobType const type.
221func PossibleJobTypeValues() []JobType {
222	return []JobType{JobTypeBackup, JobTypeExport, JobTypeFactoryResetDevice, JobTypeFirmwareUpdate, JobTypeImport, JobTypeReadDeviceProperties, JobTypeRebootDevice, JobTypeUnknown, JobTypeUpdateDeviceConfiguration, JobTypeWriteDeviceProperties}
223}
224
225// OperationMonitoringLevel enumerates the values for operation monitoring level.
226type OperationMonitoringLevel string
227
228const (
229	// OperationMonitoringLevelError ...
230	OperationMonitoringLevelError OperationMonitoringLevel = "Error"
231	// OperationMonitoringLevelErrorInformation ...
232	OperationMonitoringLevelErrorInformation OperationMonitoringLevel = "Error, Information"
233	// OperationMonitoringLevelInformation ...
234	OperationMonitoringLevelInformation OperationMonitoringLevel = "Information"
235	// OperationMonitoringLevelNone ...
236	OperationMonitoringLevelNone OperationMonitoringLevel = "None"
237)
238
239// PossibleOperationMonitoringLevelValues returns an array of possible values for the OperationMonitoringLevel const type.
240func PossibleOperationMonitoringLevelValues() []OperationMonitoringLevel {
241	return []OperationMonitoringLevel{OperationMonitoringLevelError, OperationMonitoringLevelErrorInformation, OperationMonitoringLevelInformation, OperationMonitoringLevelNone}
242}
243
244// CloudToDeviceProperties the IoT hub cloud-to-device messaging properties.
245type CloudToDeviceProperties struct {
246	// MaxDeliveryCount - The max delivery count for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
247	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
248	// DefaultTTLAsIso8601 - The default time to live for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
249	DefaultTTLAsIso8601 *string             `json:"defaultTtlAsIso8601,omitempty"`
250	Feedback            *FeedbackProperties `json:"feedback,omitempty"`
251}
252
253// ErrorDetails error details.
254type ErrorDetails struct {
255	// Code - READ-ONLY; The error code.
256	Code *string `json:"Code,omitempty"`
257	// HTTPStatusCode - READ-ONLY; The HTTP status code.
258	HTTPStatusCode *string `json:"HttpStatusCode,omitempty"`
259	// Message - READ-ONLY; The error message.
260	Message *string `json:"Message,omitempty"`
261	// Details - READ-ONLY; The error details.
262	Details *string `json:"Details,omitempty"`
263}
264
265// EventHubConsumerGroupInfo the properties of the EventHubConsumerGroupInfo object.
266type EventHubConsumerGroupInfo struct {
267	autorest.Response `json:"-"`
268	// Tags - The tags.
269	Tags map[string]*string `json:"tags"`
270	// ID - The Event Hub-compatible consumer group identifier.
271	ID *string `json:"id,omitempty"`
272	// Name - The Event Hub-compatible consumer group name.
273	Name *string `json:"name,omitempty"`
274}
275
276// MarshalJSON is the custom marshaler for EventHubConsumerGroupInfo.
277func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) {
278	objectMap := make(map[string]interface{})
279	if ehcgi.Tags != nil {
280		objectMap["tags"] = ehcgi.Tags
281	}
282	if ehcgi.ID != nil {
283		objectMap["id"] = ehcgi.ID
284	}
285	if ehcgi.Name != nil {
286		objectMap["name"] = ehcgi.Name
287	}
288	return json.Marshal(objectMap)
289}
290
291// EventHubConsumerGroupsListResult the JSON-serialized array of Event Hub-compatible consumer group names
292// with a next link.
293type EventHubConsumerGroupsListResult struct {
294	autorest.Response `json:"-"`
295	// Value - The array of Event Hub-compatible consumer group names.
296	Value *[]string `json:"value,omitempty"`
297	// NextLink - READ-ONLY; The next link.
298	NextLink *string `json:"nextLink,omitempty"`
299}
300
301// EventHubConsumerGroupsListResultIterator provides access to a complete listing of string values.
302type EventHubConsumerGroupsListResultIterator struct {
303	i    int
304	page EventHubConsumerGroupsListResultPage
305}
306
307// NextWithContext advances to the next value.  If there was an error making
308// the request the iterator does not advance and the error is returned.
309func (iter *EventHubConsumerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) {
310	if tracing.IsEnabled() {
311		ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultIterator.NextWithContext")
312		defer func() {
313			sc := -1
314			if iter.Response().Response.Response != nil {
315				sc = iter.Response().Response.Response.StatusCode
316			}
317			tracing.EndSpan(ctx, sc, err)
318		}()
319	}
320	iter.i++
321	if iter.i < len(iter.page.Values()) {
322		return nil
323	}
324	err = iter.page.NextWithContext(ctx)
325	if err != nil {
326		iter.i--
327		return err
328	}
329	iter.i = 0
330	return nil
331}
332
333// Next advances to the next value.  If there was an error making
334// the request the iterator does not advance and the error is returned.
335// Deprecated: Use NextWithContext() instead.
336func (iter *EventHubConsumerGroupsListResultIterator) Next() error {
337	return iter.NextWithContext(context.Background())
338}
339
340// NotDone returns true if the enumeration should be started or is not yet complete.
341func (iter EventHubConsumerGroupsListResultIterator) NotDone() bool {
342	return iter.page.NotDone() && iter.i < len(iter.page.Values())
343}
344
345// Response returns the raw server response from the last page request.
346func (iter EventHubConsumerGroupsListResultIterator) Response() EventHubConsumerGroupsListResult {
347	return iter.page.Response()
348}
349
350// Value returns the current value or a zero-initialized value if the
351// iterator has advanced beyond the end of the collection.
352func (iter EventHubConsumerGroupsListResultIterator) Value() string {
353	if !iter.page.NotDone() {
354		return ""
355	}
356	return iter.page.Values()[iter.i]
357}
358
359// Creates a new instance of the EventHubConsumerGroupsListResultIterator type.
360func NewEventHubConsumerGroupsListResultIterator(page EventHubConsumerGroupsListResultPage) EventHubConsumerGroupsListResultIterator {
361	return EventHubConsumerGroupsListResultIterator{page: page}
362}
363
364// IsEmpty returns true if the ListResult contains no values.
365func (ehcglr EventHubConsumerGroupsListResult) IsEmpty() bool {
366	return ehcglr.Value == nil || len(*ehcglr.Value) == 0
367}
368
369// eventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results.
370// It returns nil if no more results exist.
371func (ehcglr EventHubConsumerGroupsListResult) eventHubConsumerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) {
372	if ehcglr.NextLink == nil || len(to.String(ehcglr.NextLink)) < 1 {
373		return nil, nil
374	}
375	return autorest.Prepare((&http.Request{}).WithContext(ctx),
376		autorest.AsJSON(),
377		autorest.AsGet(),
378		autorest.WithBaseURL(to.String(ehcglr.NextLink)))
379}
380
381// EventHubConsumerGroupsListResultPage contains a page of string values.
382type EventHubConsumerGroupsListResultPage struct {
383	fn     func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)
384	ehcglr EventHubConsumerGroupsListResult
385}
386
387// NextWithContext advances to the next page of values.  If there was an error making
388// the request the page does not advance and the error is returned.
389func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) {
390	if tracing.IsEnabled() {
391		ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultPage.NextWithContext")
392		defer func() {
393			sc := -1
394			if page.Response().Response.Response != nil {
395				sc = page.Response().Response.Response.StatusCode
396			}
397			tracing.EndSpan(ctx, sc, err)
398		}()
399	}
400	next, err := page.fn(ctx, page.ehcglr)
401	if err != nil {
402		return err
403	}
404	page.ehcglr = next
405	return nil
406}
407
408// Next advances to the next page of values.  If there was an error making
409// the request the page does not advance and the error is returned.
410// Deprecated: Use NextWithContext() instead.
411func (page *EventHubConsumerGroupsListResultPage) Next() error {
412	return page.NextWithContext(context.Background())
413}
414
415// NotDone returns true if the page enumeration should be started or is not yet complete.
416func (page EventHubConsumerGroupsListResultPage) NotDone() bool {
417	return !page.ehcglr.IsEmpty()
418}
419
420// Response returns the raw server response from the last page request.
421func (page EventHubConsumerGroupsListResultPage) Response() EventHubConsumerGroupsListResult {
422	return page.ehcglr
423}
424
425// Values returns the slice of values for the current page or nil if there are no values.
426func (page EventHubConsumerGroupsListResultPage) Values() []string {
427	if page.ehcglr.IsEmpty() {
428		return nil
429	}
430	return *page.ehcglr.Value
431}
432
433// Creates a new instance of the EventHubConsumerGroupsListResultPage type.
434func NewEventHubConsumerGroupsListResultPage(getNextPage func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)) EventHubConsumerGroupsListResultPage {
435	return EventHubConsumerGroupsListResultPage{fn: getNextPage}
436}
437
438// EventHubProperties the properties of the provisioned Event Hub-compatible endpoint used by the IoT hub.
439type EventHubProperties struct {
440	// RetentionTimeInDays - The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages
441	RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"`
442	// PartitionCount - The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages.
443	PartitionCount *int32 `json:"partitionCount,omitempty"`
444	// PartitionIds - READ-ONLY; The partition ids in the Event Hub-compatible endpoint.
445	PartitionIds *[]string `json:"partitionIds,omitempty"`
446	// Path - READ-ONLY; The Event Hub-compatible name.
447	Path *string `json:"path,omitempty"`
448	// Endpoint - READ-ONLY; The Event Hub-compatible endpoint.
449	Endpoint *string `json:"endpoint,omitempty"`
450}
451
452// ExportDevicesRequest use to provide parameters when requesting an export of all devices in the IoT hub.
453type ExportDevicesRequest struct {
454	// ExportBlobContainerURI - The export blob container URI.
455	ExportBlobContainerURI *string `json:"ExportBlobContainerUri,omitempty"`
456	// ExcludeKeys - The value indicating whether keys should be excluded during export.
457	ExcludeKeys *bool `json:"ExcludeKeys,omitempty"`
458}
459
460// FeedbackProperties the properties of the feedback queue for cloud-to-device messages.
461type FeedbackProperties struct {
462	// LockDurationAsIso8601 - The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
463	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
464	// TTLAsIso8601 - The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
465	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
466	// MaxDeliveryCount - The number of times the IoT hub attempts to deliver a message on the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
467	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
468}
469
470// ImportDevicesRequest use to provide parameters when requesting an import of all devices in the hub.
471type ImportDevicesRequest struct {
472	// InputBlobContainerURI - The input blob container URI.
473	InputBlobContainerURI *string `json:"InputBlobContainerUri,omitempty"`
474	// OutputBlobContainerURI - The output blob container URI.
475	OutputBlobContainerURI *string `json:"OutputBlobContainerUri,omitempty"`
476}
477
478// IotHubCapacity ioT Hub capacity information.
479type IotHubCapacity struct {
480	// Minimum - READ-ONLY; The minimum number of units.
481	Minimum *int64 `json:"minimum,omitempty"`
482	// Maximum - READ-ONLY; The maximum number of units.
483	Maximum *int64 `json:"maximum,omitempty"`
484	// Default - READ-ONLY; The default number of units.
485	Default *int64 `json:"default,omitempty"`
486	// ScaleType - READ-ONLY; The type of the scaling enabled. Possible values include: 'IotHubScaleTypeAutomatic', 'IotHubScaleTypeManual', 'IotHubScaleTypeNone'
487	ScaleType IotHubScaleType `json:"scaleType,omitempty"`
488}
489
490// IotHubDescription the description of the IoT hub.
491type IotHubDescription struct {
492	autorest.Response `json:"-"`
493	// Subscriptionid - The subscription identifier.
494	Subscriptionid *string `json:"subscriptionid,omitempty"`
495	// Resourcegroup - The name of the resource group that contains the IoT hub. A resource group name uniquely identifies the resource group within the subscription.
496	Resourcegroup *string `json:"resourcegroup,omitempty"`
497	// Etag - The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.
498	Etag       *string           `json:"etag,omitempty"`
499	Properties *IotHubProperties `json:"properties,omitempty"`
500	Sku        *IotHubSkuInfo    `json:"sku,omitempty"`
501	// ID - READ-ONLY; The resource identifier.
502	ID *string `json:"id,omitempty"`
503	// Name - READ-ONLY; The resource name.
504	Name *string `json:"name,omitempty"`
505	// Type - READ-ONLY; The resource type.
506	Type *string `json:"type,omitempty"`
507	// Location - The resource location.
508	Location *string `json:"location,omitempty"`
509	// Tags - The resource tags.
510	Tags map[string]*string `json:"tags"`
511}
512
513// MarshalJSON is the custom marshaler for IotHubDescription.
514func (ihd IotHubDescription) MarshalJSON() ([]byte, error) {
515	objectMap := make(map[string]interface{})
516	if ihd.Subscriptionid != nil {
517		objectMap["subscriptionid"] = ihd.Subscriptionid
518	}
519	if ihd.Resourcegroup != nil {
520		objectMap["resourcegroup"] = ihd.Resourcegroup
521	}
522	if ihd.Etag != nil {
523		objectMap["etag"] = ihd.Etag
524	}
525	if ihd.Properties != nil {
526		objectMap["properties"] = ihd.Properties
527	}
528	if ihd.Sku != nil {
529		objectMap["sku"] = ihd.Sku
530	}
531	if ihd.Location != nil {
532		objectMap["location"] = ihd.Location
533	}
534	if ihd.Tags != nil {
535		objectMap["tags"] = ihd.Tags
536	}
537	return json.Marshal(objectMap)
538}
539
540// IotHubDescriptionListResult the JSON-serialized array of IotHubDescription objects with a next link.
541type IotHubDescriptionListResult struct {
542	autorest.Response `json:"-"`
543	// Value - The array of IotHubDescription objects.
544	Value *[]IotHubDescription `json:"value,omitempty"`
545	// NextLink - READ-ONLY; The next link.
546	NextLink *string `json:"nextLink,omitempty"`
547}
548
549// IotHubDescriptionListResultIterator provides access to a complete listing of IotHubDescription values.
550type IotHubDescriptionListResultIterator struct {
551	i    int
552	page IotHubDescriptionListResultPage
553}
554
555// NextWithContext advances to the next value.  If there was an error making
556// the request the iterator does not advance and the error is returned.
557func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
558	if tracing.IsEnabled() {
559		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext")
560		defer func() {
561			sc := -1
562			if iter.Response().Response.Response != nil {
563				sc = iter.Response().Response.Response.StatusCode
564			}
565			tracing.EndSpan(ctx, sc, err)
566		}()
567	}
568	iter.i++
569	if iter.i < len(iter.page.Values()) {
570		return nil
571	}
572	err = iter.page.NextWithContext(ctx)
573	if err != nil {
574		iter.i--
575		return err
576	}
577	iter.i = 0
578	return nil
579}
580
581// Next advances to the next value.  If there was an error making
582// the request the iterator does not advance and the error is returned.
583// Deprecated: Use NextWithContext() instead.
584func (iter *IotHubDescriptionListResultIterator) Next() error {
585	return iter.NextWithContext(context.Background())
586}
587
588// NotDone returns true if the enumeration should be started or is not yet complete.
589func (iter IotHubDescriptionListResultIterator) NotDone() bool {
590	return iter.page.NotDone() && iter.i < len(iter.page.Values())
591}
592
593// Response returns the raw server response from the last page request.
594func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult {
595	return iter.page.Response()
596}
597
598// Value returns the current value or a zero-initialized value if the
599// iterator has advanced beyond the end of the collection.
600func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription {
601	if !iter.page.NotDone() {
602		return IotHubDescription{}
603	}
604	return iter.page.Values()[iter.i]
605}
606
607// Creates a new instance of the IotHubDescriptionListResultIterator type.
608func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator {
609	return IotHubDescriptionListResultIterator{page: page}
610}
611
612// IsEmpty returns true if the ListResult contains no values.
613func (ihdlr IotHubDescriptionListResult) IsEmpty() bool {
614	return ihdlr.Value == nil || len(*ihdlr.Value) == 0
615}
616
617// iotHubDescriptionListResultPreparer prepares a request to retrieve the next set of results.
618// It returns nil if no more results exist.
619func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
620	if ihdlr.NextLink == nil || len(to.String(ihdlr.NextLink)) < 1 {
621		return nil, nil
622	}
623	return autorest.Prepare((&http.Request{}).WithContext(ctx),
624		autorest.AsJSON(),
625		autorest.AsGet(),
626		autorest.WithBaseURL(to.String(ihdlr.NextLink)))
627}
628
629// IotHubDescriptionListResultPage contains a page of IotHubDescription values.
630type IotHubDescriptionListResultPage struct {
631	fn    func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)
632	ihdlr IotHubDescriptionListResult
633}
634
635// NextWithContext advances to the next page of values.  If there was an error making
636// the request the page does not advance and the error is returned.
637func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
638	if tracing.IsEnabled() {
639		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext")
640		defer func() {
641			sc := -1
642			if page.Response().Response.Response != nil {
643				sc = page.Response().Response.Response.StatusCode
644			}
645			tracing.EndSpan(ctx, sc, err)
646		}()
647	}
648	next, err := page.fn(ctx, page.ihdlr)
649	if err != nil {
650		return err
651	}
652	page.ihdlr = next
653	return nil
654}
655
656// Next advances to the next page of values.  If there was an error making
657// the request the page does not advance and the error is returned.
658// Deprecated: Use NextWithContext() instead.
659func (page *IotHubDescriptionListResultPage) Next() error {
660	return page.NextWithContext(context.Background())
661}
662
663// NotDone returns true if the page enumeration should be started or is not yet complete.
664func (page IotHubDescriptionListResultPage) NotDone() bool {
665	return !page.ihdlr.IsEmpty()
666}
667
668// Response returns the raw server response from the last page request.
669func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult {
670	return page.ihdlr
671}
672
673// Values returns the slice of values for the current page or nil if there are no values.
674func (page IotHubDescriptionListResultPage) Values() []IotHubDescription {
675	if page.ihdlr.IsEmpty() {
676		return nil
677	}
678	return *page.ihdlr.Value
679}
680
681// Creates a new instance of the IotHubDescriptionListResultPage type.
682func NewIotHubDescriptionListResultPage(getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage {
683	return IotHubDescriptionListResultPage{fn: getNextPage}
684}
685
686// IotHubNameAvailabilityInfo the properties indicating whether a given IoT hub name is available.
687type IotHubNameAvailabilityInfo struct {
688	autorest.Response `json:"-"`
689	// NameAvailable - READ-ONLY; The value which indicates whether the provided name is available.
690	NameAvailable *bool `json:"nameAvailable,omitempty"`
691	// Reason - READ-ONLY; The reason for unavailability. Possible values include: 'Invalid', 'AlreadyExists'
692	Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"`
693	// Message - The detailed reason message.
694	Message *string `json:"message,omitempty"`
695}
696
697// IotHubProperties the properties of an IoT hub.
698type IotHubProperties struct {
699	// AuthorizationPolicies - The shared access policies you can use to secure a connection to the IoT hub.
700	AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"`
701	// IPFilterRules - The IP filter rules.
702	IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"`
703	// ProvisioningState - READ-ONLY; The provisioning state.
704	ProvisioningState *string `json:"provisioningState,omitempty"`
705	// HostName - READ-ONLY; The name of the host.
706	HostName *string `json:"hostName,omitempty"`
707	// EventHubEndpoints - The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub.
708	EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"`
709	// StorageEndpoints - The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown.
710	StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"`
711	// MessagingEndpoints - The messaging endpoint properties for the file upload notification queue.
712	MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"`
713	// EnableFileUploadNotifications - If True, file upload notifications are enabled.
714	EnableFileUploadNotifications *bool                    `json:"enableFileUploadNotifications,omitempty"`
715	CloudToDevice                 *CloudToDeviceProperties `json:"cloudToDevice,omitempty"`
716	// Comments - Comments.
717	Comments                       *string                         `json:"comments,omitempty"`
718	OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"`
719	// Features - The capabilities and features enabled for the IoT hub. Possible values include: 'None', 'DeviceManagement'
720	Features Capabilities `json:"features,omitempty"`
721}
722
723// MarshalJSON is the custom marshaler for IotHubProperties.
724func (ihp IotHubProperties) MarshalJSON() ([]byte, error) {
725	objectMap := make(map[string]interface{})
726	if ihp.AuthorizationPolicies != nil {
727		objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies
728	}
729	if ihp.IPFilterRules != nil {
730		objectMap["ipFilterRules"] = ihp.IPFilterRules
731	}
732	if ihp.EventHubEndpoints != nil {
733		objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints
734	}
735	if ihp.StorageEndpoints != nil {
736		objectMap["storageEndpoints"] = ihp.StorageEndpoints
737	}
738	if ihp.MessagingEndpoints != nil {
739		objectMap["messagingEndpoints"] = ihp.MessagingEndpoints
740	}
741	if ihp.EnableFileUploadNotifications != nil {
742		objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications
743	}
744	if ihp.CloudToDevice != nil {
745		objectMap["cloudToDevice"] = ihp.CloudToDevice
746	}
747	if ihp.Comments != nil {
748		objectMap["comments"] = ihp.Comments
749	}
750	if ihp.OperationsMonitoringProperties != nil {
751		objectMap["operationsMonitoringProperties"] = ihp.OperationsMonitoringProperties
752	}
753	if ihp.Features != "" {
754		objectMap["features"] = ihp.Features
755	}
756	return json.Marshal(objectMap)
757}
758
759// IotHubQuotaMetricInfo quota metrics properties.
760type IotHubQuotaMetricInfo struct {
761	// Name - READ-ONLY; The name of the quota metric.
762	Name *string `json:"Name,omitempty"`
763	// CurrentValue - READ-ONLY; The current value for the quota metric.
764	CurrentValue *int64 `json:"CurrentValue,omitempty"`
765	// MaxValue - READ-ONLY; The maximum value of the quota metric.
766	MaxValue *int64 `json:"MaxValue,omitempty"`
767}
768
769// IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next
770// link.
771type IotHubQuotaMetricInfoListResult struct {
772	autorest.Response `json:"-"`
773	// Value - The array of quota metrics objects.
774	Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"`
775	// NextLink - READ-ONLY; The next link.
776	NextLink *string `json:"nextLink,omitempty"`
777}
778
779// IotHubQuotaMetricInfoListResultIterator provides access to a complete listing of IotHubQuotaMetricInfo
780// values.
781type IotHubQuotaMetricInfoListResultIterator struct {
782	i    int
783	page IotHubQuotaMetricInfoListResultPage
784}
785
786// NextWithContext advances to the next value.  If there was an error making
787// the request the iterator does not advance and the error is returned.
788func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
789	if tracing.IsEnabled() {
790		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext")
791		defer func() {
792			sc := -1
793			if iter.Response().Response.Response != nil {
794				sc = iter.Response().Response.Response.StatusCode
795			}
796			tracing.EndSpan(ctx, sc, err)
797		}()
798	}
799	iter.i++
800	if iter.i < len(iter.page.Values()) {
801		return nil
802	}
803	err = iter.page.NextWithContext(ctx)
804	if err != nil {
805		iter.i--
806		return err
807	}
808	iter.i = 0
809	return nil
810}
811
812// Next advances to the next value.  If there was an error making
813// the request the iterator does not advance and the error is returned.
814// Deprecated: Use NextWithContext() instead.
815func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error {
816	return iter.NextWithContext(context.Background())
817}
818
819// NotDone returns true if the enumeration should be started or is not yet complete.
820func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool {
821	return iter.page.NotDone() && iter.i < len(iter.page.Values())
822}
823
824// Response returns the raw server response from the last page request.
825func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult {
826	return iter.page.Response()
827}
828
829// Value returns the current value or a zero-initialized value if the
830// iterator has advanced beyond the end of the collection.
831func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo {
832	if !iter.page.NotDone() {
833		return IotHubQuotaMetricInfo{}
834	}
835	return iter.page.Values()[iter.i]
836}
837
838// Creates a new instance of the IotHubQuotaMetricInfoListResultIterator type.
839func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator {
840	return IotHubQuotaMetricInfoListResultIterator{page: page}
841}
842
843// IsEmpty returns true if the ListResult contains no values.
844func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool {
845	return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0
846}
847
848// iotHubQuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results.
849// It returns nil if no more results exist.
850func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) {
851	if ihqmilr.NextLink == nil || len(to.String(ihqmilr.NextLink)) < 1 {
852		return nil, nil
853	}
854	return autorest.Prepare((&http.Request{}).WithContext(ctx),
855		autorest.AsJSON(),
856		autorest.AsGet(),
857		autorest.WithBaseURL(to.String(ihqmilr.NextLink)))
858}
859
860// IotHubQuotaMetricInfoListResultPage contains a page of IotHubQuotaMetricInfo values.
861type IotHubQuotaMetricInfoListResultPage struct {
862	fn      func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)
863	ihqmilr IotHubQuotaMetricInfoListResult
864}
865
866// NextWithContext advances to the next page of values.  If there was an error making
867// the request the page does not advance and the error is returned.
868func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) {
869	if tracing.IsEnabled() {
870		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext")
871		defer func() {
872			sc := -1
873			if page.Response().Response.Response != nil {
874				sc = page.Response().Response.Response.StatusCode
875			}
876			tracing.EndSpan(ctx, sc, err)
877		}()
878	}
879	next, err := page.fn(ctx, page.ihqmilr)
880	if err != nil {
881		return err
882	}
883	page.ihqmilr = next
884	return nil
885}
886
887// Next advances to the next page of values.  If there was an error making
888// the request the page does not advance and the error is returned.
889// Deprecated: Use NextWithContext() instead.
890func (page *IotHubQuotaMetricInfoListResultPage) Next() error {
891	return page.NextWithContext(context.Background())
892}
893
894// NotDone returns true if the page enumeration should be started or is not yet complete.
895func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool {
896	return !page.ihqmilr.IsEmpty()
897}
898
899// Response returns the raw server response from the last page request.
900func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult {
901	return page.ihqmilr
902}
903
904// Values returns the slice of values for the current page or nil if there are no values.
905func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo {
906	if page.ihqmilr.IsEmpty() {
907		return nil
908	}
909	return *page.ihqmilr.Value
910}
911
912// Creates a new instance of the IotHubQuotaMetricInfoListResultPage type.
913func NewIotHubQuotaMetricInfoListResultPage(getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage {
914	return IotHubQuotaMetricInfoListResultPage{fn: getNextPage}
915}
916
917// IotHubResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
918// long-running operation.
919type IotHubResourceCreateOrUpdateFuture struct {
920	azure.Future
921}
922
923// Result returns the result of the asynchronous operation.
924// If the operation has not completed it will return an error.
925func (future *IotHubResourceCreateOrUpdateFuture) Result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
926	var done bool
927	done, err = future.DoneWithContext(context.Background(), client)
928	if err != nil {
929		err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
930		return
931	}
932	if !done {
933		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture")
934		return
935	}
936	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
937	if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
938		ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response)
939		if err != nil {
940			err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
941		}
942	}
943	return
944}
945
946// IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
947// operation.
948type IotHubResourceDeleteFuture struct {
949	azure.Future
950}
951
952// Result returns the result of the asynchronous operation.
953// If the operation has not completed it will return an error.
954func (future *IotHubResourceDeleteFuture) Result(client IotHubResourceClient) (so SetObject, err error) {
955	var done bool
956	done, err = future.DoneWithContext(context.Background(), client)
957	if err != nil {
958		err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure")
959		return
960	}
961	if !done {
962		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture")
963		return
964	}
965	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
966	if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {
967		so, err = client.DeleteResponder(so.Response.Response)
968		if err != nil {
969			err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request")
970		}
971	}
972	return
973}
974
975// IotHubSkuDescription SKU properties.
976type IotHubSkuDescription struct {
977	// ResourceType - READ-ONLY; The type of the resource.
978	ResourceType *string         `json:"resourceType,omitempty"`
979	Sku          *IotHubSkuInfo  `json:"sku,omitempty"`
980	Capacity     *IotHubCapacity `json:"capacity,omitempty"`
981}
982
983// IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next
984// link.
985type IotHubSkuDescriptionListResult struct {
986	autorest.Response `json:"-"`
987	// Value - The array of IotHubSkuDescription.
988	Value *[]IotHubSkuDescription `json:"value,omitempty"`
989	// NextLink - READ-ONLY; The next link.
990	NextLink *string `json:"nextLink,omitempty"`
991}
992
993// IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription
994// values.
995type IotHubSkuDescriptionListResultIterator struct {
996	i    int
997	page IotHubSkuDescriptionListResultPage
998}
999
1000// NextWithContext advances to the next value.  If there was an error making
1001// the request the iterator does not advance and the error is returned.
1002func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
1003	if tracing.IsEnabled() {
1004		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext")
1005		defer func() {
1006			sc := -1
1007			if iter.Response().Response.Response != nil {
1008				sc = iter.Response().Response.Response.StatusCode
1009			}
1010			tracing.EndSpan(ctx, sc, err)
1011		}()
1012	}
1013	iter.i++
1014	if iter.i < len(iter.page.Values()) {
1015		return nil
1016	}
1017	err = iter.page.NextWithContext(ctx)
1018	if err != nil {
1019		iter.i--
1020		return err
1021	}
1022	iter.i = 0
1023	return nil
1024}
1025
1026// Next advances to the next value.  If there was an error making
1027// the request the iterator does not advance and the error is returned.
1028// Deprecated: Use NextWithContext() instead.
1029func (iter *IotHubSkuDescriptionListResultIterator) Next() error {
1030	return iter.NextWithContext(context.Background())
1031}
1032
1033// NotDone returns true if the enumeration should be started or is not yet complete.
1034func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool {
1035	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1036}
1037
1038// Response returns the raw server response from the last page request.
1039func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult {
1040	return iter.page.Response()
1041}
1042
1043// Value returns the current value or a zero-initialized value if the
1044// iterator has advanced beyond the end of the collection.
1045func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription {
1046	if !iter.page.NotDone() {
1047		return IotHubSkuDescription{}
1048	}
1049	return iter.page.Values()[iter.i]
1050}
1051
1052// Creates a new instance of the IotHubSkuDescriptionListResultIterator type.
1053func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator {
1054	return IotHubSkuDescriptionListResultIterator{page: page}
1055}
1056
1057// IsEmpty returns true if the ListResult contains no values.
1058func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool {
1059	return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0
1060}
1061
1062// iotHubSkuDescriptionListResultPreparer prepares a request to retrieve the next set of results.
1063// It returns nil if no more results exist.
1064func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
1065	if ihsdlr.NextLink == nil || len(to.String(ihsdlr.NextLink)) < 1 {
1066		return nil, nil
1067	}
1068	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1069		autorest.AsJSON(),
1070		autorest.AsGet(),
1071		autorest.WithBaseURL(to.String(ihsdlr.NextLink)))
1072}
1073
1074// IotHubSkuDescriptionListResultPage contains a page of IotHubSkuDescription values.
1075type IotHubSkuDescriptionListResultPage struct {
1076	fn     func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)
1077	ihsdlr IotHubSkuDescriptionListResult
1078}
1079
1080// NextWithContext advances to the next page of values.  If there was an error making
1081// the request the page does not advance and the error is returned.
1082func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
1083	if tracing.IsEnabled() {
1084		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext")
1085		defer func() {
1086			sc := -1
1087			if page.Response().Response.Response != nil {
1088				sc = page.Response().Response.Response.StatusCode
1089			}
1090			tracing.EndSpan(ctx, sc, err)
1091		}()
1092	}
1093	next, err := page.fn(ctx, page.ihsdlr)
1094	if err != nil {
1095		return err
1096	}
1097	page.ihsdlr = next
1098	return nil
1099}
1100
1101// Next advances to the next page of values.  If there was an error making
1102// the request the page does not advance and the error is returned.
1103// Deprecated: Use NextWithContext() instead.
1104func (page *IotHubSkuDescriptionListResultPage) Next() error {
1105	return page.NextWithContext(context.Background())
1106}
1107
1108// NotDone returns true if the page enumeration should be started or is not yet complete.
1109func (page IotHubSkuDescriptionListResultPage) NotDone() bool {
1110	return !page.ihsdlr.IsEmpty()
1111}
1112
1113// Response returns the raw server response from the last page request.
1114func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult {
1115	return page.ihsdlr
1116}
1117
1118// Values returns the slice of values for the current page or nil if there are no values.
1119func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription {
1120	if page.ihsdlr.IsEmpty() {
1121		return nil
1122	}
1123	return *page.ihsdlr.Value
1124}
1125
1126// Creates a new instance of the IotHubSkuDescriptionListResultPage type.
1127func NewIotHubSkuDescriptionListResultPage(getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage {
1128	return IotHubSkuDescriptionListResultPage{fn: getNextPage}
1129}
1130
1131// IotHubSkuInfo information about the SKU of the IoT hub.
1132type IotHubSkuInfo struct {
1133	// Name - The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3'
1134	Name IotHubSku `json:"name,omitempty"`
1135	// Tier - READ-ONLY; The billing tier for the IoT hub. Possible values include: 'Free', 'Standard'
1136	Tier IotHubSkuTier `json:"tier,omitempty"`
1137	// Capacity - The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits.
1138	Capacity *int64 `json:"capacity,omitempty"`
1139}
1140
1141// IPFilterRule the IP filter rules for the IoT hub.
1142type IPFilterRule struct {
1143	// FilterName - The name of the IP filter rule.
1144	FilterName *string `json:"filterName,omitempty"`
1145	// Action - The desired action for requests captured by this rule. Possible values include: 'Accept', 'Reject'
1146	Action IPFilterActionType `json:"action,omitempty"`
1147	// IPMask - A string that contains the IP address range in CIDR notation for the rule.
1148	IPMask *string `json:"ipMask,omitempty"`
1149}
1150
1151// JobResponse the properties of the Job Response object.
1152type JobResponse struct {
1153	autorest.Response `json:"-"`
1154	// JobID - READ-ONLY; The job identifier.
1155	JobID *string `json:"jobId,omitempty"`
1156	// StartTimeUtc - READ-ONLY; The start time of the job.
1157	StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"`
1158	// EndTimeUtc - READ-ONLY; The time the job stopped processing.
1159	EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"`
1160	// Type - READ-ONLY; The type of the job. Possible values include: 'JobTypeUnknown', 'JobTypeExport', 'JobTypeImport', 'JobTypeBackup', 'JobTypeReadDeviceProperties', 'JobTypeWriteDeviceProperties', 'JobTypeUpdateDeviceConfiguration', 'JobTypeRebootDevice', 'JobTypeFactoryResetDevice', 'JobTypeFirmwareUpdate'
1161	Type JobType `json:"type,omitempty"`
1162	// Status - READ-ONLY; The status of the job. Possible values include: 'Unknown', 'Enqueued', 'Running', 'Completed', 'Failed', 'Cancelled'
1163	Status JobStatus `json:"status,omitempty"`
1164	// FailureReason - READ-ONLY; If status == failed, this string containing the reason for the failure.
1165	FailureReason *string `json:"failureReason,omitempty"`
1166	// StatusMessage - READ-ONLY; The status message for the job.
1167	StatusMessage *string `json:"statusMessage,omitempty"`
1168	// ParentJobID - READ-ONLY; The job identifier of the parent job, if any.
1169	ParentJobID *string `json:"parentJobId,omitempty"`
1170}
1171
1172// JobResponseListResult the JSON-serialized array of JobResponse objects with a next link.
1173type JobResponseListResult struct {
1174	autorest.Response `json:"-"`
1175	// Value - The array of JobResponse objects.
1176	Value *[]JobResponse `json:"value,omitempty"`
1177	// NextLink - READ-ONLY; The next link.
1178	NextLink *string `json:"nextLink,omitempty"`
1179}
1180
1181// JobResponseListResultIterator provides access to a complete listing of JobResponse values.
1182type JobResponseListResultIterator struct {
1183	i    int
1184	page JobResponseListResultPage
1185}
1186
1187// NextWithContext advances to the next value.  If there was an error making
1188// the request the iterator does not advance and the error is returned.
1189func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) {
1190	if tracing.IsEnabled() {
1191		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext")
1192		defer func() {
1193			sc := -1
1194			if iter.Response().Response.Response != nil {
1195				sc = iter.Response().Response.Response.StatusCode
1196			}
1197			tracing.EndSpan(ctx, sc, err)
1198		}()
1199	}
1200	iter.i++
1201	if iter.i < len(iter.page.Values()) {
1202		return nil
1203	}
1204	err = iter.page.NextWithContext(ctx)
1205	if err != nil {
1206		iter.i--
1207		return err
1208	}
1209	iter.i = 0
1210	return nil
1211}
1212
1213// Next advances to the next value.  If there was an error making
1214// the request the iterator does not advance and the error is returned.
1215// Deprecated: Use NextWithContext() instead.
1216func (iter *JobResponseListResultIterator) Next() error {
1217	return iter.NextWithContext(context.Background())
1218}
1219
1220// NotDone returns true if the enumeration should be started or is not yet complete.
1221func (iter JobResponseListResultIterator) NotDone() bool {
1222	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1223}
1224
1225// Response returns the raw server response from the last page request.
1226func (iter JobResponseListResultIterator) Response() JobResponseListResult {
1227	return iter.page.Response()
1228}
1229
1230// Value returns the current value or a zero-initialized value if the
1231// iterator has advanced beyond the end of the collection.
1232func (iter JobResponseListResultIterator) Value() JobResponse {
1233	if !iter.page.NotDone() {
1234		return JobResponse{}
1235	}
1236	return iter.page.Values()[iter.i]
1237}
1238
1239// Creates a new instance of the JobResponseListResultIterator type.
1240func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator {
1241	return JobResponseListResultIterator{page: page}
1242}
1243
1244// IsEmpty returns true if the ListResult contains no values.
1245func (jrlr JobResponseListResult) IsEmpty() bool {
1246	return jrlr.Value == nil || len(*jrlr.Value) == 0
1247}
1248
1249// jobResponseListResultPreparer prepares a request to retrieve the next set of results.
1250// It returns nil if no more results exist.
1251func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) {
1252	if jrlr.NextLink == nil || len(to.String(jrlr.NextLink)) < 1 {
1253		return nil, nil
1254	}
1255	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1256		autorest.AsJSON(),
1257		autorest.AsGet(),
1258		autorest.WithBaseURL(to.String(jrlr.NextLink)))
1259}
1260
1261// JobResponseListResultPage contains a page of JobResponse values.
1262type JobResponseListResultPage struct {
1263	fn   func(context.Context, JobResponseListResult) (JobResponseListResult, error)
1264	jrlr JobResponseListResult
1265}
1266
1267// NextWithContext advances to the next page of values.  If there was an error making
1268// the request the page does not advance and the error is returned.
1269func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) {
1270	if tracing.IsEnabled() {
1271		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext")
1272		defer func() {
1273			sc := -1
1274			if page.Response().Response.Response != nil {
1275				sc = page.Response().Response.Response.StatusCode
1276			}
1277			tracing.EndSpan(ctx, sc, err)
1278		}()
1279	}
1280	next, err := page.fn(ctx, page.jrlr)
1281	if err != nil {
1282		return err
1283	}
1284	page.jrlr = next
1285	return nil
1286}
1287
1288// Next advances to the next page of values.  If there was an error making
1289// the request the page does not advance and the error is returned.
1290// Deprecated: Use NextWithContext() instead.
1291func (page *JobResponseListResultPage) Next() error {
1292	return page.NextWithContext(context.Background())
1293}
1294
1295// NotDone returns true if the page enumeration should be started or is not yet complete.
1296func (page JobResponseListResultPage) NotDone() bool {
1297	return !page.jrlr.IsEmpty()
1298}
1299
1300// Response returns the raw server response from the last page request.
1301func (page JobResponseListResultPage) Response() JobResponseListResult {
1302	return page.jrlr
1303}
1304
1305// Values returns the slice of values for the current page or nil if there are no values.
1306func (page JobResponseListResultPage) Values() []JobResponse {
1307	if page.jrlr.IsEmpty() {
1308		return nil
1309	}
1310	return *page.jrlr.Value
1311}
1312
1313// Creates a new instance of the JobResponseListResultPage type.
1314func NewJobResponseListResultPage(getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage {
1315	return JobResponseListResultPage{fn: getNextPage}
1316}
1317
1318// MessagingEndpointProperties the properties of the messaging endpoints used by this IoT hub.
1319type MessagingEndpointProperties struct {
1320	// LockDurationAsIso8601 - The lock duration. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload.
1321	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
1322	// TTLAsIso8601 - The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload.
1323	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
1324	// MaxDeliveryCount - The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload.
1325	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
1326}
1327
1328// OperationInputs input values.
1329type OperationInputs struct {
1330	// Name - The name of the IoT hub to check.
1331	Name *string `json:"Name,omitempty"`
1332}
1333
1334// OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys
1335// to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations,
1336// FileUploadOperations.
1337type OperationsMonitoringProperties struct {
1338	Events map[string]*OperationMonitoringLevel `json:"events"`
1339}
1340
1341// MarshalJSON is the custom marshaler for OperationsMonitoringProperties.
1342func (omp OperationsMonitoringProperties) MarshalJSON() ([]byte, error) {
1343	objectMap := make(map[string]interface{})
1344	if omp.Events != nil {
1345		objectMap["events"] = omp.Events
1346	}
1347	return json.Marshal(objectMap)
1348}
1349
1350// RegistryStatistics identity registry statistics.
1351type RegistryStatistics struct {
1352	autorest.Response `json:"-"`
1353	// TotalDeviceCount - READ-ONLY; The total count of devices in the identity registry.
1354	TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"`
1355	// EnabledDeviceCount - READ-ONLY; The count of enabled devices in the identity registry.
1356	EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"`
1357	// DisabledDeviceCount - READ-ONLY; The count of disabled devices in the identity registry.
1358	DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"`
1359}
1360
1361// Resource the common properties of an Azure resource.
1362type Resource struct {
1363	// ID - READ-ONLY; The resource identifier.
1364	ID *string `json:"id,omitempty"`
1365	// Name - READ-ONLY; The resource name.
1366	Name *string `json:"name,omitempty"`
1367	// Type - READ-ONLY; The resource type.
1368	Type *string `json:"type,omitempty"`
1369	// Location - The resource location.
1370	Location *string `json:"location,omitempty"`
1371	// Tags - The resource tags.
1372	Tags map[string]*string `json:"tags"`
1373}
1374
1375// MarshalJSON is the custom marshaler for Resource.
1376func (r Resource) MarshalJSON() ([]byte, error) {
1377	objectMap := make(map[string]interface{})
1378	if r.Location != nil {
1379		objectMap["location"] = r.Location
1380	}
1381	if r.Tags != nil {
1382		objectMap["tags"] = r.Tags
1383	}
1384	return json.Marshal(objectMap)
1385}
1386
1387// SetObject ...
1388type SetObject struct {
1389	autorest.Response `json:"-"`
1390	Value             interface{} `json:"value,omitempty"`
1391}
1392
1393// SharedAccessSignatureAuthorizationRule the properties of an IoT hub shared access policy.
1394type SharedAccessSignatureAuthorizationRule struct {
1395	autorest.Response `json:"-"`
1396	// KeyName - The name of the shared access policy.
1397	KeyName *string `json:"keyName,omitempty"`
1398	// PrimaryKey - The primary key.
1399	PrimaryKey *string `json:"primaryKey,omitempty"`
1400	// SecondaryKey - The secondary key.
1401	SecondaryKey *string `json:"secondaryKey,omitempty"`
1402	// Rights - The permissions assigned to the shared access policy. Possible values include: 'RegistryRead', 'RegistryWrite', 'ServiceConnect', 'DeviceConnect', 'RegistryReadRegistryWrite', 'RegistryReadServiceConnect', 'RegistryReadDeviceConnect', 'RegistryWriteServiceConnect', 'RegistryWriteDeviceConnect', 'ServiceConnectDeviceConnect', 'RegistryReadRegistryWriteServiceConnect', 'RegistryReadRegistryWriteDeviceConnect', 'RegistryReadServiceConnectDeviceConnect', 'RegistryWriteServiceConnectDeviceConnect', 'RegistryReadRegistryWriteServiceConnectDeviceConnect'
1403	Rights AccessRights `json:"rights,omitempty"`
1404}
1405
1406// SharedAccessSignatureAuthorizationRuleListResult the list of shared access policies with a next link.
1407type SharedAccessSignatureAuthorizationRuleListResult struct {
1408	autorest.Response `json:"-"`
1409	// Value - The list of shared access policies.
1410	Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"`
1411	// NextLink - READ-ONLY; The next link.
1412	NextLink *string `json:"nextLink,omitempty"`
1413}
1414
1415// SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of
1416// SharedAccessSignatureAuthorizationRule values.
1417type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
1418	i    int
1419	page SharedAccessSignatureAuthorizationRuleListResultPage
1420}
1421
1422// NextWithContext advances to the next value.  If there was an error making
1423// the request the iterator does not advance and the error is returned.
1424func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
1425	if tracing.IsEnabled() {
1426		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
1427		defer func() {
1428			sc := -1
1429			if iter.Response().Response.Response != nil {
1430				sc = iter.Response().Response.Response.StatusCode
1431			}
1432			tracing.EndSpan(ctx, sc, err)
1433		}()
1434	}
1435	iter.i++
1436	if iter.i < len(iter.page.Values()) {
1437		return nil
1438	}
1439	err = iter.page.NextWithContext(ctx)
1440	if err != nil {
1441		iter.i--
1442		return err
1443	}
1444	iter.i = 0
1445	return nil
1446}
1447
1448// Next advances to the next value.  If there was an error making
1449// the request the iterator does not advance and the error is returned.
1450// Deprecated: Use NextWithContext() instead.
1451func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
1452	return iter.NextWithContext(context.Background())
1453}
1454
1455// NotDone returns true if the enumeration should be started or is not yet complete.
1456func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
1457	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1458}
1459
1460// Response returns the raw server response from the last page request.
1461func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
1462	return iter.page.Response()
1463}
1464
1465// Value returns the current value or a zero-initialized value if the
1466// iterator has advanced beyond the end of the collection.
1467func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule {
1468	if !iter.page.NotDone() {
1469		return SharedAccessSignatureAuthorizationRule{}
1470	}
1471	return iter.page.Values()[iter.i]
1472}
1473
1474// Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type.
1475func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
1476	return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
1477}
1478
1479// IsEmpty returns true if the ListResult contains no values.
1480func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
1481	return sasarlr.Value == nil || len(*sasarlr.Value) == 0
1482}
1483
1484// sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
1485// It returns nil if no more results exist.
1486func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
1487	if sasarlr.NextLink == nil || len(to.String(sasarlr.NextLink)) < 1 {
1488		return nil, nil
1489	}
1490	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1491		autorest.AsJSON(),
1492		autorest.AsGet(),
1493		autorest.WithBaseURL(to.String(sasarlr.NextLink)))
1494}
1495
1496// SharedAccessSignatureAuthorizationRuleListResultPage contains a page of
1497// SharedAccessSignatureAuthorizationRule values.
1498type SharedAccessSignatureAuthorizationRuleListResultPage struct {
1499	fn      func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
1500	sasarlr SharedAccessSignatureAuthorizationRuleListResult
1501}
1502
1503// NextWithContext advances to the next page of values.  If there was an error making
1504// the request the page does not advance and the error is returned.
1505func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
1506	if tracing.IsEnabled() {
1507		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
1508		defer func() {
1509			sc := -1
1510			if page.Response().Response.Response != nil {
1511				sc = page.Response().Response.Response.StatusCode
1512			}
1513			tracing.EndSpan(ctx, sc, err)
1514		}()
1515	}
1516	next, err := page.fn(ctx, page.sasarlr)
1517	if err != nil {
1518		return err
1519	}
1520	page.sasarlr = next
1521	return nil
1522}
1523
1524// Next advances to the next page of values.  If there was an error making
1525// the request the page does not advance and the error is returned.
1526// Deprecated: Use NextWithContext() instead.
1527func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
1528	return page.NextWithContext(context.Background())
1529}
1530
1531// NotDone returns true if the page enumeration should be started or is not yet complete.
1532func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
1533	return !page.sasarlr.IsEmpty()
1534}
1535
1536// Response returns the raw server response from the last page request.
1537func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
1538	return page.sasarlr
1539}
1540
1541// Values returns the slice of values for the current page or nil if there are no values.
1542func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule {
1543	if page.sasarlr.IsEmpty() {
1544		return nil
1545	}
1546	return *page.sasarlr.Value
1547}
1548
1549// Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type.
1550func NewSharedAccessSignatureAuthorizationRuleListResultPage(getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
1551	return SharedAccessSignatureAuthorizationRuleListResultPage{fn: getNextPage}
1552}
1553
1554// StorageEndpointProperties the properties of the Azure Storage endpoint for file upload.
1555type StorageEndpointProperties struct {
1556	// SasTTLAsIso8601 - The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options.
1557	SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"`
1558	// ConnectionString - The connection string for the Azure Storage account to which files are uploaded.
1559	ConnectionString *string `json:"connectionString,omitempty"`
1560	// ContainerName - The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.
1561	ContainerName *string `json:"containerName,omitempty"`
1562}
1563