1package iothub
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	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/date"
25	"github.com/Azure/go-autorest/autorest/to"
26	"net/http"
27)
28
29// AccessRightsDescription enumerates the values for access rights description.
30type AccessRightsDescription string
31
32const (
33	// DeviceConnect ...
34	DeviceConnect AccessRightsDescription = "DeviceConnect"
35	// EnrollmentRead ...
36	EnrollmentRead AccessRightsDescription = "EnrollmentRead"
37	// EnrollmentWrite ...
38	EnrollmentWrite AccessRightsDescription = "EnrollmentWrite"
39	// RegistrationStatusRead ...
40	RegistrationStatusRead AccessRightsDescription = "RegistrationStatusRead"
41	// RegistrationStatusWrite ...
42	RegistrationStatusWrite AccessRightsDescription = "RegistrationStatusWrite"
43	// ServiceConfig ...
44	ServiceConfig AccessRightsDescription = "ServiceConfig"
45)
46
47// PossibleAccessRightsDescriptionValues returns an array of possible values for the AccessRightsDescription const type.
48func PossibleAccessRightsDescriptionValues() []AccessRightsDescription {
49	return []AccessRightsDescription{DeviceConnect, EnrollmentRead, EnrollmentWrite, RegistrationStatusRead, RegistrationStatusWrite, ServiceConfig}
50}
51
52// AllocationPolicy enumerates the values for allocation policy.
53type AllocationPolicy string
54
55const (
56	// GeoLatency ...
57	GeoLatency AllocationPolicy = "GeoLatency"
58	// Hashed ...
59	Hashed AllocationPolicy = "Hashed"
60	// Static ...
61	Static AllocationPolicy = "Static"
62)
63
64// PossibleAllocationPolicyValues returns an array of possible values for the AllocationPolicy const type.
65func PossibleAllocationPolicyValues() []AllocationPolicy {
66	return []AllocationPolicy{GeoLatency, Hashed, Static}
67}
68
69// CertificatePurpose enumerates the values for certificate purpose.
70type CertificatePurpose string
71
72const (
73	// ClientAuthentication ...
74	ClientAuthentication CertificatePurpose = "clientAuthentication"
75	// ServerAuthentication ...
76	ServerAuthentication CertificatePurpose = "serverAuthentication"
77)
78
79// PossibleCertificatePurposeValues returns an array of possible values for the CertificatePurpose const type.
80func PossibleCertificatePurposeValues() []CertificatePurpose {
81	return []CertificatePurpose{ClientAuthentication, ServerAuthentication}
82}
83
84// IotDpsSku enumerates the values for iot dps sku.
85type IotDpsSku string
86
87const (
88	// S1 ...
89	S1 IotDpsSku = "S1"
90)
91
92// PossibleIotDpsSkuValues returns an array of possible values for the IotDpsSku const type.
93func PossibleIotDpsSkuValues() []IotDpsSku {
94	return []IotDpsSku{S1}
95}
96
97// NameUnavailabilityReason enumerates the values for name unavailability reason.
98type NameUnavailabilityReason string
99
100const (
101	// AlreadyExists ...
102	AlreadyExists NameUnavailabilityReason = "AlreadyExists"
103	// Invalid ...
104	Invalid NameUnavailabilityReason = "Invalid"
105)
106
107// PossibleNameUnavailabilityReasonValues returns an array of possible values for the NameUnavailabilityReason const type.
108func PossibleNameUnavailabilityReasonValues() []NameUnavailabilityReason {
109	return []NameUnavailabilityReason{AlreadyExists, Invalid}
110}
111
112// State enumerates the values for state.
113type State string
114
115const (
116	// Activating ...
117	Activating State = "Activating"
118	// ActivationFailed ...
119	ActivationFailed State = "ActivationFailed"
120	// Active ...
121	Active State = "Active"
122	// Deleted ...
123	Deleted State = "Deleted"
124	// Deleting ...
125	Deleting State = "Deleting"
126	// DeletionFailed ...
127	DeletionFailed State = "DeletionFailed"
128	// FailingOver ...
129	FailingOver State = "FailingOver"
130	// FailoverFailed ...
131	FailoverFailed State = "FailoverFailed"
132	// Resuming ...
133	Resuming State = "Resuming"
134	// Suspended ...
135	Suspended State = "Suspended"
136	// Suspending ...
137	Suspending State = "Suspending"
138	// Transitioning ...
139	Transitioning State = "Transitioning"
140)
141
142// PossibleStateValues returns an array of possible values for the State const type.
143func PossibleStateValues() []State {
144	return []State{Activating, ActivationFailed, Active, Deleted, Deleting, DeletionFailed, FailingOver, FailoverFailed, Resuming, Suspended, Suspending, Transitioning}
145}
146
147// AsyncOperationResult result of a long running operation.
148type AsyncOperationResult struct {
149	autorest.Response `json:"-"`
150	// Status - current status of a long running operation.
151	Status *string `json:"status,omitempty"`
152	// Error - Error message containing code, description and details
153	Error *ErrorMesssage `json:"error,omitempty"`
154}
155
156// CertificateBodyDescription the JSON-serialized X509 Certificate.
157type CertificateBodyDescription struct {
158	// Certificate - Base-64 representation of the X509 leaf certificate .cer file or just .pem file content.
159	Certificate *string `json:"certificate,omitempty"`
160}
161
162// CertificateListDescription the JSON-serialized array of Certificate objects.
163type CertificateListDescription struct {
164	autorest.Response `json:"-"`
165	// Value - The array of Certificate objects.
166	Value *[]CertificateResponse `json:"value,omitempty"`
167}
168
169// CertificateProperties the description of an X509 CA Certificate.
170type CertificateProperties struct {
171	// Subject - The certificate's subject name.
172	Subject *string `json:"subject,omitempty"`
173	// Expiry - The certificate's expiration date and time.
174	Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
175	// Thumbprint - The certificate's thumbprint.
176	Thumbprint *string `json:"thumbprint,omitempty"`
177	// IsVerified - Determines whether certificate has been verified.
178	IsVerified *bool `json:"isVerified,omitempty"`
179	// Created - The certificate's creation date and time.
180	Created *date.TimeRFC1123 `json:"created,omitempty"`
181	// Updated - The certificate's last update date and time.
182	Updated *date.TimeRFC1123 `json:"updated,omitempty"`
183}
184
185// CertificateResponse the X509 Certificate.
186type CertificateResponse struct {
187	autorest.Response `json:"-"`
188	// Properties - properties of a certificate
189	Properties *CertificateProperties `json:"properties,omitempty"`
190	// ID - The resource identifier.
191	ID *string `json:"id,omitempty"`
192	// Name - The name of the certificate.
193	Name *string `json:"name,omitempty"`
194	// Etag - The entity tag.
195	Etag *string `json:"etag,omitempty"`
196	// Type - The resource type.
197	Type *string `json:"type,omitempty"`
198}
199
200// DefinitionDescription description of the IoT hub.
201type DefinitionDescription struct {
202	// ApplyAllocationPolicy - flag for applying allocationPolicy or not for a given iot hub.
203	ApplyAllocationPolicy *bool `json:"applyAllocationPolicy,omitempty"`
204	// AllocationWeight - weight to apply for a given iot h.
205	AllocationWeight *int32 `json:"allocationWeight,omitempty"`
206	// Name - Host name of the IoT hub.
207	Name *string `json:"name,omitempty"`
208	// ConnectionString - Connection string og the IoT hub.
209	ConnectionString *string `json:"connectionString,omitempty"`
210	// Location - ARM region of the IoT hub.
211	Location *string `json:"location,omitempty"`
212}
213
214// ErrorDetails error details.
215type ErrorDetails struct {
216	// Code - The error code.
217	Code *string `json:"code,omitempty"`
218	// HTTPStatusCode - The HTTP status code.
219	HTTPStatusCode *string `json:"httpStatusCode,omitempty"`
220	// Message - The error message.
221	Message *string `json:"message,omitempty"`
222	// Details - The error details.
223	Details *string `json:"details,omitempty"`
224}
225
226// ErrorMesssage error response containing message and code.
227type ErrorMesssage struct {
228	// Code - standard error code
229	Code *string `json:"code,omitempty"`
230	// Message - standard error description
231	Message *string `json:"message,omitempty"`
232	// Details - detailed summary of error
233	Details *string `json:"details,omitempty"`
234}
235
236// IotDpsPropertiesDescription the service specific properties of a provisoning service, including keys, linked iot
237// hubs, current state, and system generated properties such as hostname and idScope
238type IotDpsPropertiesDescription struct {
239	// State - Current state of the provisioning service. Possible values include: 'Activating', 'Active', 'Deleting', 'Deleted', 'ActivationFailed', 'DeletionFailed', 'Transitioning', 'Suspending', 'Suspended', 'Resuming', 'FailingOver', 'FailoverFailed'
240	State State `json:"state,omitempty"`
241	// ProvisioningState - The ARM provisioning state of the provisioning service.
242	ProvisioningState *string `json:"provisioningState,omitempty"`
243	// IotHubs - List of IoT hubs assosciated with this provisioning service.
244	IotHubs *[]DefinitionDescription `json:"iotHubs,omitempty"`
245	// AllocationPolicy - Allocation policy to be used by this provisioning service. Possible values include: 'Hashed', 'GeoLatency', 'Static'
246	AllocationPolicy AllocationPolicy `json:"allocationPolicy,omitempty"`
247	// ServiceOperationsHostName - Service endpoint for provisioning service.
248	ServiceOperationsHostName *string `json:"serviceOperationsHostName,omitempty"`
249	// DeviceProvisioningHostName - Device endpoint for this provisioning service.
250	DeviceProvisioningHostName *string `json:"deviceProvisioningHostName,omitempty"`
251	// IDScope - Unique identifier of this provisioning service.
252	IDScope *string `json:"idScope,omitempty"`
253	// AuthorizationPolicies - List of authorization keys for a provisioning service.
254	AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRuleAccessRightsDescription `json:"authorizationPolicies,omitempty"`
255}
256
257// IotDpsResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
258// operation.
259type IotDpsResourceCreateOrUpdateFuture struct {
260	azure.Future
261}
262
263// Result returns the result of the asynchronous operation.
264// If the operation has not completed it will return an error.
265func (future *IotDpsResourceCreateOrUpdateFuture) Result(client IotDpsResourceClient) (psd ProvisioningServiceDescription, err error) {
266	var done bool
267	done, err = future.Done(client)
268	if err != nil {
269		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
270		return
271	}
272	if !done {
273		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceCreateOrUpdateFuture")
274		return
275	}
276	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
277	if psd.Response.Response, err = future.GetResult(sender); err == nil && psd.Response.Response.StatusCode != http.StatusNoContent {
278		psd, err = client.CreateOrUpdateResponder(psd.Response.Response)
279		if err != nil {
280			err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdateFuture", "Result", psd.Response.Response, "Failure responding to request")
281		}
282	}
283	return
284}
285
286// IotDpsResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
287type IotDpsResourceDeleteFuture struct {
288	azure.Future
289}
290
291// Result returns the result of the asynchronous operation.
292// If the operation has not completed it will return an error.
293func (future *IotDpsResourceDeleteFuture) Result(client IotDpsResourceClient) (ar autorest.Response, err error) {
294	var done bool
295	done, err = future.Done(client)
296	if err != nil {
297		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceDeleteFuture", "Result", future.Response(), "Polling failure")
298		return
299	}
300	if !done {
301		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceDeleteFuture")
302		return
303	}
304	ar.Response = future.Response()
305	return
306}
307
308// IotDpsResourceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
309type IotDpsResourceUpdateFuture struct {
310	azure.Future
311}
312
313// Result returns the result of the asynchronous operation.
314// If the operation has not completed it will return an error.
315func (future *IotDpsResourceUpdateFuture) Result(client IotDpsResourceClient) (psd ProvisioningServiceDescription, err error) {
316	var done bool
317	done, err = future.Done(client)
318	if err != nil {
319		err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceUpdateFuture", "Result", future.Response(), "Polling failure")
320		return
321	}
322	if !done {
323		err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceUpdateFuture")
324		return
325	}
326	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
327	if psd.Response.Response, err = future.GetResult(sender); err == nil && psd.Response.Response.StatusCode != http.StatusNoContent {
328		psd, err = client.UpdateResponder(psd.Response.Response)
329		if err != nil {
330			err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceUpdateFuture", "Result", psd.Response.Response, "Failure responding to request")
331		}
332	}
333	return
334}
335
336// IotDpsSkuDefinition available Sku's of tier and units.
337type IotDpsSkuDefinition struct {
338	// Name - Sku name. Possible values include: 'S1'
339	Name IotDpsSku `json:"name,omitempty"`
340}
341
342// IotDpsSkuDefinitionListResult list of available SKUs.
343type IotDpsSkuDefinitionListResult struct {
344	autorest.Response `json:"-"`
345	// Value - The list of SKU's
346	Value *[]IotDpsSkuDefinition `json:"value,omitempty"`
347	// NextLink - The next link.
348	NextLink *string `json:"nextLink,omitempty"`
349}
350
351// IotDpsSkuDefinitionListResultIterator provides access to a complete listing of IotDpsSkuDefinition values.
352type IotDpsSkuDefinitionListResultIterator struct {
353	i    int
354	page IotDpsSkuDefinitionListResultPage
355}
356
357// Next advances to the next value.  If there was an error making
358// the request the iterator does not advance and the error is returned.
359func (iter *IotDpsSkuDefinitionListResultIterator) Next() error {
360	iter.i++
361	if iter.i < len(iter.page.Values()) {
362		return nil
363	}
364	err := iter.page.Next()
365	if err != nil {
366		iter.i--
367		return err
368	}
369	iter.i = 0
370	return nil
371}
372
373// NotDone returns true if the enumeration should be started or is not yet complete.
374func (iter IotDpsSkuDefinitionListResultIterator) NotDone() bool {
375	return iter.page.NotDone() && iter.i < len(iter.page.Values())
376}
377
378// Response returns the raw server response from the last page request.
379func (iter IotDpsSkuDefinitionListResultIterator) Response() IotDpsSkuDefinitionListResult {
380	return iter.page.Response()
381}
382
383// Value returns the current value or a zero-initialized value if the
384// iterator has advanced beyond the end of the collection.
385func (iter IotDpsSkuDefinitionListResultIterator) Value() IotDpsSkuDefinition {
386	if !iter.page.NotDone() {
387		return IotDpsSkuDefinition{}
388	}
389	return iter.page.Values()[iter.i]
390}
391
392// IsEmpty returns true if the ListResult contains no values.
393func (idsdlr IotDpsSkuDefinitionListResult) IsEmpty() bool {
394	return idsdlr.Value == nil || len(*idsdlr.Value) == 0
395}
396
397// iotDpsSkuDefinitionListResultPreparer prepares a request to retrieve the next set of results.
398// It returns nil if no more results exist.
399func (idsdlr IotDpsSkuDefinitionListResult) iotDpsSkuDefinitionListResultPreparer() (*http.Request, error) {
400	if idsdlr.NextLink == nil || len(to.String(idsdlr.NextLink)) < 1 {
401		return nil, nil
402	}
403	return autorest.Prepare(&http.Request{},
404		autorest.AsJSON(),
405		autorest.AsGet(),
406		autorest.WithBaseURL(to.String(idsdlr.NextLink)))
407}
408
409// IotDpsSkuDefinitionListResultPage contains a page of IotDpsSkuDefinition values.
410type IotDpsSkuDefinitionListResultPage struct {
411	fn     func(IotDpsSkuDefinitionListResult) (IotDpsSkuDefinitionListResult, error)
412	idsdlr IotDpsSkuDefinitionListResult
413}
414
415// Next advances to the next page of values.  If there was an error making
416// the request the page does not advance and the error is returned.
417func (page *IotDpsSkuDefinitionListResultPage) Next() error {
418	next, err := page.fn(page.idsdlr)
419	if err != nil {
420		return err
421	}
422	page.idsdlr = next
423	return nil
424}
425
426// NotDone returns true if the page enumeration should be started or is not yet complete.
427func (page IotDpsSkuDefinitionListResultPage) NotDone() bool {
428	return !page.idsdlr.IsEmpty()
429}
430
431// Response returns the raw server response from the last page request.
432func (page IotDpsSkuDefinitionListResultPage) Response() IotDpsSkuDefinitionListResult {
433	return page.idsdlr
434}
435
436// Values returns the slice of values for the current page or nil if there are no values.
437func (page IotDpsSkuDefinitionListResultPage) Values() []IotDpsSkuDefinition {
438	if page.idsdlr.IsEmpty() {
439		return nil
440	}
441	return *page.idsdlr.Value
442}
443
444// IotDpsSkuInfo list of possible provisoning service SKUs.
445type IotDpsSkuInfo struct {
446	// Name - Sku name. Possible values include: 'S1'
447	Name IotDpsSku `json:"name,omitempty"`
448	// Tier - Pricing tier name of the provisioning service.
449	Tier *string `json:"tier,omitempty"`
450	// Capacity - The number of units to provision
451	Capacity *int64 `json:"capacity,omitempty"`
452}
453
454// NameAvailabilityInfo description of name availability.
455type NameAvailabilityInfo struct {
456	autorest.Response `json:"-"`
457	// NameAvailable - specifies if a name is available or not
458	NameAvailable *bool `json:"nameAvailable,omitempty"`
459	// Reason - specifies the reason a name is unavailable. Possible values include: 'Invalid', 'AlreadyExists'
460	Reason NameUnavailabilityReason `json:"reason,omitempty"`
461	// Message - message containing a etailed reason name is unavailable
462	Message *string `json:"message,omitempty"`
463}
464
465// Operation ioT Hub REST API operation.
466type Operation struct {
467	// Name - Operation name: {provider}/{resource}/{read | write | action | delete}
468	Name *string `json:"name,omitempty"`
469	// Display - The object that represents the operation.
470	Display *OperationDisplay `json:"display,omitempty"`
471}
472
473// OperationDisplay the object that represents the operation.
474type OperationDisplay struct {
475	// Provider - Service provider: Microsoft Devices.
476	Provider *string `json:"provider,omitempty"`
477	// Resource - Resource Type: ProvisioningServices.
478	Resource *string `json:"resource,omitempty"`
479	// Operation - Name of the operation.
480	Operation *string `json:"operation,omitempty"`
481}
482
483// OperationInputs input values for operation results call.
484type OperationInputs struct {
485	// Name - The name of the Provisioning Service to check.
486	Name *string `json:"name,omitempty"`
487}
488
489// OperationListResult result of the request to list IoT Hub operations. It contains a list of operations and a URL
490// link to get the next set of results.
491type OperationListResult struct {
492	autorest.Response `json:"-"`
493	// Value - List of IoT Hub operations supported by the Microsoft.Devices resource provider.
494	Value *[]Operation `json:"value,omitempty"`
495	// NextLink - URL to get the next set of operation list results if there are any.
496	NextLink *string `json:"nextLink,omitempty"`
497}
498
499// OperationListResultIterator provides access to a complete listing of Operation values.
500type OperationListResultIterator struct {
501	i    int
502	page OperationListResultPage
503}
504
505// Next advances to the next value.  If there was an error making
506// the request the iterator does not advance and the error is returned.
507func (iter *OperationListResultIterator) Next() error {
508	iter.i++
509	if iter.i < len(iter.page.Values()) {
510		return nil
511	}
512	err := iter.page.Next()
513	if err != nil {
514		iter.i--
515		return err
516	}
517	iter.i = 0
518	return nil
519}
520
521// NotDone returns true if the enumeration should be started or is not yet complete.
522func (iter OperationListResultIterator) NotDone() bool {
523	return iter.page.NotDone() && iter.i < len(iter.page.Values())
524}
525
526// Response returns the raw server response from the last page request.
527func (iter OperationListResultIterator) Response() OperationListResult {
528	return iter.page.Response()
529}
530
531// Value returns the current value or a zero-initialized value if the
532// iterator has advanced beyond the end of the collection.
533func (iter OperationListResultIterator) Value() Operation {
534	if !iter.page.NotDone() {
535		return Operation{}
536	}
537	return iter.page.Values()[iter.i]
538}
539
540// IsEmpty returns true if the ListResult contains no values.
541func (olr OperationListResult) IsEmpty() bool {
542	return olr.Value == nil || len(*olr.Value) == 0
543}
544
545// operationListResultPreparer prepares a request to retrieve the next set of results.
546// It returns nil if no more results exist.
547func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) {
548	if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {
549		return nil, nil
550	}
551	return autorest.Prepare(&http.Request{},
552		autorest.AsJSON(),
553		autorest.AsGet(),
554		autorest.WithBaseURL(to.String(olr.NextLink)))
555}
556
557// OperationListResultPage contains a page of Operation values.
558type OperationListResultPage struct {
559	fn  func(OperationListResult) (OperationListResult, error)
560	olr OperationListResult
561}
562
563// Next advances to the next page of values.  If there was an error making
564// the request the page does not advance and the error is returned.
565func (page *OperationListResultPage) Next() error {
566	next, err := page.fn(page.olr)
567	if err != nil {
568		return err
569	}
570	page.olr = next
571	return nil
572}
573
574// NotDone returns true if the page enumeration should be started or is not yet complete.
575func (page OperationListResultPage) NotDone() bool {
576	return !page.olr.IsEmpty()
577}
578
579// Response returns the raw server response from the last page request.
580func (page OperationListResultPage) Response() OperationListResult {
581	return page.olr
582}
583
584// Values returns the slice of values for the current page or nil if there are no values.
585func (page OperationListResultPage) Values() []Operation {
586	if page.olr.IsEmpty() {
587		return nil
588	}
589	return *page.olr.Value
590}
591
592// ProvisioningServiceDescription the description of the provisioning service.
593type ProvisioningServiceDescription struct {
594	autorest.Response `json:"-"`
595	// 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.
596	Etag *string `json:"etag,omitempty"`
597	// Properties - Service specific properties for a provisioning service
598	Properties *IotDpsPropertiesDescription `json:"properties,omitempty"`
599	// Sku - Sku info for a provisioning Service.
600	Sku *IotDpsSkuInfo `json:"sku,omitempty"`
601	// ID - The resource identifier.
602	ID *string `json:"id,omitempty"`
603	// Name - The resource name.
604	Name *string `json:"name,omitempty"`
605	// Type - The resource type.
606	Type *string `json:"type,omitempty"`
607	// Location - The resource location.
608	Location *string `json:"location,omitempty"`
609	// Tags - The resource tags.
610	Tags map[string]*string `json:"tags"`
611}
612
613// MarshalJSON is the custom marshaler for ProvisioningServiceDescription.
614func (psd ProvisioningServiceDescription) MarshalJSON() ([]byte, error) {
615	objectMap := make(map[string]interface{})
616	if psd.Etag != nil {
617		objectMap["etag"] = psd.Etag
618	}
619	if psd.Properties != nil {
620		objectMap["properties"] = psd.Properties
621	}
622	if psd.Sku != nil {
623		objectMap["sku"] = psd.Sku
624	}
625	if psd.ID != nil {
626		objectMap["id"] = psd.ID
627	}
628	if psd.Name != nil {
629		objectMap["name"] = psd.Name
630	}
631	if psd.Type != nil {
632		objectMap["type"] = psd.Type
633	}
634	if psd.Location != nil {
635		objectMap["location"] = psd.Location
636	}
637	if psd.Tags != nil {
638		objectMap["tags"] = psd.Tags
639	}
640	return json.Marshal(objectMap)
641}
642
643// ProvisioningServiceDescriptionListResult list of provisioning service descriptions.
644type ProvisioningServiceDescriptionListResult struct {
645	autorest.Response `json:"-"`
646	// Value - List of provisioning service descriptions.
647	Value *[]ProvisioningServiceDescription `json:"value,omitempty"`
648	// NextLink - the next link
649	NextLink *string `json:"nextLink,omitempty"`
650}
651
652// ProvisioningServiceDescriptionListResultIterator provides access to a complete listing of
653// ProvisioningServiceDescription values.
654type ProvisioningServiceDescriptionListResultIterator struct {
655	i    int
656	page ProvisioningServiceDescriptionListResultPage
657}
658
659// Next advances to the next value.  If there was an error making
660// the request the iterator does not advance and the error is returned.
661func (iter *ProvisioningServiceDescriptionListResultIterator) Next() error {
662	iter.i++
663	if iter.i < len(iter.page.Values()) {
664		return nil
665	}
666	err := iter.page.Next()
667	if err != nil {
668		iter.i--
669		return err
670	}
671	iter.i = 0
672	return nil
673}
674
675// NotDone returns true if the enumeration should be started or is not yet complete.
676func (iter ProvisioningServiceDescriptionListResultIterator) NotDone() bool {
677	return iter.page.NotDone() && iter.i < len(iter.page.Values())
678}
679
680// Response returns the raw server response from the last page request.
681func (iter ProvisioningServiceDescriptionListResultIterator) Response() ProvisioningServiceDescriptionListResult {
682	return iter.page.Response()
683}
684
685// Value returns the current value or a zero-initialized value if the
686// iterator has advanced beyond the end of the collection.
687func (iter ProvisioningServiceDescriptionListResultIterator) Value() ProvisioningServiceDescription {
688	if !iter.page.NotDone() {
689		return ProvisioningServiceDescription{}
690	}
691	return iter.page.Values()[iter.i]
692}
693
694// IsEmpty returns true if the ListResult contains no values.
695func (psdlr ProvisioningServiceDescriptionListResult) IsEmpty() bool {
696	return psdlr.Value == nil || len(*psdlr.Value) == 0
697}
698
699// provisioningServiceDescriptionListResultPreparer prepares a request to retrieve the next set of results.
700// It returns nil if no more results exist.
701func (psdlr ProvisioningServiceDescriptionListResult) provisioningServiceDescriptionListResultPreparer() (*http.Request, error) {
702	if psdlr.NextLink == nil || len(to.String(psdlr.NextLink)) < 1 {
703		return nil, nil
704	}
705	return autorest.Prepare(&http.Request{},
706		autorest.AsJSON(),
707		autorest.AsGet(),
708		autorest.WithBaseURL(to.String(psdlr.NextLink)))
709}
710
711// ProvisioningServiceDescriptionListResultPage contains a page of ProvisioningServiceDescription values.
712type ProvisioningServiceDescriptionListResultPage struct {
713	fn    func(ProvisioningServiceDescriptionListResult) (ProvisioningServiceDescriptionListResult, error)
714	psdlr ProvisioningServiceDescriptionListResult
715}
716
717// Next advances to the next page of values.  If there was an error making
718// the request the page does not advance and the error is returned.
719func (page *ProvisioningServiceDescriptionListResultPage) Next() error {
720	next, err := page.fn(page.psdlr)
721	if err != nil {
722		return err
723	}
724	page.psdlr = next
725	return nil
726}
727
728// NotDone returns true if the page enumeration should be started or is not yet complete.
729func (page ProvisioningServiceDescriptionListResultPage) NotDone() bool {
730	return !page.psdlr.IsEmpty()
731}
732
733// Response returns the raw server response from the last page request.
734func (page ProvisioningServiceDescriptionListResultPage) Response() ProvisioningServiceDescriptionListResult {
735	return page.psdlr
736}
737
738// Values returns the slice of values for the current page or nil if there are no values.
739func (page ProvisioningServiceDescriptionListResultPage) Values() []ProvisioningServiceDescription {
740	if page.psdlr.IsEmpty() {
741		return nil
742	}
743	return *page.psdlr.Value
744}
745
746// Resource the common properties of an Azure resource.
747type Resource struct {
748	// ID - The resource identifier.
749	ID *string `json:"id,omitempty"`
750	// Name - The resource name.
751	Name *string `json:"name,omitempty"`
752	// Type - The resource type.
753	Type *string `json:"type,omitempty"`
754	// Location - The resource location.
755	Location *string `json:"location,omitempty"`
756	// Tags - The resource tags.
757	Tags map[string]*string `json:"tags"`
758}
759
760// MarshalJSON is the custom marshaler for Resource.
761func (r Resource) MarshalJSON() ([]byte, error) {
762	objectMap := make(map[string]interface{})
763	if r.ID != nil {
764		objectMap["id"] = r.ID
765	}
766	if r.Name != nil {
767		objectMap["name"] = r.Name
768	}
769	if r.Type != nil {
770		objectMap["type"] = r.Type
771	}
772	if r.Location != nil {
773		objectMap["location"] = r.Location
774	}
775	if r.Tags != nil {
776		objectMap["tags"] = r.Tags
777	}
778	return json.Marshal(objectMap)
779}
780
781// SharedAccessSignatureAuthorizationRuleAccessRightsDescription description of the shared access key.
782type SharedAccessSignatureAuthorizationRuleAccessRightsDescription struct {
783	autorest.Response `json:"-"`
784	// KeyName - Name of the key.
785	KeyName *string `json:"keyName,omitempty"`
786	// PrimaryKey - Primary SAS key value.
787	PrimaryKey *string `json:"primaryKey,omitempty"`
788	// SecondaryKey - Secondary SAS key value.
789	SecondaryKey *string `json:"secondaryKey,omitempty"`
790	// Rights - Rights that this key has. Possible values include: 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', 'DeviceConnect', 'RegistrationStatusRead', 'RegistrationStatusWrite'
791	Rights AccessRightsDescription `json:"rights,omitempty"`
792}
793
794// SharedAccessSignatureAuthorizationRuleListResult list of shared access keys.
795type SharedAccessSignatureAuthorizationRuleListResult struct {
796	autorest.Response `json:"-"`
797	// Value - The list of shared access policies.
798	Value *[]SharedAccessSignatureAuthorizationRuleAccessRightsDescription `json:"value,omitempty"`
799	// NextLink - The next link.
800	NextLink *string `json:"nextLink,omitempty"`
801}
802
803// SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of
804// SharedAccessSignatureAuthorizationRuleAccessRightsDescription values.
805type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
806	i    int
807	page SharedAccessSignatureAuthorizationRuleListResultPage
808}
809
810// Next advances to the next value.  If there was an error making
811// the request the iterator does not advance and the error is returned.
812func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
813	iter.i++
814	if iter.i < len(iter.page.Values()) {
815		return nil
816	}
817	err := iter.page.Next()
818	if err != nil {
819		iter.i--
820		return err
821	}
822	iter.i = 0
823	return nil
824}
825
826// NotDone returns true if the enumeration should be started or is not yet complete.
827func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
828	return iter.page.NotDone() && iter.i < len(iter.page.Values())
829}
830
831// Response returns the raw server response from the last page request.
832func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
833	return iter.page.Response()
834}
835
836// Value returns the current value or a zero-initialized value if the
837// iterator has advanced beyond the end of the collection.
838func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRuleAccessRightsDescription {
839	if !iter.page.NotDone() {
840		return SharedAccessSignatureAuthorizationRuleAccessRightsDescription{}
841	}
842	return iter.page.Values()[iter.i]
843}
844
845// IsEmpty returns true if the ListResult contains no values.
846func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
847	return sasarlr.Value == nil || len(*sasarlr.Value) == 0
848}
849
850// sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
851// It returns nil if no more results exist.
852func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer() (*http.Request, error) {
853	if sasarlr.NextLink == nil || len(to.String(sasarlr.NextLink)) < 1 {
854		return nil, nil
855	}
856	return autorest.Prepare(&http.Request{},
857		autorest.AsJSON(),
858		autorest.AsGet(),
859		autorest.WithBaseURL(to.String(sasarlr.NextLink)))
860}
861
862// SharedAccessSignatureAuthorizationRuleListResultPage contains a page of
863// SharedAccessSignatureAuthorizationRuleAccessRightsDescription values.
864type SharedAccessSignatureAuthorizationRuleListResultPage struct {
865	fn      func(SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
866	sasarlr SharedAccessSignatureAuthorizationRuleListResult
867}
868
869// Next advances to the next page of values.  If there was an error making
870// the request the page does not advance and the error is returned.
871func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
872	next, err := page.fn(page.sasarlr)
873	if err != nil {
874		return err
875	}
876	page.sasarlr = next
877	return nil
878}
879
880// NotDone returns true if the page enumeration should be started or is not yet complete.
881func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
882	return !page.sasarlr.IsEmpty()
883}
884
885// Response returns the raw server response from the last page request.
886func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
887	return page.sasarlr
888}
889
890// Values returns the slice of values for the current page or nil if there are no values.
891func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRuleAccessRightsDescription {
892	if page.sasarlr.IsEmpty() {
893		return nil
894	}
895	return *page.sasarlr.Value
896}
897
898// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a
899// Provisioning Service instance.
900type TagsResource struct {
901	// Tags - Resource tags
902	Tags map[string]*string `json:"tags"`
903}
904
905// MarshalJSON is the custom marshaler for TagsResource.
906func (tr TagsResource) MarshalJSON() ([]byte, error) {
907	objectMap := make(map[string]interface{})
908	if tr.Tags != nil {
909		objectMap["tags"] = tr.Tags
910	}
911	return json.Marshal(objectMap)
912}
913
914// VerificationCodeRequest the JSON-serialized leaf certificate
915type VerificationCodeRequest struct {
916	// Certificate - base-64 representation of X509 certificate .cer file or just .pem file content.
917	Certificate *string `json:"certificate,omitempty"`
918}
919
920// VerificationCodeResponse description of the response of the verification code.
921type VerificationCodeResponse struct {
922	autorest.Response `json:"-"`
923	// Name - Name of certificate.
924	Name *string `json:"name,omitempty"`
925	// Etag - Request etag.
926	Etag *string `json:"etag,omitempty"`
927	// ID - The resource identifier.
928	ID *string `json:"id,omitempty"`
929	// Type - The resource type.
930	Type       *string                             `json:"type,omitempty"`
931	Properties *VerificationCodeResponseProperties `json:"properties,omitempty"`
932}
933
934// VerificationCodeResponseProperties ...
935type VerificationCodeResponseProperties struct {
936	// VerificationCode - Verification code.
937	VerificationCode *string `json:"verificationCode,omitempty"`
938	// Subject - Certificate subject.
939	Subject *string `json:"subject,omitempty"`
940	// Expiry - Code expiry.
941	Expiry *string `json:"expiry,omitempty"`
942	// Thumbprint - Certificate thumbprint.
943	Thumbprint *string `json:"thumbprint,omitempty"`
944	// IsVerified - Indicate if the certificate is verified by owner of private key.
945	IsVerified *bool `json:"isVerified,omitempty"`
946	// Created - Certificate created time.
947	Created *string `json:"created,omitempty"`
948	// Updated - Certificate updated time.
949	Updated *string `json:"updated,omitempty"`
950}
951