...

Source file src/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-04-01/devices/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-04-01/devices

     1  package devices
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/azure"
    14  	"github.com/Azure/go-autorest/autorest/date"
    15  	"github.com/Azure/go-autorest/autorest/to"
    16  	"github.com/Azure/go-autorest/tracing"
    17  	"net/http"
    18  )
    19  
    20  // The package's fully qualified name.
    21  const fqdn = "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-04-01/devices"
    22  
    23  // CertificateBodyDescription the JSON-serialized X509 Certificate.
    24  type CertificateBodyDescription struct {
    25  	// Certificate - base-64 representation of the X509 leaf certificate .cer file or just .pem file content.
    26  	Certificate *string `json:"certificate,omitempty"`
    27  }
    28  
    29  // CertificateDescription the X509 Certificate.
    30  type CertificateDescription struct {
    31  	autorest.Response `json:"-"`
    32  	Properties        *CertificateProperties `json:"properties,omitempty"`
    33  	// ID - READ-ONLY; The resource identifier.
    34  	ID *string `json:"id,omitempty"`
    35  	// Name - READ-ONLY; The name of the certificate.
    36  	Name *string `json:"name,omitempty"`
    37  	// Etag - READ-ONLY; The entity tag.
    38  	Etag *string `json:"etag,omitempty"`
    39  	// Type - READ-ONLY; The resource type.
    40  	Type *string `json:"type,omitempty"`
    41  }
    42  
    43  // MarshalJSON is the custom marshaler for CertificateDescription.
    44  func (cd CertificateDescription) MarshalJSON() ([]byte, error) {
    45  	objectMap := make(map[string]interface{})
    46  	if cd.Properties != nil {
    47  		objectMap["properties"] = cd.Properties
    48  	}
    49  	return json.Marshal(objectMap)
    50  }
    51  
    52  // CertificateListDescription the JSON-serialized array of Certificate objects.
    53  type CertificateListDescription struct {
    54  	autorest.Response `json:"-"`
    55  	// Value - The array of Certificate objects.
    56  	Value *[]CertificateDescription `json:"value,omitempty"`
    57  }
    58  
    59  // CertificateProperties the description of an X509 CA Certificate.
    60  type CertificateProperties struct {
    61  	// Subject - READ-ONLY; The certificate's subject name.
    62  	Subject *string `json:"subject,omitempty"`
    63  	// Expiry - READ-ONLY; The certificate's expiration date and time.
    64  	Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
    65  	// Thumbprint - READ-ONLY; The certificate's thumbprint.
    66  	Thumbprint *string `json:"thumbprint,omitempty"`
    67  	// IsVerified - READ-ONLY; Determines whether certificate has been verified.
    68  	IsVerified *bool `json:"isVerified,omitempty"`
    69  	// Created - READ-ONLY; The certificate's create date and time.
    70  	Created *date.TimeRFC1123 `json:"created,omitempty"`
    71  	// Updated - READ-ONLY; The certificate's last update date and time.
    72  	Updated *date.TimeRFC1123 `json:"updated,omitempty"`
    73  	// Certificate - The certificate content
    74  	Certificate *string `json:"certificate,omitempty"`
    75  }
    76  
    77  // MarshalJSON is the custom marshaler for CertificateProperties.
    78  func (cp CertificateProperties) MarshalJSON() ([]byte, error) {
    79  	objectMap := make(map[string]interface{})
    80  	if cp.Certificate != nil {
    81  		objectMap["certificate"] = cp.Certificate
    82  	}
    83  	return json.Marshal(objectMap)
    84  }
    85  
    86  // CertificatePropertiesWithNonce the description of an X509 CA Certificate including the challenge nonce
    87  // issued for the Proof-Of-Possession flow.
    88  type CertificatePropertiesWithNonce struct {
    89  	// Subject - READ-ONLY; The certificate's subject name.
    90  	Subject *string `json:"subject,omitempty"`
    91  	// Expiry - READ-ONLY; The certificate's expiration date and time.
    92  	Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
    93  	// Thumbprint - READ-ONLY; The certificate's thumbprint.
    94  	Thumbprint *string `json:"thumbprint,omitempty"`
    95  	// IsVerified - READ-ONLY; Determines whether certificate has been verified.
    96  	IsVerified *bool `json:"isVerified,omitempty"`
    97  	// Created - READ-ONLY; The certificate's create date and time.
    98  	Created *date.TimeRFC1123 `json:"created,omitempty"`
    99  	// Updated - READ-ONLY; The certificate's last update date and time.
   100  	Updated *date.TimeRFC1123 `json:"updated,omitempty"`
   101  	// VerificationCode - READ-ONLY; The certificate's verification code that will be used for proof of possession.
   102  	VerificationCode *string `json:"verificationCode,omitempty"`
   103  	// Certificate - READ-ONLY; The certificate content
   104  	Certificate *string `json:"certificate,omitempty"`
   105  }
   106  
   107  // MarshalJSON is the custom marshaler for CertificatePropertiesWithNonce.
   108  func (cpwn CertificatePropertiesWithNonce) MarshalJSON() ([]byte, error) {
   109  	objectMap := make(map[string]interface{})
   110  	return json.Marshal(objectMap)
   111  }
   112  
   113  // CertificateVerificationDescription the JSON-serialized leaf certificate
   114  type CertificateVerificationDescription struct {
   115  	// Certificate - base-64 representation of X509 certificate .cer file or just .pem file content.
   116  	Certificate *string `json:"certificate,omitempty"`
   117  }
   118  
   119  // CertificateWithNonceDescription the X509 Certificate.
   120  type CertificateWithNonceDescription struct {
   121  	autorest.Response `json:"-"`
   122  	Properties        *CertificatePropertiesWithNonce `json:"properties,omitempty"`
   123  	// ID - READ-ONLY; The resource identifier.
   124  	ID *string `json:"id,omitempty"`
   125  	// Name - READ-ONLY; The name of the certificate.
   126  	Name *string `json:"name,omitempty"`
   127  	// Etag - READ-ONLY; The entity tag.
   128  	Etag *string `json:"etag,omitempty"`
   129  	// Type - READ-ONLY; The resource type.
   130  	Type *string `json:"type,omitempty"`
   131  }
   132  
   133  // MarshalJSON is the custom marshaler for CertificateWithNonceDescription.
   134  func (cwnd CertificateWithNonceDescription) MarshalJSON() ([]byte, error) {
   135  	objectMap := make(map[string]interface{})
   136  	if cwnd.Properties != nil {
   137  		objectMap["properties"] = cwnd.Properties
   138  	}
   139  	return json.Marshal(objectMap)
   140  }
   141  
   142  // CloudToDeviceProperties the IoT hub cloud-to-device messaging properties.
   143  type CloudToDeviceProperties struct {
   144  	// 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.
   145  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
   146  	// 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.
   147  	DefaultTTLAsIso8601 *string             `json:"defaultTtlAsIso8601,omitempty"`
   148  	Feedback            *FeedbackProperties `json:"feedback,omitempty"`
   149  }
   150  
   151  // EndpointHealthData the health data for an endpoint
   152  type EndpointHealthData struct {
   153  	// EndpointID - Id of the endpoint
   154  	EndpointID *string `json:"endpointId,omitempty"`
   155  	// HealthStatus - The health status code of the endpoint. Possible values include: 'Unknown', 'Healthy', 'Unhealthy', 'Dead'
   156  	HealthStatus EndpointHealthStatus `json:"healthStatus,omitempty"`
   157  }
   158  
   159  // EndpointHealthDataListResult the JSON-serialized array of EndpointHealthData objects with a next link.
   160  type EndpointHealthDataListResult struct {
   161  	autorest.Response `json:"-"`
   162  	// Value - JSON-serialized array of Endpoint health data
   163  	Value *[]EndpointHealthData `json:"value,omitempty"`
   164  	// NextLink - READ-ONLY; Link to more results
   165  	NextLink *string `json:"nextLink,omitempty"`
   166  }
   167  
   168  // MarshalJSON is the custom marshaler for EndpointHealthDataListResult.
   169  func (ehdlr EndpointHealthDataListResult) MarshalJSON() ([]byte, error) {
   170  	objectMap := make(map[string]interface{})
   171  	if ehdlr.Value != nil {
   172  		objectMap["value"] = ehdlr.Value
   173  	}
   174  	return json.Marshal(objectMap)
   175  }
   176  
   177  // EndpointHealthDataListResultIterator provides access to a complete listing of EndpointHealthData values.
   178  type EndpointHealthDataListResultIterator struct {
   179  	i    int
   180  	page EndpointHealthDataListResultPage
   181  }
   182  
   183  // NextWithContext advances to the next value.  If there was an error making
   184  // the request the iterator does not advance and the error is returned.
   185  func (iter *EndpointHealthDataListResultIterator) NextWithContext(ctx context.Context) (err error) {
   186  	if tracing.IsEnabled() {
   187  		ctx = tracing.StartSpan(ctx, fqdn+"/EndpointHealthDataListResultIterator.NextWithContext")
   188  		defer func() {
   189  			sc := -1
   190  			if iter.Response().Response.Response != nil {
   191  				sc = iter.Response().Response.Response.StatusCode
   192  			}
   193  			tracing.EndSpan(ctx, sc, err)
   194  		}()
   195  	}
   196  	iter.i++
   197  	if iter.i < len(iter.page.Values()) {
   198  		return nil
   199  	}
   200  	err = iter.page.NextWithContext(ctx)
   201  	if err != nil {
   202  		iter.i--
   203  		return err
   204  	}
   205  	iter.i = 0
   206  	return nil
   207  }
   208  
   209  // Next advances to the next value.  If there was an error making
   210  // the request the iterator does not advance and the error is returned.
   211  // Deprecated: Use NextWithContext() instead.
   212  func (iter *EndpointHealthDataListResultIterator) Next() error {
   213  	return iter.NextWithContext(context.Background())
   214  }
   215  
   216  // NotDone returns true if the enumeration should be started or is not yet complete.
   217  func (iter EndpointHealthDataListResultIterator) NotDone() bool {
   218  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   219  }
   220  
   221  // Response returns the raw server response from the last page request.
   222  func (iter EndpointHealthDataListResultIterator) Response() EndpointHealthDataListResult {
   223  	return iter.page.Response()
   224  }
   225  
   226  // Value returns the current value or a zero-initialized value if the
   227  // iterator has advanced beyond the end of the collection.
   228  func (iter EndpointHealthDataListResultIterator) Value() EndpointHealthData {
   229  	if !iter.page.NotDone() {
   230  		return EndpointHealthData{}
   231  	}
   232  	return iter.page.Values()[iter.i]
   233  }
   234  
   235  // Creates a new instance of the EndpointHealthDataListResultIterator type.
   236  func NewEndpointHealthDataListResultIterator(page EndpointHealthDataListResultPage) EndpointHealthDataListResultIterator {
   237  	return EndpointHealthDataListResultIterator{page: page}
   238  }
   239  
   240  // IsEmpty returns true if the ListResult contains no values.
   241  func (ehdlr EndpointHealthDataListResult) IsEmpty() bool {
   242  	return ehdlr.Value == nil || len(*ehdlr.Value) == 0
   243  }
   244  
   245  // hasNextLink returns true if the NextLink is not empty.
   246  func (ehdlr EndpointHealthDataListResult) hasNextLink() bool {
   247  	return ehdlr.NextLink != nil && len(*ehdlr.NextLink) != 0
   248  }
   249  
   250  // endpointHealthDataListResultPreparer prepares a request to retrieve the next set of results.
   251  // It returns nil if no more results exist.
   252  func (ehdlr EndpointHealthDataListResult) endpointHealthDataListResultPreparer(ctx context.Context) (*http.Request, error) {
   253  	if !ehdlr.hasNextLink() {
   254  		return nil, nil
   255  	}
   256  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   257  		autorest.AsJSON(),
   258  		autorest.AsGet(),
   259  		autorest.WithBaseURL(to.String(ehdlr.NextLink)))
   260  }
   261  
   262  // EndpointHealthDataListResultPage contains a page of EndpointHealthData values.
   263  type EndpointHealthDataListResultPage struct {
   264  	fn    func(context.Context, EndpointHealthDataListResult) (EndpointHealthDataListResult, error)
   265  	ehdlr EndpointHealthDataListResult
   266  }
   267  
   268  // NextWithContext advances to the next page of values.  If there was an error making
   269  // the request the page does not advance and the error is returned.
   270  func (page *EndpointHealthDataListResultPage) NextWithContext(ctx context.Context) (err error) {
   271  	if tracing.IsEnabled() {
   272  		ctx = tracing.StartSpan(ctx, fqdn+"/EndpointHealthDataListResultPage.NextWithContext")
   273  		defer func() {
   274  			sc := -1
   275  			if page.Response().Response.Response != nil {
   276  				sc = page.Response().Response.Response.StatusCode
   277  			}
   278  			tracing.EndSpan(ctx, sc, err)
   279  		}()
   280  	}
   281  	for {
   282  		next, err := page.fn(ctx, page.ehdlr)
   283  		if err != nil {
   284  			return err
   285  		}
   286  		page.ehdlr = next
   287  		if !next.hasNextLink() || !next.IsEmpty() {
   288  			break
   289  		}
   290  	}
   291  	return nil
   292  }
   293  
   294  // Next advances to the next page of values.  If there was an error making
   295  // the request the page does not advance and the error is returned.
   296  // Deprecated: Use NextWithContext() instead.
   297  func (page *EndpointHealthDataListResultPage) Next() error {
   298  	return page.NextWithContext(context.Background())
   299  }
   300  
   301  // NotDone returns true if the page enumeration should be started or is not yet complete.
   302  func (page EndpointHealthDataListResultPage) NotDone() bool {
   303  	return !page.ehdlr.IsEmpty()
   304  }
   305  
   306  // Response returns the raw server response from the last page request.
   307  func (page EndpointHealthDataListResultPage) Response() EndpointHealthDataListResult {
   308  	return page.ehdlr
   309  }
   310  
   311  // Values returns the slice of values for the current page or nil if there are no values.
   312  func (page EndpointHealthDataListResultPage) Values() []EndpointHealthData {
   313  	if page.ehdlr.IsEmpty() {
   314  		return nil
   315  	}
   316  	return *page.ehdlr.Value
   317  }
   318  
   319  // Creates a new instance of the EndpointHealthDataListResultPage type.
   320  func NewEndpointHealthDataListResultPage(cur EndpointHealthDataListResult, getNextPage func(context.Context, EndpointHealthDataListResult) (EndpointHealthDataListResult, error)) EndpointHealthDataListResultPage {
   321  	return EndpointHealthDataListResultPage{
   322  		fn:    getNextPage,
   323  		ehdlr: cur,
   324  	}
   325  }
   326  
   327  // ErrorDetails error details.
   328  type ErrorDetails struct {
   329  	// Code - READ-ONLY; The error code.
   330  	Code *string `json:"code,omitempty"`
   331  	// HTTPStatusCode - READ-ONLY; The HTTP status code.
   332  	HTTPStatusCode *string `json:"httpStatusCode,omitempty"`
   333  	// Message - READ-ONLY; The error message.
   334  	Message *string `json:"message,omitempty"`
   335  	// Details - READ-ONLY; The error details.
   336  	Details *string `json:"details,omitempty"`
   337  }
   338  
   339  // MarshalJSON is the custom marshaler for ErrorDetails.
   340  func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
   341  	objectMap := make(map[string]interface{})
   342  	return json.Marshal(objectMap)
   343  }
   344  
   345  // EventHubConsumerGroupInfo the properties of the EventHubConsumerGroupInfo object.
   346  type EventHubConsumerGroupInfo struct {
   347  	autorest.Response `json:"-"`
   348  	// Properties - The tags.
   349  	Properties map[string]*string `json:"properties"`
   350  	// ID - READ-ONLY; The Event Hub-compatible consumer group identifier.
   351  	ID *string `json:"id,omitempty"`
   352  	// Name - READ-ONLY; The Event Hub-compatible consumer group name.
   353  	Name *string `json:"name,omitempty"`
   354  	// Type - READ-ONLY; the resource type.
   355  	Type *string `json:"type,omitempty"`
   356  	// Etag - READ-ONLY; The etag.
   357  	Etag *string `json:"etag,omitempty"`
   358  }
   359  
   360  // MarshalJSON is the custom marshaler for EventHubConsumerGroupInfo.
   361  func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) {
   362  	objectMap := make(map[string]interface{})
   363  	if ehcgi.Properties != nil {
   364  		objectMap["properties"] = ehcgi.Properties
   365  	}
   366  	return json.Marshal(objectMap)
   367  }
   368  
   369  // EventHubConsumerGroupsListResult the JSON-serialized array of Event Hub-compatible consumer group names
   370  // with a next link.
   371  type EventHubConsumerGroupsListResult struct {
   372  	autorest.Response `json:"-"`
   373  	// Value - List of consumer groups objects
   374  	Value *[]EventHubConsumerGroupInfo `json:"value,omitempty"`
   375  	// NextLink - READ-ONLY; The next link.
   376  	NextLink *string `json:"nextLink,omitempty"`
   377  }
   378  
   379  // MarshalJSON is the custom marshaler for EventHubConsumerGroupsListResult.
   380  func (ehcglr EventHubConsumerGroupsListResult) MarshalJSON() ([]byte, error) {
   381  	objectMap := make(map[string]interface{})
   382  	if ehcglr.Value != nil {
   383  		objectMap["value"] = ehcglr.Value
   384  	}
   385  	return json.Marshal(objectMap)
   386  }
   387  
   388  // EventHubConsumerGroupsListResultIterator provides access to a complete listing of
   389  // EventHubConsumerGroupInfo values.
   390  type EventHubConsumerGroupsListResultIterator struct {
   391  	i    int
   392  	page EventHubConsumerGroupsListResultPage
   393  }
   394  
   395  // NextWithContext advances to the next value.  If there was an error making
   396  // the request the iterator does not advance and the error is returned.
   397  func (iter *EventHubConsumerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) {
   398  	if tracing.IsEnabled() {
   399  		ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultIterator.NextWithContext")
   400  		defer func() {
   401  			sc := -1
   402  			if iter.Response().Response.Response != nil {
   403  				sc = iter.Response().Response.Response.StatusCode
   404  			}
   405  			tracing.EndSpan(ctx, sc, err)
   406  		}()
   407  	}
   408  	iter.i++
   409  	if iter.i < len(iter.page.Values()) {
   410  		return nil
   411  	}
   412  	err = iter.page.NextWithContext(ctx)
   413  	if err != nil {
   414  		iter.i--
   415  		return err
   416  	}
   417  	iter.i = 0
   418  	return nil
   419  }
   420  
   421  // Next advances to the next value.  If there was an error making
   422  // the request the iterator does not advance and the error is returned.
   423  // Deprecated: Use NextWithContext() instead.
   424  func (iter *EventHubConsumerGroupsListResultIterator) Next() error {
   425  	return iter.NextWithContext(context.Background())
   426  }
   427  
   428  // NotDone returns true if the enumeration should be started or is not yet complete.
   429  func (iter EventHubConsumerGroupsListResultIterator) NotDone() bool {
   430  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   431  }
   432  
   433  // Response returns the raw server response from the last page request.
   434  func (iter EventHubConsumerGroupsListResultIterator) Response() EventHubConsumerGroupsListResult {
   435  	return iter.page.Response()
   436  }
   437  
   438  // Value returns the current value or a zero-initialized value if the
   439  // iterator has advanced beyond the end of the collection.
   440  func (iter EventHubConsumerGroupsListResultIterator) Value() EventHubConsumerGroupInfo {
   441  	if !iter.page.NotDone() {
   442  		return EventHubConsumerGroupInfo{}
   443  	}
   444  	return iter.page.Values()[iter.i]
   445  }
   446  
   447  // Creates a new instance of the EventHubConsumerGroupsListResultIterator type.
   448  func NewEventHubConsumerGroupsListResultIterator(page EventHubConsumerGroupsListResultPage) EventHubConsumerGroupsListResultIterator {
   449  	return EventHubConsumerGroupsListResultIterator{page: page}
   450  }
   451  
   452  // IsEmpty returns true if the ListResult contains no values.
   453  func (ehcglr EventHubConsumerGroupsListResult) IsEmpty() bool {
   454  	return ehcglr.Value == nil || len(*ehcglr.Value) == 0
   455  }
   456  
   457  // hasNextLink returns true if the NextLink is not empty.
   458  func (ehcglr EventHubConsumerGroupsListResult) hasNextLink() bool {
   459  	return ehcglr.NextLink != nil && len(*ehcglr.NextLink) != 0
   460  }
   461  
   462  // eventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results.
   463  // It returns nil if no more results exist.
   464  func (ehcglr EventHubConsumerGroupsListResult) eventHubConsumerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) {
   465  	if !ehcglr.hasNextLink() {
   466  		return nil, nil
   467  	}
   468  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   469  		autorest.AsJSON(),
   470  		autorest.AsGet(),
   471  		autorest.WithBaseURL(to.String(ehcglr.NextLink)))
   472  }
   473  
   474  // EventHubConsumerGroupsListResultPage contains a page of EventHubConsumerGroupInfo values.
   475  type EventHubConsumerGroupsListResultPage struct {
   476  	fn     func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)
   477  	ehcglr EventHubConsumerGroupsListResult
   478  }
   479  
   480  // NextWithContext advances to the next page of values.  If there was an error making
   481  // the request the page does not advance and the error is returned.
   482  func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) {
   483  	if tracing.IsEnabled() {
   484  		ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultPage.NextWithContext")
   485  		defer func() {
   486  			sc := -1
   487  			if page.Response().Response.Response != nil {
   488  				sc = page.Response().Response.Response.StatusCode
   489  			}
   490  			tracing.EndSpan(ctx, sc, err)
   491  		}()
   492  	}
   493  	for {
   494  		next, err := page.fn(ctx, page.ehcglr)
   495  		if err != nil {
   496  			return err
   497  		}
   498  		page.ehcglr = next
   499  		if !next.hasNextLink() || !next.IsEmpty() {
   500  			break
   501  		}
   502  	}
   503  	return nil
   504  }
   505  
   506  // Next advances to the next page of values.  If there was an error making
   507  // the request the page does not advance and the error is returned.
   508  // Deprecated: Use NextWithContext() instead.
   509  func (page *EventHubConsumerGroupsListResultPage) Next() error {
   510  	return page.NextWithContext(context.Background())
   511  }
   512  
   513  // NotDone returns true if the page enumeration should be started or is not yet complete.
   514  func (page EventHubConsumerGroupsListResultPage) NotDone() bool {
   515  	return !page.ehcglr.IsEmpty()
   516  }
   517  
   518  // Response returns the raw server response from the last page request.
   519  func (page EventHubConsumerGroupsListResultPage) Response() EventHubConsumerGroupsListResult {
   520  	return page.ehcglr
   521  }
   522  
   523  // Values returns the slice of values for the current page or nil if there are no values.
   524  func (page EventHubConsumerGroupsListResultPage) Values() []EventHubConsumerGroupInfo {
   525  	if page.ehcglr.IsEmpty() {
   526  		return nil
   527  	}
   528  	return *page.ehcglr.Value
   529  }
   530  
   531  // Creates a new instance of the EventHubConsumerGroupsListResultPage type.
   532  func NewEventHubConsumerGroupsListResultPage(cur EventHubConsumerGroupsListResult, getNextPage func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)) EventHubConsumerGroupsListResultPage {
   533  	return EventHubConsumerGroupsListResultPage{
   534  		fn:     getNextPage,
   535  		ehcglr: cur,
   536  	}
   537  }
   538  
   539  // EventHubProperties the properties of the provisioned Event Hub-compatible endpoint used by the IoT hub.
   540  type EventHubProperties struct {
   541  	// 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
   542  	RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"`
   543  	// 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.
   544  	PartitionCount *int32 `json:"partitionCount,omitempty"`
   545  	// PartitionIds - READ-ONLY; The partition ids in the Event Hub-compatible endpoint.
   546  	PartitionIds *[]string `json:"partitionIds,omitempty"`
   547  	// Path - READ-ONLY; The Event Hub-compatible name.
   548  	Path *string `json:"path,omitempty"`
   549  	// Endpoint - READ-ONLY; The Event Hub-compatible endpoint.
   550  	Endpoint *string `json:"endpoint,omitempty"`
   551  }
   552  
   553  // MarshalJSON is the custom marshaler for EventHubProperties.
   554  func (ehp EventHubProperties) MarshalJSON() ([]byte, error) {
   555  	objectMap := make(map[string]interface{})
   556  	if ehp.RetentionTimeInDays != nil {
   557  		objectMap["retentionTimeInDays"] = ehp.RetentionTimeInDays
   558  	}
   559  	if ehp.PartitionCount != nil {
   560  		objectMap["partitionCount"] = ehp.PartitionCount
   561  	}
   562  	return json.Marshal(objectMap)
   563  }
   564  
   565  // ExportDevicesRequest use to provide parameters when requesting an export of all devices in the IoT hub.
   566  type ExportDevicesRequest struct {
   567  	// ExportBlobContainerURI - The export blob container URI.
   568  	ExportBlobContainerURI *string `json:"exportBlobContainerUri,omitempty"`
   569  	// ExcludeKeys - The value indicating whether keys should be excluded during export.
   570  	ExcludeKeys *bool `json:"excludeKeys,omitempty"`
   571  }
   572  
   573  // FallbackRouteProperties the properties of the fallback route. IoT Hub uses these properties when it
   574  // routes messages to the fallback endpoint.
   575  type FallbackRouteProperties struct {
   576  	// Name - The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique.
   577  	Name *string `json:"name,omitempty"`
   578  	// Source - The source to which the routing rule is to be applied to. For example, DeviceMessages
   579  	Source *string `json:"source,omitempty"`
   580  	// Condition - The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language
   581  	Condition *string `json:"condition,omitempty"`
   582  	// EndpointNames - The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed.
   583  	EndpointNames *[]string `json:"endpointNames,omitempty"`
   584  	// IsEnabled - Used to specify whether the fallback route is enabled.
   585  	IsEnabled *bool `json:"isEnabled,omitempty"`
   586  }
   587  
   588  // FeedbackProperties the properties of the feedback queue for cloud-to-device messages.
   589  type FeedbackProperties struct {
   590  	// LockDurationAsIso8601 - The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.
   591  	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
   592  	// 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.
   593  	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
   594  	// 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.
   595  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
   596  }
   597  
   598  // ImportDevicesRequest use to provide parameters when requesting an import of all devices in the hub.
   599  type ImportDevicesRequest struct {
   600  	// InputBlobContainerURI - The input blob container URI.
   601  	InputBlobContainerURI *string `json:"inputBlobContainerUri,omitempty"`
   602  	// OutputBlobContainerURI - The output blob container URI.
   603  	OutputBlobContainerURI *string `json:"outputBlobContainerUri,omitempty"`
   604  }
   605  
   606  // IotHubCapacity ioT Hub capacity information.
   607  type IotHubCapacity struct {
   608  	// Minimum - READ-ONLY; The minimum number of units.
   609  	Minimum *int64 `json:"minimum,omitempty"`
   610  	// Maximum - READ-ONLY; The maximum number of units.
   611  	Maximum *int64 `json:"maximum,omitempty"`
   612  	// Default - READ-ONLY; The default number of units.
   613  	Default *int64 `json:"default,omitempty"`
   614  	// ScaleType - READ-ONLY; The type of the scaling enabled. Possible values include: 'IotHubScaleTypeAutomatic', 'IotHubScaleTypeManual', 'IotHubScaleTypeNone'
   615  	ScaleType IotHubScaleType `json:"scaleType,omitempty"`
   616  }
   617  
   618  // MarshalJSON is the custom marshaler for IotHubCapacity.
   619  func (ihc IotHubCapacity) MarshalJSON() ([]byte, error) {
   620  	objectMap := make(map[string]interface{})
   621  	return json.Marshal(objectMap)
   622  }
   623  
   624  // IotHubDescription the description of the IoT hub.
   625  type IotHubDescription struct {
   626  	autorest.Response `json:"-"`
   627  	// 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.
   628  	Etag *string `json:"etag,omitempty"`
   629  	// Properties - IotHub properties
   630  	Properties *IotHubProperties `json:"properties,omitempty"`
   631  	// Sku - IotHub SKU info
   632  	Sku *IotHubSkuInfo `json:"sku,omitempty"`
   633  	// ID - READ-ONLY; The resource identifier.
   634  	ID *string `json:"id,omitempty"`
   635  	// Name - READ-ONLY; The resource name.
   636  	Name *string `json:"name,omitempty"`
   637  	// Type - READ-ONLY; The resource type.
   638  	Type *string `json:"type,omitempty"`
   639  	// Location - The resource location.
   640  	Location *string `json:"location,omitempty"`
   641  	// Tags - The resource tags.
   642  	Tags map[string]*string `json:"tags"`
   643  }
   644  
   645  // MarshalJSON is the custom marshaler for IotHubDescription.
   646  func (ihd IotHubDescription) MarshalJSON() ([]byte, error) {
   647  	objectMap := make(map[string]interface{})
   648  	if ihd.Etag != nil {
   649  		objectMap["etag"] = ihd.Etag
   650  	}
   651  	if ihd.Properties != nil {
   652  		objectMap["properties"] = ihd.Properties
   653  	}
   654  	if ihd.Sku != nil {
   655  		objectMap["sku"] = ihd.Sku
   656  	}
   657  	if ihd.Location != nil {
   658  		objectMap["location"] = ihd.Location
   659  	}
   660  	if ihd.Tags != nil {
   661  		objectMap["tags"] = ihd.Tags
   662  	}
   663  	return json.Marshal(objectMap)
   664  }
   665  
   666  // IotHubDescriptionListResult the JSON-serialized array of IotHubDescription objects with a next link.
   667  type IotHubDescriptionListResult struct {
   668  	autorest.Response `json:"-"`
   669  	// Value - The array of IotHubDescription objects.
   670  	Value *[]IotHubDescription `json:"value,omitempty"`
   671  	// NextLink - READ-ONLY; The next link.
   672  	NextLink *string `json:"nextLink,omitempty"`
   673  }
   674  
   675  // MarshalJSON is the custom marshaler for IotHubDescriptionListResult.
   676  func (ihdlr IotHubDescriptionListResult) MarshalJSON() ([]byte, error) {
   677  	objectMap := make(map[string]interface{})
   678  	if ihdlr.Value != nil {
   679  		objectMap["value"] = ihdlr.Value
   680  	}
   681  	return json.Marshal(objectMap)
   682  }
   683  
   684  // IotHubDescriptionListResultIterator provides access to a complete listing of IotHubDescription values.
   685  type IotHubDescriptionListResultIterator struct {
   686  	i    int
   687  	page IotHubDescriptionListResultPage
   688  }
   689  
   690  // NextWithContext advances to the next value.  If there was an error making
   691  // the request the iterator does not advance and the error is returned.
   692  func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
   693  	if tracing.IsEnabled() {
   694  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext")
   695  		defer func() {
   696  			sc := -1
   697  			if iter.Response().Response.Response != nil {
   698  				sc = iter.Response().Response.Response.StatusCode
   699  			}
   700  			tracing.EndSpan(ctx, sc, err)
   701  		}()
   702  	}
   703  	iter.i++
   704  	if iter.i < len(iter.page.Values()) {
   705  		return nil
   706  	}
   707  	err = iter.page.NextWithContext(ctx)
   708  	if err != nil {
   709  		iter.i--
   710  		return err
   711  	}
   712  	iter.i = 0
   713  	return nil
   714  }
   715  
   716  // Next advances to the next value.  If there was an error making
   717  // the request the iterator does not advance and the error is returned.
   718  // Deprecated: Use NextWithContext() instead.
   719  func (iter *IotHubDescriptionListResultIterator) Next() error {
   720  	return iter.NextWithContext(context.Background())
   721  }
   722  
   723  // NotDone returns true if the enumeration should be started or is not yet complete.
   724  func (iter IotHubDescriptionListResultIterator) NotDone() bool {
   725  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   726  }
   727  
   728  // Response returns the raw server response from the last page request.
   729  func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult {
   730  	return iter.page.Response()
   731  }
   732  
   733  // Value returns the current value or a zero-initialized value if the
   734  // iterator has advanced beyond the end of the collection.
   735  func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription {
   736  	if !iter.page.NotDone() {
   737  		return IotHubDescription{}
   738  	}
   739  	return iter.page.Values()[iter.i]
   740  }
   741  
   742  // Creates a new instance of the IotHubDescriptionListResultIterator type.
   743  func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator {
   744  	return IotHubDescriptionListResultIterator{page: page}
   745  }
   746  
   747  // IsEmpty returns true if the ListResult contains no values.
   748  func (ihdlr IotHubDescriptionListResult) IsEmpty() bool {
   749  	return ihdlr.Value == nil || len(*ihdlr.Value) == 0
   750  }
   751  
   752  // hasNextLink returns true if the NextLink is not empty.
   753  func (ihdlr IotHubDescriptionListResult) hasNextLink() bool {
   754  	return ihdlr.NextLink != nil && len(*ihdlr.NextLink) != 0
   755  }
   756  
   757  // iotHubDescriptionListResultPreparer prepares a request to retrieve the next set of results.
   758  // It returns nil if no more results exist.
   759  func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
   760  	if !ihdlr.hasNextLink() {
   761  		return nil, nil
   762  	}
   763  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   764  		autorest.AsJSON(),
   765  		autorest.AsGet(),
   766  		autorest.WithBaseURL(to.String(ihdlr.NextLink)))
   767  }
   768  
   769  // IotHubDescriptionListResultPage contains a page of IotHubDescription values.
   770  type IotHubDescriptionListResultPage struct {
   771  	fn    func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)
   772  	ihdlr IotHubDescriptionListResult
   773  }
   774  
   775  // NextWithContext advances to the next page of values.  If there was an error making
   776  // the request the page does not advance and the error is returned.
   777  func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
   778  	if tracing.IsEnabled() {
   779  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext")
   780  		defer func() {
   781  			sc := -1
   782  			if page.Response().Response.Response != nil {
   783  				sc = page.Response().Response.Response.StatusCode
   784  			}
   785  			tracing.EndSpan(ctx, sc, err)
   786  		}()
   787  	}
   788  	for {
   789  		next, err := page.fn(ctx, page.ihdlr)
   790  		if err != nil {
   791  			return err
   792  		}
   793  		page.ihdlr = next
   794  		if !next.hasNextLink() || !next.IsEmpty() {
   795  			break
   796  		}
   797  	}
   798  	return nil
   799  }
   800  
   801  // Next advances to the next page of values.  If there was an error making
   802  // the request the page does not advance and the error is returned.
   803  // Deprecated: Use NextWithContext() instead.
   804  func (page *IotHubDescriptionListResultPage) Next() error {
   805  	return page.NextWithContext(context.Background())
   806  }
   807  
   808  // NotDone returns true if the page enumeration should be started or is not yet complete.
   809  func (page IotHubDescriptionListResultPage) NotDone() bool {
   810  	return !page.ihdlr.IsEmpty()
   811  }
   812  
   813  // Response returns the raw server response from the last page request.
   814  func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult {
   815  	return page.ihdlr
   816  }
   817  
   818  // Values returns the slice of values for the current page or nil if there are no values.
   819  func (page IotHubDescriptionListResultPage) Values() []IotHubDescription {
   820  	if page.ihdlr.IsEmpty() {
   821  		return nil
   822  	}
   823  	return *page.ihdlr.Value
   824  }
   825  
   826  // Creates a new instance of the IotHubDescriptionListResultPage type.
   827  func NewIotHubDescriptionListResultPage(cur IotHubDescriptionListResult, getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage {
   828  	return IotHubDescriptionListResultPage{
   829  		fn:    getNextPage,
   830  		ihdlr: cur,
   831  	}
   832  }
   833  
   834  // IotHubNameAvailabilityInfo the properties indicating whether a given IoT hub name is available.
   835  type IotHubNameAvailabilityInfo struct {
   836  	autorest.Response `json:"-"`
   837  	// NameAvailable - READ-ONLY; The value which indicates whether the provided name is available.
   838  	NameAvailable *bool `json:"nameAvailable,omitempty"`
   839  	// Reason - READ-ONLY; The reason for unavailability. Possible values include: 'Invalid', 'AlreadyExists'
   840  	Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"`
   841  	// Message - The detailed reason message.
   842  	Message *string `json:"message,omitempty"`
   843  }
   844  
   845  // MarshalJSON is the custom marshaler for IotHubNameAvailabilityInfo.
   846  func (ihnai IotHubNameAvailabilityInfo) MarshalJSON() ([]byte, error) {
   847  	objectMap := make(map[string]interface{})
   848  	if ihnai.Message != nil {
   849  		objectMap["message"] = ihnai.Message
   850  	}
   851  	return json.Marshal(objectMap)
   852  }
   853  
   854  // IotHubProperties the properties of an IoT hub.
   855  type IotHubProperties struct {
   856  	// AuthorizationPolicies - The shared access policies you can use to secure a connection to the IoT hub.
   857  	AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"`
   858  	// IPFilterRules - The IP filter rules.
   859  	IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"`
   860  	// ProvisioningState - READ-ONLY; The provisioning state.
   861  	ProvisioningState *string `json:"provisioningState,omitempty"`
   862  	// State - READ-ONLY; The hub state.
   863  	State *string `json:"state,omitempty"`
   864  	// HostName - READ-ONLY; The name of the host.
   865  	HostName *string `json:"hostName,omitempty"`
   866  	// 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.
   867  	EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"`
   868  	Routing           *RoutingProperties             `json:"routing,omitempty"`
   869  	// 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.
   870  	StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"`
   871  	// MessagingEndpoints - The messaging endpoint properties for the file upload notification queue.
   872  	MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"`
   873  	// EnableFileUploadNotifications - If True, file upload notifications are enabled.
   874  	EnableFileUploadNotifications *bool                    `json:"enableFileUploadNotifications,omitempty"`
   875  	CloudToDevice                 *CloudToDeviceProperties `json:"cloudToDevice,omitempty"`
   876  	// Comments - IoT hub comments.
   877  	Comments                       *string                         `json:"comments,omitempty"`
   878  	OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"`
   879  	// Features - The capabilities and features enabled for the IoT hub. Possible values include: 'None', 'DeviceManagement'
   880  	Features Capabilities `json:"features,omitempty"`
   881  }
   882  
   883  // MarshalJSON is the custom marshaler for IotHubProperties.
   884  func (ihp IotHubProperties) MarshalJSON() ([]byte, error) {
   885  	objectMap := make(map[string]interface{})
   886  	if ihp.AuthorizationPolicies != nil {
   887  		objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies
   888  	}
   889  	if ihp.IPFilterRules != nil {
   890  		objectMap["ipFilterRules"] = ihp.IPFilterRules
   891  	}
   892  	if ihp.EventHubEndpoints != nil {
   893  		objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints
   894  	}
   895  	if ihp.Routing != nil {
   896  		objectMap["routing"] = ihp.Routing
   897  	}
   898  	if ihp.StorageEndpoints != nil {
   899  		objectMap["storageEndpoints"] = ihp.StorageEndpoints
   900  	}
   901  	if ihp.MessagingEndpoints != nil {
   902  		objectMap["messagingEndpoints"] = ihp.MessagingEndpoints
   903  	}
   904  	if ihp.EnableFileUploadNotifications != nil {
   905  		objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications
   906  	}
   907  	if ihp.CloudToDevice != nil {
   908  		objectMap["cloudToDevice"] = ihp.CloudToDevice
   909  	}
   910  	if ihp.Comments != nil {
   911  		objectMap["comments"] = ihp.Comments
   912  	}
   913  	if ihp.OperationsMonitoringProperties != nil {
   914  		objectMap["operationsMonitoringProperties"] = ihp.OperationsMonitoringProperties
   915  	}
   916  	if ihp.Features != "" {
   917  		objectMap["features"] = ihp.Features
   918  	}
   919  	return json.Marshal(objectMap)
   920  }
   921  
   922  // IotHubQuotaMetricInfo quota metrics properties.
   923  type IotHubQuotaMetricInfo struct {
   924  	// Name - READ-ONLY; The name of the quota metric.
   925  	Name *string `json:"name,omitempty"`
   926  	// CurrentValue - READ-ONLY; The current value for the quota metric.
   927  	CurrentValue *int64 `json:"currentValue,omitempty"`
   928  	// MaxValue - READ-ONLY; The maximum value of the quota metric.
   929  	MaxValue *int64 `json:"maxValue,omitempty"`
   930  }
   931  
   932  // MarshalJSON is the custom marshaler for IotHubQuotaMetricInfo.
   933  func (ihqmi IotHubQuotaMetricInfo) MarshalJSON() ([]byte, error) {
   934  	objectMap := make(map[string]interface{})
   935  	return json.Marshal(objectMap)
   936  }
   937  
   938  // IotHubQuotaMetricInfoListResult the JSON-serialized array of IotHubQuotaMetricInfo objects with a next
   939  // link.
   940  type IotHubQuotaMetricInfoListResult struct {
   941  	autorest.Response `json:"-"`
   942  	// Value - The array of quota metrics objects.
   943  	Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"`
   944  	// NextLink - READ-ONLY; The next link.
   945  	NextLink *string `json:"nextLink,omitempty"`
   946  }
   947  
   948  // MarshalJSON is the custom marshaler for IotHubQuotaMetricInfoListResult.
   949  func (ihqmilr IotHubQuotaMetricInfoListResult) MarshalJSON() ([]byte, error) {
   950  	objectMap := make(map[string]interface{})
   951  	if ihqmilr.Value != nil {
   952  		objectMap["value"] = ihqmilr.Value
   953  	}
   954  	return json.Marshal(objectMap)
   955  }
   956  
   957  // IotHubQuotaMetricInfoListResultIterator provides access to a complete listing of IotHubQuotaMetricInfo
   958  // values.
   959  type IotHubQuotaMetricInfoListResultIterator struct {
   960  	i    int
   961  	page IotHubQuotaMetricInfoListResultPage
   962  }
   963  
   964  // NextWithContext advances to the next value.  If there was an error making
   965  // the request the iterator does not advance and the error is returned.
   966  func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
   967  	if tracing.IsEnabled() {
   968  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext")
   969  		defer func() {
   970  			sc := -1
   971  			if iter.Response().Response.Response != nil {
   972  				sc = iter.Response().Response.Response.StatusCode
   973  			}
   974  			tracing.EndSpan(ctx, sc, err)
   975  		}()
   976  	}
   977  	iter.i++
   978  	if iter.i < len(iter.page.Values()) {
   979  		return nil
   980  	}
   981  	err = iter.page.NextWithContext(ctx)
   982  	if err != nil {
   983  		iter.i--
   984  		return err
   985  	}
   986  	iter.i = 0
   987  	return nil
   988  }
   989  
   990  // Next advances to the next value.  If there was an error making
   991  // the request the iterator does not advance and the error is returned.
   992  // Deprecated: Use NextWithContext() instead.
   993  func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error {
   994  	return iter.NextWithContext(context.Background())
   995  }
   996  
   997  // NotDone returns true if the enumeration should be started or is not yet complete.
   998  func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool {
   999  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1000  }
  1001  
  1002  // Response returns the raw server response from the last page request.
  1003  func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult {
  1004  	return iter.page.Response()
  1005  }
  1006  
  1007  // Value returns the current value or a zero-initialized value if the
  1008  // iterator has advanced beyond the end of the collection.
  1009  func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo {
  1010  	if !iter.page.NotDone() {
  1011  		return IotHubQuotaMetricInfo{}
  1012  	}
  1013  	return iter.page.Values()[iter.i]
  1014  }
  1015  
  1016  // Creates a new instance of the IotHubQuotaMetricInfoListResultIterator type.
  1017  func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator {
  1018  	return IotHubQuotaMetricInfoListResultIterator{page: page}
  1019  }
  1020  
  1021  // IsEmpty returns true if the ListResult contains no values.
  1022  func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool {
  1023  	return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0
  1024  }
  1025  
  1026  // hasNextLink returns true if the NextLink is not empty.
  1027  func (ihqmilr IotHubQuotaMetricInfoListResult) hasNextLink() bool {
  1028  	return ihqmilr.NextLink != nil && len(*ihqmilr.NextLink) != 0
  1029  }
  1030  
  1031  // iotHubQuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results.
  1032  // It returns nil if no more results exist.
  1033  func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) {
  1034  	if !ihqmilr.hasNextLink() {
  1035  		return nil, nil
  1036  	}
  1037  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1038  		autorest.AsJSON(),
  1039  		autorest.AsGet(),
  1040  		autorest.WithBaseURL(to.String(ihqmilr.NextLink)))
  1041  }
  1042  
  1043  // IotHubQuotaMetricInfoListResultPage contains a page of IotHubQuotaMetricInfo values.
  1044  type IotHubQuotaMetricInfoListResultPage struct {
  1045  	fn      func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)
  1046  	ihqmilr IotHubQuotaMetricInfoListResult
  1047  }
  1048  
  1049  // NextWithContext advances to the next page of values.  If there was an error making
  1050  // the request the page does not advance and the error is returned.
  1051  func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) {
  1052  	if tracing.IsEnabled() {
  1053  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext")
  1054  		defer func() {
  1055  			sc := -1
  1056  			if page.Response().Response.Response != nil {
  1057  				sc = page.Response().Response.Response.StatusCode
  1058  			}
  1059  			tracing.EndSpan(ctx, sc, err)
  1060  		}()
  1061  	}
  1062  	for {
  1063  		next, err := page.fn(ctx, page.ihqmilr)
  1064  		if err != nil {
  1065  			return err
  1066  		}
  1067  		page.ihqmilr = next
  1068  		if !next.hasNextLink() || !next.IsEmpty() {
  1069  			break
  1070  		}
  1071  	}
  1072  	return nil
  1073  }
  1074  
  1075  // Next advances to the next page of values.  If there was an error making
  1076  // the request the page does not advance and the error is returned.
  1077  // Deprecated: Use NextWithContext() instead.
  1078  func (page *IotHubQuotaMetricInfoListResultPage) Next() error {
  1079  	return page.NextWithContext(context.Background())
  1080  }
  1081  
  1082  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1083  func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool {
  1084  	return !page.ihqmilr.IsEmpty()
  1085  }
  1086  
  1087  // Response returns the raw server response from the last page request.
  1088  func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult {
  1089  	return page.ihqmilr
  1090  }
  1091  
  1092  // Values returns the slice of values for the current page or nil if there are no values.
  1093  func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo {
  1094  	if page.ihqmilr.IsEmpty() {
  1095  		return nil
  1096  	}
  1097  	return *page.ihqmilr.Value
  1098  }
  1099  
  1100  // Creates a new instance of the IotHubQuotaMetricInfoListResultPage type.
  1101  func NewIotHubQuotaMetricInfoListResultPage(cur IotHubQuotaMetricInfoListResult, getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage {
  1102  	return IotHubQuotaMetricInfoListResultPage{
  1103  		fn:      getNextPage,
  1104  		ihqmilr: cur,
  1105  	}
  1106  }
  1107  
  1108  // IotHubResourceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1109  // long-running operation.
  1110  type IotHubResourceCreateOrUpdateFuture struct {
  1111  	azure.FutureAPI
  1112  	// Result returns the result of the asynchronous operation.
  1113  	// If the operation has not completed it will return an error.
  1114  	Result func(IotHubResourceClient) (IotHubDescription, error)
  1115  }
  1116  
  1117  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1118  func (future *IotHubResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1119  	var azFuture azure.Future
  1120  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1121  		return err
  1122  	}
  1123  	future.FutureAPI = &azFuture
  1124  	future.Result = future.result
  1125  	return nil
  1126  }
  1127  
  1128  // result is the default implementation for IotHubResourceCreateOrUpdateFuture.Result.
  1129  func (future *IotHubResourceCreateOrUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
  1130  	var done bool
  1131  	done, err = future.DoneWithContext(context.Background(), client)
  1132  	if err != nil {
  1133  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1134  		return
  1135  	}
  1136  	if !done {
  1137  		ihd.Response.Response = future.Response()
  1138  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture")
  1139  		return
  1140  	}
  1141  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1142  	if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
  1143  		ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response)
  1144  		if err != nil {
  1145  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
  1146  		}
  1147  	}
  1148  	return
  1149  }
  1150  
  1151  // IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1152  // operation.
  1153  type IotHubResourceDeleteFuture struct {
  1154  	azure.FutureAPI
  1155  	// Result returns the result of the asynchronous operation.
  1156  	// If the operation has not completed it will return an error.
  1157  	Result func(IotHubResourceClient) (SetObject, error)
  1158  }
  1159  
  1160  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1161  func (future *IotHubResourceDeleteFuture) UnmarshalJSON(body []byte) error {
  1162  	var azFuture azure.Future
  1163  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1164  		return err
  1165  	}
  1166  	future.FutureAPI = &azFuture
  1167  	future.Result = future.result
  1168  	return nil
  1169  }
  1170  
  1171  // result is the default implementation for IotHubResourceDeleteFuture.Result.
  1172  func (future *IotHubResourceDeleteFuture) result(client IotHubResourceClient) (so SetObject, err error) {
  1173  	var done bool
  1174  	done, err = future.DoneWithContext(context.Background(), client)
  1175  	if err != nil {
  1176  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure")
  1177  		return
  1178  	}
  1179  	if !done {
  1180  		so.Response.Response = future.Response()
  1181  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture")
  1182  		return
  1183  	}
  1184  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1185  	if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {
  1186  		so, err = client.DeleteResponder(so.Response.Response)
  1187  		if err != nil {
  1188  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request")
  1189  		}
  1190  	}
  1191  	return
  1192  }
  1193  
  1194  // IotHubResourceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  1195  // operation.
  1196  type IotHubResourceUpdateFuture struct {
  1197  	azure.FutureAPI
  1198  	// Result returns the result of the asynchronous operation.
  1199  	// If the operation has not completed it will return an error.
  1200  	Result func(IotHubResourceClient) (IotHubDescription, error)
  1201  }
  1202  
  1203  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1204  func (future *IotHubResourceUpdateFuture) UnmarshalJSON(body []byte) error {
  1205  	var azFuture azure.Future
  1206  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1207  		return err
  1208  	}
  1209  	future.FutureAPI = &azFuture
  1210  	future.Result = future.result
  1211  	return nil
  1212  }
  1213  
  1214  // result is the default implementation for IotHubResourceUpdateFuture.Result.
  1215  func (future *IotHubResourceUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
  1216  	var done bool
  1217  	done, err = future.DoneWithContext(context.Background(), client)
  1218  	if err != nil {
  1219  		err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", future.Response(), "Polling failure")
  1220  		return
  1221  	}
  1222  	if !done {
  1223  		ihd.Response.Response = future.Response()
  1224  		err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceUpdateFuture")
  1225  		return
  1226  	}
  1227  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1228  	if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
  1229  		ihd, err = client.UpdateResponder(ihd.Response.Response)
  1230  		if err != nil {
  1231  			err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
  1232  		}
  1233  	}
  1234  	return
  1235  }
  1236  
  1237  // IotHubSkuDescription SKU properties.
  1238  type IotHubSkuDescription struct {
  1239  	// ResourceType - READ-ONLY; The type of the resource.
  1240  	ResourceType *string `json:"resourceType,omitempty"`
  1241  	// Sku - The type of the resource.
  1242  	Sku *IotHubSkuInfo `json:"sku,omitempty"`
  1243  	// Capacity - IotHub capacity
  1244  	Capacity *IotHubCapacity `json:"capacity,omitempty"`
  1245  }
  1246  
  1247  // MarshalJSON is the custom marshaler for IotHubSkuDescription.
  1248  func (ihsd IotHubSkuDescription) MarshalJSON() ([]byte, error) {
  1249  	objectMap := make(map[string]interface{})
  1250  	if ihsd.Sku != nil {
  1251  		objectMap["sku"] = ihsd.Sku
  1252  	}
  1253  	if ihsd.Capacity != nil {
  1254  		objectMap["capacity"] = ihsd.Capacity
  1255  	}
  1256  	return json.Marshal(objectMap)
  1257  }
  1258  
  1259  // IotHubSkuDescriptionListResult the JSON-serialized array of IotHubSkuDescription objects with a next
  1260  // link.
  1261  type IotHubSkuDescriptionListResult struct {
  1262  	autorest.Response `json:"-"`
  1263  	// Value - The array of IotHubSkuDescription.
  1264  	Value *[]IotHubSkuDescription `json:"value,omitempty"`
  1265  	// NextLink - READ-ONLY; The next link.
  1266  	NextLink *string `json:"nextLink,omitempty"`
  1267  }
  1268  
  1269  // MarshalJSON is the custom marshaler for IotHubSkuDescriptionListResult.
  1270  func (ihsdlr IotHubSkuDescriptionListResult) MarshalJSON() ([]byte, error) {
  1271  	objectMap := make(map[string]interface{})
  1272  	if ihsdlr.Value != nil {
  1273  		objectMap["value"] = ihsdlr.Value
  1274  	}
  1275  	return json.Marshal(objectMap)
  1276  }
  1277  
  1278  // IotHubSkuDescriptionListResultIterator provides access to a complete listing of IotHubSkuDescription
  1279  // values.
  1280  type IotHubSkuDescriptionListResultIterator struct {
  1281  	i    int
  1282  	page IotHubSkuDescriptionListResultPage
  1283  }
  1284  
  1285  // NextWithContext advances to the next value.  If there was an error making
  1286  // the request the iterator does not advance and the error is returned.
  1287  func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1288  	if tracing.IsEnabled() {
  1289  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext")
  1290  		defer func() {
  1291  			sc := -1
  1292  			if iter.Response().Response.Response != nil {
  1293  				sc = iter.Response().Response.Response.StatusCode
  1294  			}
  1295  			tracing.EndSpan(ctx, sc, err)
  1296  		}()
  1297  	}
  1298  	iter.i++
  1299  	if iter.i < len(iter.page.Values()) {
  1300  		return nil
  1301  	}
  1302  	err = iter.page.NextWithContext(ctx)
  1303  	if err != nil {
  1304  		iter.i--
  1305  		return err
  1306  	}
  1307  	iter.i = 0
  1308  	return nil
  1309  }
  1310  
  1311  // Next advances to the next value.  If there was an error making
  1312  // the request the iterator does not advance and the error is returned.
  1313  // Deprecated: Use NextWithContext() instead.
  1314  func (iter *IotHubSkuDescriptionListResultIterator) Next() error {
  1315  	return iter.NextWithContext(context.Background())
  1316  }
  1317  
  1318  // NotDone returns true if the enumeration should be started or is not yet complete.
  1319  func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool {
  1320  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1321  }
  1322  
  1323  // Response returns the raw server response from the last page request.
  1324  func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult {
  1325  	return iter.page.Response()
  1326  }
  1327  
  1328  // Value returns the current value or a zero-initialized value if the
  1329  // iterator has advanced beyond the end of the collection.
  1330  func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription {
  1331  	if !iter.page.NotDone() {
  1332  		return IotHubSkuDescription{}
  1333  	}
  1334  	return iter.page.Values()[iter.i]
  1335  }
  1336  
  1337  // Creates a new instance of the IotHubSkuDescriptionListResultIterator type.
  1338  func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator {
  1339  	return IotHubSkuDescriptionListResultIterator{page: page}
  1340  }
  1341  
  1342  // IsEmpty returns true if the ListResult contains no values.
  1343  func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool {
  1344  	return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0
  1345  }
  1346  
  1347  // hasNextLink returns true if the NextLink is not empty.
  1348  func (ihsdlr IotHubSkuDescriptionListResult) hasNextLink() bool {
  1349  	return ihsdlr.NextLink != nil && len(*ihsdlr.NextLink) != 0
  1350  }
  1351  
  1352  // iotHubSkuDescriptionListResultPreparer prepares a request to retrieve the next set of results.
  1353  // It returns nil if no more results exist.
  1354  func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
  1355  	if !ihsdlr.hasNextLink() {
  1356  		return nil, nil
  1357  	}
  1358  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1359  		autorest.AsJSON(),
  1360  		autorest.AsGet(),
  1361  		autorest.WithBaseURL(to.String(ihsdlr.NextLink)))
  1362  }
  1363  
  1364  // IotHubSkuDescriptionListResultPage contains a page of IotHubSkuDescription values.
  1365  type IotHubSkuDescriptionListResultPage struct {
  1366  	fn     func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)
  1367  	ihsdlr IotHubSkuDescriptionListResult
  1368  }
  1369  
  1370  // NextWithContext advances to the next page of values.  If there was an error making
  1371  // the request the page does not advance and the error is returned.
  1372  func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
  1373  	if tracing.IsEnabled() {
  1374  		ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext")
  1375  		defer func() {
  1376  			sc := -1
  1377  			if page.Response().Response.Response != nil {
  1378  				sc = page.Response().Response.Response.StatusCode
  1379  			}
  1380  			tracing.EndSpan(ctx, sc, err)
  1381  		}()
  1382  	}
  1383  	for {
  1384  		next, err := page.fn(ctx, page.ihsdlr)
  1385  		if err != nil {
  1386  			return err
  1387  		}
  1388  		page.ihsdlr = next
  1389  		if !next.hasNextLink() || !next.IsEmpty() {
  1390  			break
  1391  		}
  1392  	}
  1393  	return nil
  1394  }
  1395  
  1396  // Next advances to the next page of values.  If there was an error making
  1397  // the request the page does not advance and the error is returned.
  1398  // Deprecated: Use NextWithContext() instead.
  1399  func (page *IotHubSkuDescriptionListResultPage) Next() error {
  1400  	return page.NextWithContext(context.Background())
  1401  }
  1402  
  1403  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1404  func (page IotHubSkuDescriptionListResultPage) NotDone() bool {
  1405  	return !page.ihsdlr.IsEmpty()
  1406  }
  1407  
  1408  // Response returns the raw server response from the last page request.
  1409  func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult {
  1410  	return page.ihsdlr
  1411  }
  1412  
  1413  // Values returns the slice of values for the current page or nil if there are no values.
  1414  func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription {
  1415  	if page.ihsdlr.IsEmpty() {
  1416  		return nil
  1417  	}
  1418  	return *page.ihsdlr.Value
  1419  }
  1420  
  1421  // Creates a new instance of the IotHubSkuDescriptionListResultPage type.
  1422  func NewIotHubSkuDescriptionListResultPage(cur IotHubSkuDescriptionListResult, getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage {
  1423  	return IotHubSkuDescriptionListResultPage{
  1424  		fn:     getNextPage,
  1425  		ihsdlr: cur,
  1426  	}
  1427  }
  1428  
  1429  // IotHubSkuInfo information about the SKU of the IoT hub.
  1430  type IotHubSkuInfo struct {
  1431  	// Name - The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3', 'B1', 'B2', 'B3'
  1432  	Name IotHubSku `json:"name,omitempty"`
  1433  	// Tier - READ-ONLY; The billing tier for the IoT hub. Possible values include: 'Free', 'Standard', 'Basic'
  1434  	Tier IotHubSkuTier `json:"tier,omitempty"`
  1435  	// Capacity - The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits.
  1436  	Capacity *int64 `json:"capacity,omitempty"`
  1437  }
  1438  
  1439  // MarshalJSON is the custom marshaler for IotHubSkuInfo.
  1440  func (ihsi IotHubSkuInfo) MarshalJSON() ([]byte, error) {
  1441  	objectMap := make(map[string]interface{})
  1442  	if ihsi.Name != "" {
  1443  		objectMap["name"] = ihsi.Name
  1444  	}
  1445  	if ihsi.Capacity != nil {
  1446  		objectMap["capacity"] = ihsi.Capacity
  1447  	}
  1448  	return json.Marshal(objectMap)
  1449  }
  1450  
  1451  // IPFilterRule the IP filter rules for the IoT hub.
  1452  type IPFilterRule struct {
  1453  	// FilterName - The name of the IP filter rule.
  1454  	FilterName *string `json:"filterName,omitempty"`
  1455  	// Action - The desired action for requests captured by this rule. Possible values include: 'Accept', 'Reject'
  1456  	Action IPFilterActionType `json:"action,omitempty"`
  1457  	// IPMask - A string that contains the IP address range in CIDR notation for the rule.
  1458  	IPMask *string `json:"ipMask,omitempty"`
  1459  }
  1460  
  1461  // JobResponse the properties of the Job Response object.
  1462  type JobResponse struct {
  1463  	autorest.Response `json:"-"`
  1464  	// JobID - READ-ONLY; The job identifier.
  1465  	JobID *string `json:"jobId,omitempty"`
  1466  	// StartTimeUtc - READ-ONLY; The start time of the job.
  1467  	StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"`
  1468  	// EndTimeUtc - READ-ONLY; The time the job stopped processing.
  1469  	EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"`
  1470  	// Type - READ-ONLY; The type of the job. Possible values include: 'JobTypeUnknown', 'JobTypeExport', 'JobTypeImport', 'JobTypeBackup', 'JobTypeReadDeviceProperties', 'JobTypeWriteDeviceProperties', 'JobTypeUpdateDeviceConfiguration', 'JobTypeRebootDevice', 'JobTypeFactoryResetDevice', 'JobTypeFirmwareUpdate'
  1471  	Type JobType `json:"type,omitempty"`
  1472  	// Status - READ-ONLY; The status of the job. Possible values include: 'JobStatusUnknown', 'JobStatusEnqueued', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCancelled'
  1473  	Status JobStatus `json:"status,omitempty"`
  1474  	// FailureReason - READ-ONLY; If status == failed, this string containing the reason for the failure.
  1475  	FailureReason *string `json:"failureReason,omitempty"`
  1476  	// StatusMessage - READ-ONLY; The status message for the job.
  1477  	StatusMessage *string `json:"statusMessage,omitempty"`
  1478  	// ParentJobID - READ-ONLY; The job identifier of the parent job, if any.
  1479  	ParentJobID *string `json:"parentJobId,omitempty"`
  1480  }
  1481  
  1482  // MarshalJSON is the custom marshaler for JobResponse.
  1483  func (jr JobResponse) MarshalJSON() ([]byte, error) {
  1484  	objectMap := make(map[string]interface{})
  1485  	return json.Marshal(objectMap)
  1486  }
  1487  
  1488  // JobResponseListResult the JSON-serialized array of JobResponse objects with a next link.
  1489  type JobResponseListResult struct {
  1490  	autorest.Response `json:"-"`
  1491  	// Value - The array of JobResponse objects.
  1492  	Value *[]JobResponse `json:"value,omitempty"`
  1493  	// NextLink - READ-ONLY; The next link.
  1494  	NextLink *string `json:"nextLink,omitempty"`
  1495  }
  1496  
  1497  // MarshalJSON is the custom marshaler for JobResponseListResult.
  1498  func (jrlr JobResponseListResult) MarshalJSON() ([]byte, error) {
  1499  	objectMap := make(map[string]interface{})
  1500  	if jrlr.Value != nil {
  1501  		objectMap["value"] = jrlr.Value
  1502  	}
  1503  	return json.Marshal(objectMap)
  1504  }
  1505  
  1506  // JobResponseListResultIterator provides access to a complete listing of JobResponse values.
  1507  type JobResponseListResultIterator struct {
  1508  	i    int
  1509  	page JobResponseListResultPage
  1510  }
  1511  
  1512  // NextWithContext advances to the next value.  If there was an error making
  1513  // the request the iterator does not advance and the error is returned.
  1514  func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1515  	if tracing.IsEnabled() {
  1516  		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext")
  1517  		defer func() {
  1518  			sc := -1
  1519  			if iter.Response().Response.Response != nil {
  1520  				sc = iter.Response().Response.Response.StatusCode
  1521  			}
  1522  			tracing.EndSpan(ctx, sc, err)
  1523  		}()
  1524  	}
  1525  	iter.i++
  1526  	if iter.i < len(iter.page.Values()) {
  1527  		return nil
  1528  	}
  1529  	err = iter.page.NextWithContext(ctx)
  1530  	if err != nil {
  1531  		iter.i--
  1532  		return err
  1533  	}
  1534  	iter.i = 0
  1535  	return nil
  1536  }
  1537  
  1538  // Next advances to the next value.  If there was an error making
  1539  // the request the iterator does not advance and the error is returned.
  1540  // Deprecated: Use NextWithContext() instead.
  1541  func (iter *JobResponseListResultIterator) Next() error {
  1542  	return iter.NextWithContext(context.Background())
  1543  }
  1544  
  1545  // NotDone returns true if the enumeration should be started or is not yet complete.
  1546  func (iter JobResponseListResultIterator) NotDone() bool {
  1547  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1548  }
  1549  
  1550  // Response returns the raw server response from the last page request.
  1551  func (iter JobResponseListResultIterator) Response() JobResponseListResult {
  1552  	return iter.page.Response()
  1553  }
  1554  
  1555  // Value returns the current value or a zero-initialized value if the
  1556  // iterator has advanced beyond the end of the collection.
  1557  func (iter JobResponseListResultIterator) Value() JobResponse {
  1558  	if !iter.page.NotDone() {
  1559  		return JobResponse{}
  1560  	}
  1561  	return iter.page.Values()[iter.i]
  1562  }
  1563  
  1564  // Creates a new instance of the JobResponseListResultIterator type.
  1565  func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator {
  1566  	return JobResponseListResultIterator{page: page}
  1567  }
  1568  
  1569  // IsEmpty returns true if the ListResult contains no values.
  1570  func (jrlr JobResponseListResult) IsEmpty() bool {
  1571  	return jrlr.Value == nil || len(*jrlr.Value) == 0
  1572  }
  1573  
  1574  // hasNextLink returns true if the NextLink is not empty.
  1575  func (jrlr JobResponseListResult) hasNextLink() bool {
  1576  	return jrlr.NextLink != nil && len(*jrlr.NextLink) != 0
  1577  }
  1578  
  1579  // jobResponseListResultPreparer prepares a request to retrieve the next set of results.
  1580  // It returns nil if no more results exist.
  1581  func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) {
  1582  	if !jrlr.hasNextLink() {
  1583  		return nil, nil
  1584  	}
  1585  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1586  		autorest.AsJSON(),
  1587  		autorest.AsGet(),
  1588  		autorest.WithBaseURL(to.String(jrlr.NextLink)))
  1589  }
  1590  
  1591  // JobResponseListResultPage contains a page of JobResponse values.
  1592  type JobResponseListResultPage struct {
  1593  	fn   func(context.Context, JobResponseListResult) (JobResponseListResult, error)
  1594  	jrlr JobResponseListResult
  1595  }
  1596  
  1597  // NextWithContext advances to the next page of values.  If there was an error making
  1598  // the request the page does not advance and the error is returned.
  1599  func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) {
  1600  	if tracing.IsEnabled() {
  1601  		ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext")
  1602  		defer func() {
  1603  			sc := -1
  1604  			if page.Response().Response.Response != nil {
  1605  				sc = page.Response().Response.Response.StatusCode
  1606  			}
  1607  			tracing.EndSpan(ctx, sc, err)
  1608  		}()
  1609  	}
  1610  	for {
  1611  		next, err := page.fn(ctx, page.jrlr)
  1612  		if err != nil {
  1613  			return err
  1614  		}
  1615  		page.jrlr = next
  1616  		if !next.hasNextLink() || !next.IsEmpty() {
  1617  			break
  1618  		}
  1619  	}
  1620  	return nil
  1621  }
  1622  
  1623  // Next advances to the next page of values.  If there was an error making
  1624  // the request the page does not advance and the error is returned.
  1625  // Deprecated: Use NextWithContext() instead.
  1626  func (page *JobResponseListResultPage) Next() error {
  1627  	return page.NextWithContext(context.Background())
  1628  }
  1629  
  1630  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1631  func (page JobResponseListResultPage) NotDone() bool {
  1632  	return !page.jrlr.IsEmpty()
  1633  }
  1634  
  1635  // Response returns the raw server response from the last page request.
  1636  func (page JobResponseListResultPage) Response() JobResponseListResult {
  1637  	return page.jrlr
  1638  }
  1639  
  1640  // Values returns the slice of values for the current page or nil if there are no values.
  1641  func (page JobResponseListResultPage) Values() []JobResponse {
  1642  	if page.jrlr.IsEmpty() {
  1643  		return nil
  1644  	}
  1645  	return *page.jrlr.Value
  1646  }
  1647  
  1648  // Creates a new instance of the JobResponseListResultPage type.
  1649  func NewJobResponseListResultPage(cur JobResponseListResult, getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage {
  1650  	return JobResponseListResultPage{
  1651  		fn:   getNextPage,
  1652  		jrlr: cur,
  1653  	}
  1654  }
  1655  
  1656  // MatchedRoute routes that matched
  1657  type MatchedRoute struct {
  1658  	// Properties - Properties of routes that matched
  1659  	Properties *RouteProperties `json:"properties,omitempty"`
  1660  }
  1661  
  1662  // MessagingEndpointProperties the properties of the messaging endpoints used by this IoT hub.
  1663  type MessagingEndpointProperties struct {
  1664  	// LockDurationAsIso8601 - The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.
  1665  	LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
  1666  	// 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-file-upload.
  1667  	TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
  1668  	// MaxDeliveryCount - The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.
  1669  	MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
  1670  }
  1671  
  1672  // Name name of Iot Hub type
  1673  type Name struct {
  1674  	// Value - IotHub type
  1675  	Value *string `json:"value,omitempty"`
  1676  	// LocalizedValue - Localized value of name
  1677  	LocalizedValue *string `json:"localizedValue,omitempty"`
  1678  }
  1679  
  1680  // Operation ioT Hub REST API operation
  1681  type Operation struct {
  1682  	// Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete}
  1683  	Name *string `json:"name,omitempty"`
  1684  	// Display - The object that represents the operation.
  1685  	Display *OperationDisplay `json:"display,omitempty"`
  1686  }
  1687  
  1688  // MarshalJSON is the custom marshaler for Operation.
  1689  func (o Operation) MarshalJSON() ([]byte, error) {
  1690  	objectMap := make(map[string]interface{})
  1691  	if o.Display != nil {
  1692  		objectMap["display"] = o.Display
  1693  	}
  1694  	return json.Marshal(objectMap)
  1695  }
  1696  
  1697  // OperationDisplay the object that represents the operation.
  1698  type OperationDisplay struct {
  1699  	// Provider - READ-ONLY; Service provider: Microsoft Devices
  1700  	Provider *string `json:"provider,omitempty"`
  1701  	// Resource - READ-ONLY; Resource Type: IotHubs
  1702  	Resource *string `json:"resource,omitempty"`
  1703  	// Operation - READ-ONLY; Name of the operation
  1704  	Operation *string `json:"operation,omitempty"`
  1705  }
  1706  
  1707  // MarshalJSON is the custom marshaler for OperationDisplay.
  1708  func (o OperationDisplay) MarshalJSON() ([]byte, error) {
  1709  	objectMap := make(map[string]interface{})
  1710  	return json.Marshal(objectMap)
  1711  }
  1712  
  1713  // OperationInputs input values.
  1714  type OperationInputs struct {
  1715  	// Name - The name of the IoT hub to check.
  1716  	Name *string `json:"name,omitempty"`
  1717  }
  1718  
  1719  // OperationListResult result of the request to list IoT Hub operations. It contains a list of operations
  1720  // and a URL link to get the next set of results.
  1721  type OperationListResult struct {
  1722  	autorest.Response `json:"-"`
  1723  	// Value - READ-ONLY; List of IoT Hub operations supported by the Microsoft.Devices resource provider.
  1724  	Value *[]Operation `json:"value,omitempty"`
  1725  	// NextLink - READ-ONLY; URL to get the next set of operation list results if there are any.
  1726  	NextLink *string `json:"nextLink,omitempty"`
  1727  }
  1728  
  1729  // MarshalJSON is the custom marshaler for OperationListResult.
  1730  func (olr OperationListResult) MarshalJSON() ([]byte, error) {
  1731  	objectMap := make(map[string]interface{})
  1732  	return json.Marshal(objectMap)
  1733  }
  1734  
  1735  // OperationListResultIterator provides access to a complete listing of Operation values.
  1736  type OperationListResultIterator struct {
  1737  	i    int
  1738  	page OperationListResultPage
  1739  }
  1740  
  1741  // NextWithContext advances to the next value.  If there was an error making
  1742  // the request the iterator does not advance and the error is returned.
  1743  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1744  	if tracing.IsEnabled() {
  1745  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1746  		defer func() {
  1747  			sc := -1
  1748  			if iter.Response().Response.Response != nil {
  1749  				sc = iter.Response().Response.Response.StatusCode
  1750  			}
  1751  			tracing.EndSpan(ctx, sc, err)
  1752  		}()
  1753  	}
  1754  	iter.i++
  1755  	if iter.i < len(iter.page.Values()) {
  1756  		return nil
  1757  	}
  1758  	err = iter.page.NextWithContext(ctx)
  1759  	if err != nil {
  1760  		iter.i--
  1761  		return err
  1762  	}
  1763  	iter.i = 0
  1764  	return nil
  1765  }
  1766  
  1767  // Next advances to the next value.  If there was an error making
  1768  // the request the iterator does not advance and the error is returned.
  1769  // Deprecated: Use NextWithContext() instead.
  1770  func (iter *OperationListResultIterator) Next() error {
  1771  	return iter.NextWithContext(context.Background())
  1772  }
  1773  
  1774  // NotDone returns true if the enumeration should be started or is not yet complete.
  1775  func (iter OperationListResultIterator) NotDone() bool {
  1776  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1777  }
  1778  
  1779  // Response returns the raw server response from the last page request.
  1780  func (iter OperationListResultIterator) Response() OperationListResult {
  1781  	return iter.page.Response()
  1782  }
  1783  
  1784  // Value returns the current value or a zero-initialized value if the
  1785  // iterator has advanced beyond the end of the collection.
  1786  func (iter OperationListResultIterator) Value() Operation {
  1787  	if !iter.page.NotDone() {
  1788  		return Operation{}
  1789  	}
  1790  	return iter.page.Values()[iter.i]
  1791  }
  1792  
  1793  // Creates a new instance of the OperationListResultIterator type.
  1794  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1795  	return OperationListResultIterator{page: page}
  1796  }
  1797  
  1798  // IsEmpty returns true if the ListResult contains no values.
  1799  func (olr OperationListResult) IsEmpty() bool {
  1800  	return olr.Value == nil || len(*olr.Value) == 0
  1801  }
  1802  
  1803  // hasNextLink returns true if the NextLink is not empty.
  1804  func (olr OperationListResult) hasNextLink() bool {
  1805  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1806  }
  1807  
  1808  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1809  // It returns nil if no more results exist.
  1810  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1811  	if !olr.hasNextLink() {
  1812  		return nil, nil
  1813  	}
  1814  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1815  		autorest.AsJSON(),
  1816  		autorest.AsGet(),
  1817  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1818  }
  1819  
  1820  // OperationListResultPage contains a page of Operation values.
  1821  type OperationListResultPage struct {
  1822  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1823  	olr OperationListResult
  1824  }
  1825  
  1826  // NextWithContext advances to the next page of values.  If there was an error making
  1827  // the request the page does not advance and the error is returned.
  1828  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1829  	if tracing.IsEnabled() {
  1830  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1831  		defer func() {
  1832  			sc := -1
  1833  			if page.Response().Response.Response != nil {
  1834  				sc = page.Response().Response.Response.StatusCode
  1835  			}
  1836  			tracing.EndSpan(ctx, sc, err)
  1837  		}()
  1838  	}
  1839  	for {
  1840  		next, err := page.fn(ctx, page.olr)
  1841  		if err != nil {
  1842  			return err
  1843  		}
  1844  		page.olr = next
  1845  		if !next.hasNextLink() || !next.IsEmpty() {
  1846  			break
  1847  		}
  1848  	}
  1849  	return nil
  1850  }
  1851  
  1852  // Next advances to the next page of values.  If there was an error making
  1853  // the request the page does not advance and the error is returned.
  1854  // Deprecated: Use NextWithContext() instead.
  1855  func (page *OperationListResultPage) Next() error {
  1856  	return page.NextWithContext(context.Background())
  1857  }
  1858  
  1859  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1860  func (page OperationListResultPage) NotDone() bool {
  1861  	return !page.olr.IsEmpty()
  1862  }
  1863  
  1864  // Response returns the raw server response from the last page request.
  1865  func (page OperationListResultPage) Response() OperationListResult {
  1866  	return page.olr
  1867  }
  1868  
  1869  // Values returns the slice of values for the current page or nil if there are no values.
  1870  func (page OperationListResultPage) Values() []Operation {
  1871  	if page.olr.IsEmpty() {
  1872  		return nil
  1873  	}
  1874  	return *page.olr.Value
  1875  }
  1876  
  1877  // Creates a new instance of the OperationListResultPage type.
  1878  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1879  	return OperationListResultPage{
  1880  		fn:  getNextPage,
  1881  		olr: cur,
  1882  	}
  1883  }
  1884  
  1885  // OperationsMonitoringProperties the operations monitoring properties for the IoT hub. The possible keys
  1886  // to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations,
  1887  // FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations,
  1888  // DirectMethods.
  1889  type OperationsMonitoringProperties struct {
  1890  	Events map[string]*OperationMonitoringLevel `json:"events"`
  1891  }
  1892  
  1893  // MarshalJSON is the custom marshaler for OperationsMonitoringProperties.
  1894  func (omp OperationsMonitoringProperties) MarshalJSON() ([]byte, error) {
  1895  	objectMap := make(map[string]interface{})
  1896  	if omp.Events != nil {
  1897  		objectMap["events"] = omp.Events
  1898  	}
  1899  	return json.Marshal(objectMap)
  1900  }
  1901  
  1902  // RegistryStatistics identity registry statistics.
  1903  type RegistryStatistics struct {
  1904  	autorest.Response `json:"-"`
  1905  	// TotalDeviceCount - READ-ONLY; The total count of devices in the identity registry.
  1906  	TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"`
  1907  	// EnabledDeviceCount - READ-ONLY; The count of enabled devices in the identity registry.
  1908  	EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"`
  1909  	// DisabledDeviceCount - READ-ONLY; The count of disabled devices in the identity registry.
  1910  	DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"`
  1911  }
  1912  
  1913  // MarshalJSON is the custom marshaler for RegistryStatistics.
  1914  func (rs RegistryStatistics) MarshalJSON() ([]byte, error) {
  1915  	objectMap := make(map[string]interface{})
  1916  	return json.Marshal(objectMap)
  1917  }
  1918  
  1919  // Resource the common properties of an Azure resource.
  1920  type Resource struct {
  1921  	// ID - READ-ONLY; The resource identifier.
  1922  	ID *string `json:"id,omitempty"`
  1923  	// Name - READ-ONLY; The resource name.
  1924  	Name *string `json:"name,omitempty"`
  1925  	// Type - READ-ONLY; The resource type.
  1926  	Type *string `json:"type,omitempty"`
  1927  	// Location - The resource location.
  1928  	Location *string `json:"location,omitempty"`
  1929  	// Tags - The resource tags.
  1930  	Tags map[string]*string `json:"tags"`
  1931  }
  1932  
  1933  // MarshalJSON is the custom marshaler for Resource.
  1934  func (r Resource) MarshalJSON() ([]byte, error) {
  1935  	objectMap := make(map[string]interface{})
  1936  	if r.Location != nil {
  1937  		objectMap["location"] = r.Location
  1938  	}
  1939  	if r.Tags != nil {
  1940  		objectMap["tags"] = r.Tags
  1941  	}
  1942  	return json.Marshal(objectMap)
  1943  }
  1944  
  1945  // RouteCompilationError compilation error when evaluating route
  1946  type RouteCompilationError struct {
  1947  	// Message - Route error message
  1948  	Message *string `json:"message,omitempty"`
  1949  	// Severity - Severity of the route error. Possible values include: 'Error', 'Warning'
  1950  	Severity RouteErrorSeverity `json:"severity,omitempty"`
  1951  	// Location - Location where the route error happened
  1952  	Location *RouteErrorRange `json:"location,omitempty"`
  1953  }
  1954  
  1955  // RouteErrorPosition position where the route error happened
  1956  type RouteErrorPosition struct {
  1957  	// Line - Line where the route error happened
  1958  	Line *int32 `json:"line,omitempty"`
  1959  	// Column - Column where the route error happened
  1960  	Column *int32 `json:"column,omitempty"`
  1961  }
  1962  
  1963  // RouteErrorRange range of route errors
  1964  type RouteErrorRange struct {
  1965  	// Start - Start where the route error happened
  1966  	Start *RouteErrorPosition `json:"start,omitempty"`
  1967  	// End - End where the route error happened
  1968  	End *RouteErrorPosition `json:"end,omitempty"`
  1969  }
  1970  
  1971  // RouteProperties the properties of a routing rule that your IoT hub uses to route messages to endpoints.
  1972  type RouteProperties struct {
  1973  	// Name - The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique.
  1974  	Name *string `json:"name,omitempty"`
  1975  	// Source - The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: 'RoutingSourceInvalid', 'RoutingSourceDeviceMessages', 'RoutingSourceTwinChangeEvents', 'RoutingSourceDeviceLifecycleEvents', 'RoutingSourceDeviceJobLifecycleEvents'
  1976  	Source RoutingSource `json:"source,omitempty"`
  1977  	// Condition - The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language
  1978  	Condition *string `json:"condition,omitempty"`
  1979  	// EndpointNames - The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.
  1980  	EndpointNames *[]string `json:"endpointNames,omitempty"`
  1981  	// IsEnabled - Used to specify whether a route is enabled.
  1982  	IsEnabled *bool `json:"isEnabled,omitempty"`
  1983  }
  1984  
  1985  // RoutingEndpoints the properties related to the custom endpoints to which your IoT hub routes messages
  1986  // based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for
  1987  // paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs.
  1988  type RoutingEndpoints struct {
  1989  	// ServiceBusQueues - The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules.
  1990  	ServiceBusQueues *[]RoutingServiceBusQueueEndpointProperties `json:"serviceBusQueues,omitempty"`
  1991  	// ServiceBusTopics - The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules.
  1992  	ServiceBusTopics *[]RoutingServiceBusTopicEndpointProperties `json:"serviceBusTopics,omitempty"`
  1993  	// EventHubs - The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint.
  1994  	EventHubs *[]RoutingEventHubProperties `json:"eventHubs,omitempty"`
  1995  	// StorageContainers - The list of storage container endpoints that IoT hub routes messages to, based on the routing rules.
  1996  	StorageContainers *[]RoutingStorageContainerProperties `json:"storageContainers,omitempty"`
  1997  }
  1998  
  1999  // RoutingEventHubProperties the properties related to an event hub endpoint.
  2000  type RoutingEventHubProperties struct {
  2001  	// ConnectionString - The connection string of the event hub endpoint.
  2002  	ConnectionString *string `json:"connectionString,omitempty"`
  2003  	// Name - The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved:  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.
  2004  	Name *string `json:"name,omitempty"`
  2005  	// SubscriptionID - The subscription identifier of the event hub endpoint.
  2006  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  2007  	// ResourceGroup - The name of the resource group of the event hub endpoint.
  2008  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  2009  }
  2010  
  2011  // RoutingMessage routing message
  2012  type RoutingMessage struct {
  2013  	// Body - Body of routing message
  2014  	Body *string `json:"body,omitempty"`
  2015  	// AppProperties - App properties
  2016  	AppProperties map[string]*string `json:"appProperties"`
  2017  	// SystemProperties - System properties
  2018  	SystemProperties map[string]*string `json:"systemProperties"`
  2019  }
  2020  
  2021  // MarshalJSON is the custom marshaler for RoutingMessage.
  2022  func (rm RoutingMessage) MarshalJSON() ([]byte, error) {
  2023  	objectMap := make(map[string]interface{})
  2024  	if rm.Body != nil {
  2025  		objectMap["body"] = rm.Body
  2026  	}
  2027  	if rm.AppProperties != nil {
  2028  		objectMap["appProperties"] = rm.AppProperties
  2029  	}
  2030  	if rm.SystemProperties != nil {
  2031  		objectMap["systemProperties"] = rm.SystemProperties
  2032  	}
  2033  	return json.Marshal(objectMap)
  2034  }
  2035  
  2036  // RoutingProperties the routing related properties of the IoT hub. See:
  2037  // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging
  2038  type RoutingProperties struct {
  2039  	Endpoints *RoutingEndpoints `json:"endpoints,omitempty"`
  2040  	// Routes - The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs.
  2041  	Routes *[]RouteProperties `json:"routes,omitempty"`
  2042  	// FallbackRoute - The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint.
  2043  	FallbackRoute *FallbackRouteProperties `json:"fallbackRoute,omitempty"`
  2044  }
  2045  
  2046  // RoutingServiceBusQueueEndpointProperties the properties related to service bus queue endpoint types.
  2047  type RoutingServiceBusQueueEndpointProperties struct {
  2048  	// ConnectionString - The connection string of the service bus queue endpoint.
  2049  	ConnectionString *string `json:"connectionString,omitempty"`
  2050  	// Name - The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved:  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name.
  2051  	Name *string `json:"name,omitempty"`
  2052  	// SubscriptionID - The subscription identifier of the service bus queue endpoint.
  2053  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  2054  	// ResourceGroup - The name of the resource group of the service bus queue endpoint.
  2055  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  2056  }
  2057  
  2058  // RoutingServiceBusTopicEndpointProperties the properties related to service bus topic endpoint types.
  2059  type RoutingServiceBusTopicEndpointProperties struct {
  2060  	// ConnectionString - The connection string of the service bus topic endpoint.
  2061  	ConnectionString *string `json:"connectionString,omitempty"`
  2062  	// Name - The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved:  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.  The name need not be the same as the actual topic name.
  2063  	Name *string `json:"name,omitempty"`
  2064  	// SubscriptionID - The subscription identifier of the service bus topic endpoint.
  2065  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  2066  	// ResourceGroup - The name of the resource group of the service bus topic endpoint.
  2067  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  2068  }
  2069  
  2070  // RoutingStorageContainerProperties the properties related to a storage container endpoint.
  2071  type RoutingStorageContainerProperties struct {
  2072  	// ConnectionString - The connection string of the storage account.
  2073  	ConnectionString *string `json:"connectionString,omitempty"`
  2074  	// Name - The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved:  events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.
  2075  	Name *string `json:"name,omitempty"`
  2076  	// SubscriptionID - The subscription identifier of the storage account.
  2077  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  2078  	// ResourceGroup - The name of the resource group of the storage account.
  2079  	ResourceGroup *string `json:"resourceGroup,omitempty"`
  2080  	// ContainerName - The name of storage container in the storage account.
  2081  	ContainerName *string `json:"containerName,omitempty"`
  2082  	// FileNameFormat - File name format for the blob. Default format is {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered.
  2083  	FileNameFormat *string `json:"fileNameFormat,omitempty"`
  2084  	// BatchFrequencyInSeconds - Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds.
  2085  	BatchFrequencyInSeconds *int32 `json:"batchFrequencyInSeconds,omitempty"`
  2086  	// MaxChunkSizeInBytes - Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB).
  2087  	MaxChunkSizeInBytes *int32 `json:"maxChunkSizeInBytes,omitempty"`
  2088  	// Encoding - Encoding that is used to serialize messages to blobs. Supported values are 'avro' and 'avroDeflate'. Default value is 'avro'.
  2089  	Encoding *string `json:"encoding,omitempty"`
  2090  }
  2091  
  2092  // RoutingTwin twin reference input parameter. This is an optional parameter
  2093  type RoutingTwin struct {
  2094  	// Tags - Twin Tags
  2095  	Tags       interface{}            `json:"tags,omitempty"`
  2096  	Properties *RoutingTwinProperties `json:"properties,omitempty"`
  2097  }
  2098  
  2099  // RoutingTwinProperties ...
  2100  type RoutingTwinProperties struct {
  2101  	// DesiredProperties - Twin desired properties
  2102  	DesiredProperties interface{} `json:"desiredProperties,omitempty"`
  2103  	// ReportedProperties - Twin desired properties
  2104  	ReportedProperties interface{} `json:"reportedProperties,omitempty"`
  2105  }
  2106  
  2107  // SetObject ...
  2108  type SetObject struct {
  2109  	autorest.Response `json:"-"`
  2110  	Value             interface{} `json:"value,omitempty"`
  2111  }
  2112  
  2113  // SharedAccessSignatureAuthorizationRule the properties of an IoT hub shared access policy.
  2114  type SharedAccessSignatureAuthorizationRule struct {
  2115  	autorest.Response `json:"-"`
  2116  	// KeyName - The name of the shared access policy.
  2117  	KeyName *string `json:"keyName,omitempty"`
  2118  	// PrimaryKey - The primary key.
  2119  	PrimaryKey *string `json:"primaryKey,omitempty"`
  2120  	// SecondaryKey - The secondary key.
  2121  	SecondaryKey *string `json:"secondaryKey,omitempty"`
  2122  	// 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'
  2123  	Rights AccessRights `json:"rights,omitempty"`
  2124  }
  2125  
  2126  // SharedAccessSignatureAuthorizationRuleListResult the list of shared access policies with a next link.
  2127  type SharedAccessSignatureAuthorizationRuleListResult struct {
  2128  	autorest.Response `json:"-"`
  2129  	// Value - The list of shared access policies.
  2130  	Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"`
  2131  	// NextLink - READ-ONLY; The next link.
  2132  	NextLink *string `json:"nextLink,omitempty"`
  2133  }
  2134  
  2135  // MarshalJSON is the custom marshaler for SharedAccessSignatureAuthorizationRuleListResult.
  2136  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) {
  2137  	objectMap := make(map[string]interface{})
  2138  	if sasarlr.Value != nil {
  2139  		objectMap["value"] = sasarlr.Value
  2140  	}
  2141  	return json.Marshal(objectMap)
  2142  }
  2143  
  2144  // SharedAccessSignatureAuthorizationRuleListResultIterator provides access to a complete listing of
  2145  // SharedAccessSignatureAuthorizationRule values.
  2146  type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
  2147  	i    int
  2148  	page SharedAccessSignatureAuthorizationRuleListResultPage
  2149  }
  2150  
  2151  // NextWithContext advances to the next value.  If there was an error making
  2152  // the request the iterator does not advance and the error is returned.
  2153  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
  2154  	if tracing.IsEnabled() {
  2155  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
  2156  		defer func() {
  2157  			sc := -1
  2158  			if iter.Response().Response.Response != nil {
  2159  				sc = iter.Response().Response.Response.StatusCode
  2160  			}
  2161  			tracing.EndSpan(ctx, sc, err)
  2162  		}()
  2163  	}
  2164  	iter.i++
  2165  	if iter.i < len(iter.page.Values()) {
  2166  		return nil
  2167  	}
  2168  	err = iter.page.NextWithContext(ctx)
  2169  	if err != nil {
  2170  		iter.i--
  2171  		return err
  2172  	}
  2173  	iter.i = 0
  2174  	return nil
  2175  }
  2176  
  2177  // Next advances to the next value.  If there was an error making
  2178  // the request the iterator does not advance and the error is returned.
  2179  // Deprecated: Use NextWithContext() instead.
  2180  func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
  2181  	return iter.NextWithContext(context.Background())
  2182  }
  2183  
  2184  // NotDone returns true if the enumeration should be started or is not yet complete.
  2185  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
  2186  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  2187  }
  2188  
  2189  // Response returns the raw server response from the last page request.
  2190  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
  2191  	return iter.page.Response()
  2192  }
  2193  
  2194  // Value returns the current value or a zero-initialized value if the
  2195  // iterator has advanced beyond the end of the collection.
  2196  func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule {
  2197  	if !iter.page.NotDone() {
  2198  		return SharedAccessSignatureAuthorizationRule{}
  2199  	}
  2200  	return iter.page.Values()[iter.i]
  2201  }
  2202  
  2203  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultIterator type.
  2204  func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
  2205  	return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
  2206  }
  2207  
  2208  // IsEmpty returns true if the ListResult contains no values.
  2209  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
  2210  	return sasarlr.Value == nil || len(*sasarlr.Value) == 0
  2211  }
  2212  
  2213  // hasNextLink returns true if the NextLink is not empty.
  2214  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool {
  2215  	return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0
  2216  }
  2217  
  2218  // sharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
  2219  // It returns nil if no more results exist.
  2220  func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
  2221  	if !sasarlr.hasNextLink() {
  2222  		return nil, nil
  2223  	}
  2224  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  2225  		autorest.AsJSON(),
  2226  		autorest.AsGet(),
  2227  		autorest.WithBaseURL(to.String(sasarlr.NextLink)))
  2228  }
  2229  
  2230  // SharedAccessSignatureAuthorizationRuleListResultPage contains a page of
  2231  // SharedAccessSignatureAuthorizationRule values.
  2232  type SharedAccessSignatureAuthorizationRuleListResultPage struct {
  2233  	fn      func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
  2234  	sasarlr SharedAccessSignatureAuthorizationRuleListResult
  2235  }
  2236  
  2237  // NextWithContext advances to the next page of values.  If there was an error making
  2238  // the request the page does not advance and the error is returned.
  2239  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
  2240  	if tracing.IsEnabled() {
  2241  		ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
  2242  		defer func() {
  2243  			sc := -1
  2244  			if page.Response().Response.Response != nil {
  2245  				sc = page.Response().Response.Response.StatusCode
  2246  			}
  2247  			tracing.EndSpan(ctx, sc, err)
  2248  		}()
  2249  	}
  2250  	for {
  2251  		next, err := page.fn(ctx, page.sasarlr)
  2252  		if err != nil {
  2253  			return err
  2254  		}
  2255  		page.sasarlr = next
  2256  		if !next.hasNextLink() || !next.IsEmpty() {
  2257  			break
  2258  		}
  2259  	}
  2260  	return nil
  2261  }
  2262  
  2263  // Next advances to the next page of values.  If there was an error making
  2264  // the request the page does not advance and the error is returned.
  2265  // Deprecated: Use NextWithContext() instead.
  2266  func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
  2267  	return page.NextWithContext(context.Background())
  2268  }
  2269  
  2270  // NotDone returns true if the page enumeration should be started or is not yet complete.
  2271  func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
  2272  	return !page.sasarlr.IsEmpty()
  2273  }
  2274  
  2275  // Response returns the raw server response from the last page request.
  2276  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
  2277  	return page.sasarlr
  2278  }
  2279  
  2280  // Values returns the slice of values for the current page or nil if there are no values.
  2281  func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule {
  2282  	if page.sasarlr.IsEmpty() {
  2283  		return nil
  2284  	}
  2285  	return *page.sasarlr.Value
  2286  }
  2287  
  2288  // Creates a new instance of the SharedAccessSignatureAuthorizationRuleListResultPage type.
  2289  func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
  2290  	return SharedAccessSignatureAuthorizationRuleListResultPage{
  2291  		fn:      getNextPage,
  2292  		sasarlr: cur,
  2293  	}
  2294  }
  2295  
  2296  // StorageEndpointProperties the properties of the Azure Storage endpoint for file upload.
  2297  type StorageEndpointProperties struct {
  2298  	// 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.
  2299  	SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"`
  2300  	// ConnectionString - The connection string for the Azure Storage account to which files are uploaded.
  2301  	ConnectionString *string `json:"connectionString,omitempty"`
  2302  	// ContainerName - The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.
  2303  	ContainerName *string `json:"containerName,omitempty"`
  2304  }
  2305  
  2306  // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on
  2307  // an IoT Hub instance.
  2308  type TagsResource struct {
  2309  	// Tags - Resource tags
  2310  	Tags map[string]*string `json:"tags"`
  2311  }
  2312  
  2313  // MarshalJSON is the custom marshaler for TagsResource.
  2314  func (tr TagsResource) MarshalJSON() ([]byte, error) {
  2315  	objectMap := make(map[string]interface{})
  2316  	if tr.Tags != nil {
  2317  		objectMap["tags"] = tr.Tags
  2318  	}
  2319  	return json.Marshal(objectMap)
  2320  }
  2321  
  2322  // TestAllRoutesInput input for testing all routes
  2323  type TestAllRoutesInput struct {
  2324  	// RoutingSource - Routing source. Possible values include: 'RoutingSourceInvalid', 'RoutingSourceDeviceMessages', 'RoutingSourceTwinChangeEvents', 'RoutingSourceDeviceLifecycleEvents', 'RoutingSourceDeviceJobLifecycleEvents'
  2325  	RoutingSource RoutingSource `json:"routingSource,omitempty"`
  2326  	// Message - Routing message
  2327  	Message *RoutingMessage `json:"message,omitempty"`
  2328  	// Twin - Routing Twin Reference
  2329  	Twin *RoutingTwin `json:"twin,omitempty"`
  2330  }
  2331  
  2332  // TestAllRoutesResult result of testing all routes
  2333  type TestAllRoutesResult struct {
  2334  	autorest.Response `json:"-"`
  2335  	// Routes - JSON-serialized array of matched routes
  2336  	Routes *[]MatchedRoute `json:"routes,omitempty"`
  2337  }
  2338  
  2339  // TestRouteInput input for testing route
  2340  type TestRouteInput struct {
  2341  	// Message - Routing message
  2342  	Message *RoutingMessage `json:"message,omitempty"`
  2343  	// Route - Route properties
  2344  	Route *RouteProperties `json:"route,omitempty"`
  2345  	// Twin - Routing Twin Reference
  2346  	Twin *RoutingTwin `json:"twin,omitempty"`
  2347  }
  2348  
  2349  // TestRouteResult result of testing one route
  2350  type TestRouteResult struct {
  2351  	autorest.Response `json:"-"`
  2352  	// Result - Result of testing route. Possible values include: 'Undefined', 'False', 'True'
  2353  	Result TestResultStatus `json:"result,omitempty"`
  2354  	// Details - Detailed result of testing route
  2355  	Details *TestRouteResultDetails `json:"details,omitempty"`
  2356  }
  2357  
  2358  // TestRouteResultDetails detailed result of testing a route
  2359  type TestRouteResultDetails struct {
  2360  	// CompilationErrors - JSON-serialized list of route compilation errors
  2361  	CompilationErrors *[]RouteCompilationError `json:"compilationErrors,omitempty"`
  2362  }
  2363  
  2364  // UserSubscriptionQuota user subscription quota response
  2365  type UserSubscriptionQuota struct {
  2366  	// ID - IotHub type id
  2367  	ID *string `json:"id,omitempty"`
  2368  	// Type - Response type
  2369  	Type *string `json:"type,omitempty"`
  2370  	// Unit - Unit of IotHub type
  2371  	Unit *string `json:"unit,omitempty"`
  2372  	// CurrentValue - Current number of IotHub type
  2373  	CurrentValue *int32 `json:"currentValue,omitempty"`
  2374  	// Limit - Numerical limit on IotHub type
  2375  	Limit *int32 `json:"limit,omitempty"`
  2376  	// Name - IotHub type
  2377  	Name *Name `json:"name,omitempty"`
  2378  }
  2379  
  2380  // UserSubscriptionQuotaListResult json-serialized array of User subscription quota response
  2381  type UserSubscriptionQuotaListResult struct {
  2382  	autorest.Response `json:"-"`
  2383  	Value             *[]UserSubscriptionQuota `json:"value,omitempty"`
  2384  	// NextLink - READ-ONLY
  2385  	NextLink *string `json:"nextLink,omitempty"`
  2386  }
  2387  
  2388  // MarshalJSON is the custom marshaler for UserSubscriptionQuotaListResult.
  2389  func (usqlr UserSubscriptionQuotaListResult) MarshalJSON() ([]byte, error) {
  2390  	objectMap := make(map[string]interface{})
  2391  	if usqlr.Value != nil {
  2392  		objectMap["value"] = usqlr.Value
  2393  	}
  2394  	return json.Marshal(objectMap)
  2395  }
  2396  

View as plain text