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