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