1package eventhub 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub" 33 34// AccessRights enumerates the values for access rights. 35type AccessRights string 36 37const ( 38 // Listen ... 39 Listen AccessRights = "Listen" 40 // Manage ... 41 Manage AccessRights = "Manage" 42 // Send ... 43 Send AccessRights = "Send" 44) 45 46// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. 47func PossibleAccessRightsValues() []AccessRights { 48 return []AccessRights{Listen, Manage, Send} 49} 50 51// DefaultAction enumerates the values for default action. 52type DefaultAction string 53 54const ( 55 // Allow ... 56 Allow DefaultAction = "Allow" 57 // Deny ... 58 Deny DefaultAction = "Deny" 59) 60 61// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. 62func PossibleDefaultActionValues() []DefaultAction { 63 return []DefaultAction{Allow, Deny} 64} 65 66// EncodingCaptureDescription enumerates the values for encoding capture description. 67type EncodingCaptureDescription string 68 69const ( 70 // Avro ... 71 Avro EncodingCaptureDescription = "Avro" 72 // AvroDeflate ... 73 AvroDeflate EncodingCaptureDescription = "AvroDeflate" 74) 75 76// PossibleEncodingCaptureDescriptionValues returns an array of possible values for the EncodingCaptureDescription const type. 77func PossibleEncodingCaptureDescriptionValues() []EncodingCaptureDescription { 78 return []EncodingCaptureDescription{Avro, AvroDeflate} 79} 80 81// EntityStatus enumerates the values for entity status. 82type EntityStatus string 83 84const ( 85 // Active ... 86 Active EntityStatus = "Active" 87 // Creating ... 88 Creating EntityStatus = "Creating" 89 // Deleting ... 90 Deleting EntityStatus = "Deleting" 91 // Disabled ... 92 Disabled EntityStatus = "Disabled" 93 // ReceiveDisabled ... 94 ReceiveDisabled EntityStatus = "ReceiveDisabled" 95 // Renaming ... 96 Renaming EntityStatus = "Renaming" 97 // Restoring ... 98 Restoring EntityStatus = "Restoring" 99 // SendDisabled ... 100 SendDisabled EntityStatus = "SendDisabled" 101 // Unknown ... 102 Unknown EntityStatus = "Unknown" 103) 104 105// PossibleEntityStatusValues returns an array of possible values for the EntityStatus const type. 106func PossibleEntityStatusValues() []EntityStatus { 107 return []EntityStatus{Active, Creating, Deleting, Disabled, ReceiveDisabled, Renaming, Restoring, SendDisabled, Unknown} 108} 109 110// KeyType enumerates the values for key type. 111type KeyType string 112 113const ( 114 // PrimaryKey ... 115 PrimaryKey KeyType = "PrimaryKey" 116 // SecondaryKey ... 117 SecondaryKey KeyType = "SecondaryKey" 118) 119 120// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. 121func PossibleKeyTypeValues() []KeyType { 122 return []KeyType{PrimaryKey, SecondaryKey} 123} 124 125// NetworkRuleIPAction enumerates the values for network rule ip action. 126type NetworkRuleIPAction string 127 128const ( 129 // NetworkRuleIPActionAllow ... 130 NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" 131) 132 133// PossibleNetworkRuleIPActionValues returns an array of possible values for the NetworkRuleIPAction const type. 134func PossibleNetworkRuleIPActionValues() []NetworkRuleIPAction { 135 return []NetworkRuleIPAction{NetworkRuleIPActionAllow} 136} 137 138// ProvisioningStateDR enumerates the values for provisioning state dr. 139type ProvisioningStateDR string 140 141const ( 142 // Accepted ... 143 Accepted ProvisioningStateDR = "Accepted" 144 // Failed ... 145 Failed ProvisioningStateDR = "Failed" 146 // Succeeded ... 147 Succeeded ProvisioningStateDR = "Succeeded" 148) 149 150// PossibleProvisioningStateDRValues returns an array of possible values for the ProvisioningStateDR const type. 151func PossibleProvisioningStateDRValues() []ProvisioningStateDR { 152 return []ProvisioningStateDR{Accepted, Failed, Succeeded} 153} 154 155// RoleDisasterRecovery enumerates the values for role disaster recovery. 156type RoleDisasterRecovery string 157 158const ( 159 // Primary ... 160 Primary RoleDisasterRecovery = "Primary" 161 // PrimaryNotReplicating ... 162 PrimaryNotReplicating RoleDisasterRecovery = "PrimaryNotReplicating" 163 // Secondary ... 164 Secondary RoleDisasterRecovery = "Secondary" 165) 166 167// PossibleRoleDisasterRecoveryValues returns an array of possible values for the RoleDisasterRecovery const type. 168func PossibleRoleDisasterRecoveryValues() []RoleDisasterRecovery { 169 return []RoleDisasterRecovery{Primary, PrimaryNotReplicating, Secondary} 170} 171 172// SkuName enumerates the values for sku name. 173type SkuName string 174 175const ( 176 // Basic ... 177 Basic SkuName = "Basic" 178 // Standard ... 179 Standard SkuName = "Standard" 180) 181 182// PossibleSkuNameValues returns an array of possible values for the SkuName const type. 183func PossibleSkuNameValues() []SkuName { 184 return []SkuName{Basic, Standard} 185} 186 187// SkuTier enumerates the values for sku tier. 188type SkuTier string 189 190const ( 191 // SkuTierBasic ... 192 SkuTierBasic SkuTier = "Basic" 193 // SkuTierStandard ... 194 SkuTierStandard SkuTier = "Standard" 195) 196 197// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. 198func PossibleSkuTierValues() []SkuTier { 199 return []SkuTier{SkuTierBasic, SkuTierStandard} 200} 201 202// UnavailableReason enumerates the values for unavailable reason. 203type UnavailableReason string 204 205const ( 206 // InvalidName ... 207 InvalidName UnavailableReason = "InvalidName" 208 // NameInLockdown ... 209 NameInLockdown UnavailableReason = "NameInLockdown" 210 // NameInUse ... 211 NameInUse UnavailableReason = "NameInUse" 212 // None ... 213 None UnavailableReason = "None" 214 // SubscriptionIsDisabled ... 215 SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" 216 // TooManyNamespaceInCurrentSubscription ... 217 TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" 218) 219 220// PossibleUnavailableReasonValues returns an array of possible values for the UnavailableReason const type. 221func PossibleUnavailableReasonValues() []UnavailableReason { 222 return []UnavailableReason{InvalidName, NameInLockdown, NameInUse, None, SubscriptionIsDisabled, TooManyNamespaceInCurrentSubscription} 223} 224 225// AccessKeys namespace/EventHub Connection String 226type AccessKeys struct { 227 autorest.Response `json:"-"` 228 // PrimaryConnectionString - READ-ONLY; Primary connection string of the created namespace AuthorizationRule. 229 PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` 230 // SecondaryConnectionString - READ-ONLY; Secondary connection string of the created namespace AuthorizationRule. 231 SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` 232 // AliasPrimaryConnectionString - READ-ONLY; Primary connection string of the alias if GEO DR is enabled 233 AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` 234 // AliasSecondaryConnectionString - READ-ONLY; Secondary connection string of the alias if GEO DR is enabled 235 AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` 236 // PrimaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. 237 PrimaryKey *string `json:"primaryKey,omitempty"` 238 // SecondaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. 239 SecondaryKey *string `json:"secondaryKey,omitempty"` 240 // KeyName - READ-ONLY; A string that describes the AuthorizationRule. 241 KeyName *string `json:"keyName,omitempty"` 242} 243 244// ArmDisasterRecovery single item in List or Get Alias(Disaster Recovery configuration) operation 245type ArmDisasterRecovery struct { 246 autorest.Response `json:"-"` 247 // ArmDisasterRecoveryProperties - Properties required to the Create Or Update Alias(Disaster Recovery configurations) 248 *ArmDisasterRecoveryProperties `json:"properties,omitempty"` 249 // ID - READ-ONLY; Resource Id 250 ID *string `json:"id,omitempty"` 251 // Name - READ-ONLY; Resource name 252 Name *string `json:"name,omitempty"` 253 // Type - READ-ONLY; Resource type 254 Type *string `json:"type,omitempty"` 255} 256 257// MarshalJSON is the custom marshaler for ArmDisasterRecovery. 258func (adr ArmDisasterRecovery) MarshalJSON() ([]byte, error) { 259 objectMap := make(map[string]interface{}) 260 if adr.ArmDisasterRecoveryProperties != nil { 261 objectMap["properties"] = adr.ArmDisasterRecoveryProperties 262 } 263 return json.Marshal(objectMap) 264} 265 266// UnmarshalJSON is the custom unmarshaler for ArmDisasterRecovery struct. 267func (adr *ArmDisasterRecovery) UnmarshalJSON(body []byte) error { 268 var m map[string]*json.RawMessage 269 err := json.Unmarshal(body, &m) 270 if err != nil { 271 return err 272 } 273 for k, v := range m { 274 switch k { 275 case "properties": 276 if v != nil { 277 var armDisasterRecoveryProperties ArmDisasterRecoveryProperties 278 err = json.Unmarshal(*v, &armDisasterRecoveryProperties) 279 if err != nil { 280 return err 281 } 282 adr.ArmDisasterRecoveryProperties = &armDisasterRecoveryProperties 283 } 284 case "id": 285 if v != nil { 286 var ID string 287 err = json.Unmarshal(*v, &ID) 288 if err != nil { 289 return err 290 } 291 adr.ID = &ID 292 } 293 case "name": 294 if v != nil { 295 var name string 296 err = json.Unmarshal(*v, &name) 297 if err != nil { 298 return err 299 } 300 adr.Name = &name 301 } 302 case "type": 303 if v != nil { 304 var typeVar string 305 err = json.Unmarshal(*v, &typeVar) 306 if err != nil { 307 return err 308 } 309 adr.Type = &typeVar 310 } 311 } 312 } 313 314 return nil 315} 316 317// ArmDisasterRecoveryListResult the result of the List Alias(Disaster Recovery configuration) operation. 318type ArmDisasterRecoveryListResult struct { 319 autorest.Response `json:"-"` 320 // Value - List of Alias(Disaster Recovery configurations) 321 Value *[]ArmDisasterRecovery `json:"value,omitempty"` 322 // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration) 323 NextLink *string `json:"nextLink,omitempty"` 324} 325 326// ArmDisasterRecoveryListResultIterator provides access to a complete listing of ArmDisasterRecovery 327// values. 328type ArmDisasterRecoveryListResultIterator struct { 329 i int 330 page ArmDisasterRecoveryListResultPage 331} 332 333// NextWithContext advances to the next value. If there was an error making 334// the request the iterator does not advance and the error is returned. 335func (iter *ArmDisasterRecoveryListResultIterator) NextWithContext(ctx context.Context) (err error) { 336 if tracing.IsEnabled() { 337 ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultIterator.NextWithContext") 338 defer func() { 339 sc := -1 340 if iter.Response().Response.Response != nil { 341 sc = iter.Response().Response.Response.StatusCode 342 } 343 tracing.EndSpan(ctx, sc, err) 344 }() 345 } 346 iter.i++ 347 if iter.i < len(iter.page.Values()) { 348 return nil 349 } 350 err = iter.page.NextWithContext(ctx) 351 if err != nil { 352 iter.i-- 353 return err 354 } 355 iter.i = 0 356 return nil 357} 358 359// Next advances to the next value. If there was an error making 360// the request the iterator does not advance and the error is returned. 361// Deprecated: Use NextWithContext() instead. 362func (iter *ArmDisasterRecoveryListResultIterator) Next() error { 363 return iter.NextWithContext(context.Background()) 364} 365 366// NotDone returns true if the enumeration should be started or is not yet complete. 367func (iter ArmDisasterRecoveryListResultIterator) NotDone() bool { 368 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 369} 370 371// Response returns the raw server response from the last page request. 372func (iter ArmDisasterRecoveryListResultIterator) Response() ArmDisasterRecoveryListResult { 373 return iter.page.Response() 374} 375 376// Value returns the current value or a zero-initialized value if the 377// iterator has advanced beyond the end of the collection. 378func (iter ArmDisasterRecoveryListResultIterator) Value() ArmDisasterRecovery { 379 if !iter.page.NotDone() { 380 return ArmDisasterRecovery{} 381 } 382 return iter.page.Values()[iter.i] 383} 384 385// Creates a new instance of the ArmDisasterRecoveryListResultIterator type. 386func NewArmDisasterRecoveryListResultIterator(page ArmDisasterRecoveryListResultPage) ArmDisasterRecoveryListResultIterator { 387 return ArmDisasterRecoveryListResultIterator{page: page} 388} 389 390// IsEmpty returns true if the ListResult contains no values. 391func (adrlr ArmDisasterRecoveryListResult) IsEmpty() bool { 392 return adrlr.Value == nil || len(*adrlr.Value) == 0 393} 394 395// armDisasterRecoveryListResultPreparer prepares a request to retrieve the next set of results. 396// It returns nil if no more results exist. 397func (adrlr ArmDisasterRecoveryListResult) armDisasterRecoveryListResultPreparer(ctx context.Context) (*http.Request, error) { 398 if adrlr.NextLink == nil || len(to.String(adrlr.NextLink)) < 1 { 399 return nil, nil 400 } 401 return autorest.Prepare((&http.Request{}).WithContext(ctx), 402 autorest.AsJSON(), 403 autorest.AsGet(), 404 autorest.WithBaseURL(to.String(adrlr.NextLink))) 405} 406 407// ArmDisasterRecoveryListResultPage contains a page of ArmDisasterRecovery values. 408type ArmDisasterRecoveryListResultPage struct { 409 fn func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error) 410 adrlr ArmDisasterRecoveryListResult 411} 412 413// NextWithContext advances to the next page of values. If there was an error making 414// the request the page does not advance and the error is returned. 415func (page *ArmDisasterRecoveryListResultPage) NextWithContext(ctx context.Context) (err error) { 416 if tracing.IsEnabled() { 417 ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultPage.NextWithContext") 418 defer func() { 419 sc := -1 420 if page.Response().Response.Response != nil { 421 sc = page.Response().Response.Response.StatusCode 422 } 423 tracing.EndSpan(ctx, sc, err) 424 }() 425 } 426 next, err := page.fn(ctx, page.adrlr) 427 if err != nil { 428 return err 429 } 430 page.adrlr = next 431 return nil 432} 433 434// Next advances to the next page of values. If there was an error making 435// the request the page does not advance and the error is returned. 436// Deprecated: Use NextWithContext() instead. 437func (page *ArmDisasterRecoveryListResultPage) Next() error { 438 return page.NextWithContext(context.Background()) 439} 440 441// NotDone returns true if the page enumeration should be started or is not yet complete. 442func (page ArmDisasterRecoveryListResultPage) NotDone() bool { 443 return !page.adrlr.IsEmpty() 444} 445 446// Response returns the raw server response from the last page request. 447func (page ArmDisasterRecoveryListResultPage) Response() ArmDisasterRecoveryListResult { 448 return page.adrlr 449} 450 451// Values returns the slice of values for the current page or nil if there are no values. 452func (page ArmDisasterRecoveryListResultPage) Values() []ArmDisasterRecovery { 453 if page.adrlr.IsEmpty() { 454 return nil 455 } 456 return *page.adrlr.Value 457} 458 459// Creates a new instance of the ArmDisasterRecoveryListResultPage type. 460func NewArmDisasterRecoveryListResultPage(getNextPage func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error)) ArmDisasterRecoveryListResultPage { 461 return ArmDisasterRecoveryListResultPage{fn: getNextPage} 462} 463 464// ArmDisasterRecoveryProperties properties required to the Create Or Update Alias(Disaster Recovery 465// configurations) 466type ArmDisasterRecoveryProperties struct { 467 // ProvisioningState - READ-ONLY; Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: 'Accepted', 'Succeeded', 'Failed' 468 ProvisioningState ProvisioningStateDR `json:"provisioningState,omitempty"` 469 // PartnerNamespace - ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing 470 PartnerNamespace *string `json:"partnerNamespace,omitempty"` 471 // AlternateName - Alternate name specified when alias and namespace names are same. 472 AlternateName *string `json:"alternateName,omitempty"` 473 // Role - READ-ONLY; role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: 'Primary', 'PrimaryNotReplicating', 'Secondary' 474 Role RoleDisasterRecovery `json:"role,omitempty"` 475 // PendingReplicationOperationsCount - READ-ONLY; Number of entities pending to be replicated. 476 PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` 477} 478 479// AuthorizationRule single item in a List or Get AuthorizationRule operation 480type AuthorizationRule struct { 481 autorest.Response `json:"-"` 482 // AuthorizationRuleProperties - Properties supplied to create or update AuthorizationRule 483 *AuthorizationRuleProperties `json:"properties,omitempty"` 484 // ID - READ-ONLY; Resource Id 485 ID *string `json:"id,omitempty"` 486 // Name - READ-ONLY; Resource name 487 Name *string `json:"name,omitempty"` 488 // Type - READ-ONLY; Resource type 489 Type *string `json:"type,omitempty"` 490} 491 492// MarshalJSON is the custom marshaler for AuthorizationRule. 493func (ar AuthorizationRule) MarshalJSON() ([]byte, error) { 494 objectMap := make(map[string]interface{}) 495 if ar.AuthorizationRuleProperties != nil { 496 objectMap["properties"] = ar.AuthorizationRuleProperties 497 } 498 return json.Marshal(objectMap) 499} 500 501// UnmarshalJSON is the custom unmarshaler for AuthorizationRule struct. 502func (ar *AuthorizationRule) UnmarshalJSON(body []byte) error { 503 var m map[string]*json.RawMessage 504 err := json.Unmarshal(body, &m) 505 if err != nil { 506 return err 507 } 508 for k, v := range m { 509 switch k { 510 case "properties": 511 if v != nil { 512 var authorizationRuleProperties AuthorizationRuleProperties 513 err = json.Unmarshal(*v, &authorizationRuleProperties) 514 if err != nil { 515 return err 516 } 517 ar.AuthorizationRuleProperties = &authorizationRuleProperties 518 } 519 case "id": 520 if v != nil { 521 var ID string 522 err = json.Unmarshal(*v, &ID) 523 if err != nil { 524 return err 525 } 526 ar.ID = &ID 527 } 528 case "name": 529 if v != nil { 530 var name string 531 err = json.Unmarshal(*v, &name) 532 if err != nil { 533 return err 534 } 535 ar.Name = &name 536 } 537 case "type": 538 if v != nil { 539 var typeVar string 540 err = json.Unmarshal(*v, &typeVar) 541 if err != nil { 542 return err 543 } 544 ar.Type = &typeVar 545 } 546 } 547 } 548 549 return nil 550} 551 552// AuthorizationRuleListResult the response from the List namespace operation. 553type AuthorizationRuleListResult struct { 554 autorest.Response `json:"-"` 555 // Value - Result of the List Authorization Rules operation. 556 Value *[]AuthorizationRule `json:"value,omitempty"` 557 // NextLink - Link to the next set of results. Not empty if Value contains an incomplete list of Authorization Rules 558 NextLink *string `json:"nextLink,omitempty"` 559} 560 561// AuthorizationRuleListResultIterator provides access to a complete listing of AuthorizationRule values. 562type AuthorizationRuleListResultIterator struct { 563 i int 564 page AuthorizationRuleListResultPage 565} 566 567// NextWithContext advances to the next value. If there was an error making 568// the request the iterator does not advance and the error is returned. 569func (iter *AuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 570 if tracing.IsEnabled() { 571 ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationRuleListResultIterator.NextWithContext") 572 defer func() { 573 sc := -1 574 if iter.Response().Response.Response != nil { 575 sc = iter.Response().Response.Response.StatusCode 576 } 577 tracing.EndSpan(ctx, sc, err) 578 }() 579 } 580 iter.i++ 581 if iter.i < len(iter.page.Values()) { 582 return nil 583 } 584 err = iter.page.NextWithContext(ctx) 585 if err != nil { 586 iter.i-- 587 return err 588 } 589 iter.i = 0 590 return nil 591} 592 593// Next advances to the next value. If there was an error making 594// the request the iterator does not advance and the error is returned. 595// Deprecated: Use NextWithContext() instead. 596func (iter *AuthorizationRuleListResultIterator) Next() error { 597 return iter.NextWithContext(context.Background()) 598} 599 600// NotDone returns true if the enumeration should be started or is not yet complete. 601func (iter AuthorizationRuleListResultIterator) NotDone() bool { 602 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 603} 604 605// Response returns the raw server response from the last page request. 606func (iter AuthorizationRuleListResultIterator) Response() AuthorizationRuleListResult { 607 return iter.page.Response() 608} 609 610// Value returns the current value or a zero-initialized value if the 611// iterator has advanced beyond the end of the collection. 612func (iter AuthorizationRuleListResultIterator) Value() AuthorizationRule { 613 if !iter.page.NotDone() { 614 return AuthorizationRule{} 615 } 616 return iter.page.Values()[iter.i] 617} 618 619// Creates a new instance of the AuthorizationRuleListResultIterator type. 620func NewAuthorizationRuleListResultIterator(page AuthorizationRuleListResultPage) AuthorizationRuleListResultIterator { 621 return AuthorizationRuleListResultIterator{page: page} 622} 623 624// IsEmpty returns true if the ListResult contains no values. 625func (arlr AuthorizationRuleListResult) IsEmpty() bool { 626 return arlr.Value == nil || len(*arlr.Value) == 0 627} 628 629// authorizationRuleListResultPreparer prepares a request to retrieve the next set of results. 630// It returns nil if no more results exist. 631func (arlr AuthorizationRuleListResult) authorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 632 if arlr.NextLink == nil || len(to.String(arlr.NextLink)) < 1 { 633 return nil, nil 634 } 635 return autorest.Prepare((&http.Request{}).WithContext(ctx), 636 autorest.AsJSON(), 637 autorest.AsGet(), 638 autorest.WithBaseURL(to.String(arlr.NextLink))) 639} 640 641// AuthorizationRuleListResultPage contains a page of AuthorizationRule values. 642type AuthorizationRuleListResultPage struct { 643 fn func(context.Context, AuthorizationRuleListResult) (AuthorizationRuleListResult, error) 644 arlr AuthorizationRuleListResult 645} 646 647// NextWithContext advances to the next page of values. If there was an error making 648// the request the page does not advance and the error is returned. 649func (page *AuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 650 if tracing.IsEnabled() { 651 ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationRuleListResultPage.NextWithContext") 652 defer func() { 653 sc := -1 654 if page.Response().Response.Response != nil { 655 sc = page.Response().Response.Response.StatusCode 656 } 657 tracing.EndSpan(ctx, sc, err) 658 }() 659 } 660 next, err := page.fn(ctx, page.arlr) 661 if err != nil { 662 return err 663 } 664 page.arlr = next 665 return nil 666} 667 668// Next advances to the next page of values. If there was an error making 669// the request the page does not advance and the error is returned. 670// Deprecated: Use NextWithContext() instead. 671func (page *AuthorizationRuleListResultPage) Next() error { 672 return page.NextWithContext(context.Background()) 673} 674 675// NotDone returns true if the page enumeration should be started or is not yet complete. 676func (page AuthorizationRuleListResultPage) NotDone() bool { 677 return !page.arlr.IsEmpty() 678} 679 680// Response returns the raw server response from the last page request. 681func (page AuthorizationRuleListResultPage) Response() AuthorizationRuleListResult { 682 return page.arlr 683} 684 685// Values returns the slice of values for the current page or nil if there are no values. 686func (page AuthorizationRuleListResultPage) Values() []AuthorizationRule { 687 if page.arlr.IsEmpty() { 688 return nil 689 } 690 return *page.arlr.Value 691} 692 693// Creates a new instance of the AuthorizationRuleListResultPage type. 694func NewAuthorizationRuleListResultPage(getNextPage func(context.Context, AuthorizationRuleListResult) (AuthorizationRuleListResult, error)) AuthorizationRuleListResultPage { 695 return AuthorizationRuleListResultPage{fn: getNextPage} 696} 697 698// AuthorizationRuleProperties properties supplied to create or update AuthorizationRule 699type AuthorizationRuleProperties struct { 700 // Rights - The rights associated with the rule. 701 Rights *[]AccessRights `json:"rights,omitempty"` 702} 703 704// CaptureDescription properties to configure capture description for eventhub 705type CaptureDescription struct { 706 // Enabled - A value that indicates whether capture description is enabled. 707 Enabled *bool `json:"enabled,omitempty"` 708 // Encoding - Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version. Possible values include: 'Avro', 'AvroDeflate' 709 Encoding EncodingCaptureDescription `json:"encoding,omitempty"` 710 // IntervalInSeconds - The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds 711 IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` 712 // SizeLimitInBytes - The size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 to 524288000 bytes 713 SizeLimitInBytes *int32 `json:"sizeLimitInBytes,omitempty"` 714 // Destination - Properties of Destination where capture will be stored. (Storage Account, Blob Names) 715 Destination *Destination `json:"destination,omitempty"` 716 // SkipEmptyArchives - A value that indicates whether to Skip Empty Archives 717 SkipEmptyArchives *bool `json:"skipEmptyArchives,omitempty"` 718} 719 720// CheckNameAvailabilityParameter parameter supplied to check Namespace name availability operation 721type CheckNameAvailabilityParameter struct { 722 // Name - Name to check the namespace name availability 723 Name *string `json:"name,omitempty"` 724} 725 726// CheckNameAvailabilityResult the Result of the CheckNameAvailability operation 727type CheckNameAvailabilityResult struct { 728 autorest.Response `json:"-"` 729 // Message - READ-ONLY; The detailed info regarding the reason associated with the Namespace. 730 Message *string `json:"message,omitempty"` 731 // NameAvailable - Value indicating Namespace is availability, true if the Namespace is available; otherwise, false. 732 NameAvailable *bool `json:"nameAvailable,omitempty"` 733 // Reason - The reason for unavailability of a Namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription' 734 Reason UnavailableReason `json:"reason,omitempty"` 735} 736 737// ConsumerGroup single item in List or Get Consumer group operation 738type ConsumerGroup struct { 739 autorest.Response `json:"-"` 740 // ConsumerGroupProperties - Single item in List or Get Consumer group operation 741 *ConsumerGroupProperties `json:"properties,omitempty"` 742 // ID - READ-ONLY; Resource Id 743 ID *string `json:"id,omitempty"` 744 // Name - READ-ONLY; Resource name 745 Name *string `json:"name,omitempty"` 746 // Type - READ-ONLY; Resource type 747 Type *string `json:"type,omitempty"` 748} 749 750// MarshalJSON is the custom marshaler for ConsumerGroup. 751func (cg ConsumerGroup) MarshalJSON() ([]byte, error) { 752 objectMap := make(map[string]interface{}) 753 if cg.ConsumerGroupProperties != nil { 754 objectMap["properties"] = cg.ConsumerGroupProperties 755 } 756 return json.Marshal(objectMap) 757} 758 759// UnmarshalJSON is the custom unmarshaler for ConsumerGroup struct. 760func (cg *ConsumerGroup) UnmarshalJSON(body []byte) error { 761 var m map[string]*json.RawMessage 762 err := json.Unmarshal(body, &m) 763 if err != nil { 764 return err 765 } 766 for k, v := range m { 767 switch k { 768 case "properties": 769 if v != nil { 770 var consumerGroupProperties ConsumerGroupProperties 771 err = json.Unmarshal(*v, &consumerGroupProperties) 772 if err != nil { 773 return err 774 } 775 cg.ConsumerGroupProperties = &consumerGroupProperties 776 } 777 case "id": 778 if v != nil { 779 var ID string 780 err = json.Unmarshal(*v, &ID) 781 if err != nil { 782 return err 783 } 784 cg.ID = &ID 785 } 786 case "name": 787 if v != nil { 788 var name string 789 err = json.Unmarshal(*v, &name) 790 if err != nil { 791 return err 792 } 793 cg.Name = &name 794 } 795 case "type": 796 if v != nil { 797 var typeVar string 798 err = json.Unmarshal(*v, &typeVar) 799 if err != nil { 800 return err 801 } 802 cg.Type = &typeVar 803 } 804 } 805 } 806 807 return nil 808} 809 810// ConsumerGroupListResult the result to the List Consumer Group operation. 811type ConsumerGroupListResult struct { 812 autorest.Response `json:"-"` 813 // Value - Result of the List Consumer Group operation. 814 Value *[]ConsumerGroup `json:"value,omitempty"` 815 // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Consumer Group 816 NextLink *string `json:"nextLink,omitempty"` 817} 818 819// ConsumerGroupListResultIterator provides access to a complete listing of ConsumerGroup values. 820type ConsumerGroupListResultIterator struct { 821 i int 822 page ConsumerGroupListResultPage 823} 824 825// NextWithContext advances to the next value. If there was an error making 826// the request the iterator does not advance and the error is returned. 827func (iter *ConsumerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 828 if tracing.IsEnabled() { 829 ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerGroupListResultIterator.NextWithContext") 830 defer func() { 831 sc := -1 832 if iter.Response().Response.Response != nil { 833 sc = iter.Response().Response.Response.StatusCode 834 } 835 tracing.EndSpan(ctx, sc, err) 836 }() 837 } 838 iter.i++ 839 if iter.i < len(iter.page.Values()) { 840 return nil 841 } 842 err = iter.page.NextWithContext(ctx) 843 if err != nil { 844 iter.i-- 845 return err 846 } 847 iter.i = 0 848 return nil 849} 850 851// Next advances to the next value. If there was an error making 852// the request the iterator does not advance and the error is returned. 853// Deprecated: Use NextWithContext() instead. 854func (iter *ConsumerGroupListResultIterator) Next() error { 855 return iter.NextWithContext(context.Background()) 856} 857 858// NotDone returns true if the enumeration should be started or is not yet complete. 859func (iter ConsumerGroupListResultIterator) NotDone() bool { 860 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 861} 862 863// Response returns the raw server response from the last page request. 864func (iter ConsumerGroupListResultIterator) Response() ConsumerGroupListResult { 865 return iter.page.Response() 866} 867 868// Value returns the current value or a zero-initialized value if the 869// iterator has advanced beyond the end of the collection. 870func (iter ConsumerGroupListResultIterator) Value() ConsumerGroup { 871 if !iter.page.NotDone() { 872 return ConsumerGroup{} 873 } 874 return iter.page.Values()[iter.i] 875} 876 877// Creates a new instance of the ConsumerGroupListResultIterator type. 878func NewConsumerGroupListResultIterator(page ConsumerGroupListResultPage) ConsumerGroupListResultIterator { 879 return ConsumerGroupListResultIterator{page: page} 880} 881 882// IsEmpty returns true if the ListResult contains no values. 883func (cglr ConsumerGroupListResult) IsEmpty() bool { 884 return cglr.Value == nil || len(*cglr.Value) == 0 885} 886 887// consumerGroupListResultPreparer prepares a request to retrieve the next set of results. 888// It returns nil if no more results exist. 889func (cglr ConsumerGroupListResult) consumerGroupListResultPreparer(ctx context.Context) (*http.Request, error) { 890 if cglr.NextLink == nil || len(to.String(cglr.NextLink)) < 1 { 891 return nil, nil 892 } 893 return autorest.Prepare((&http.Request{}).WithContext(ctx), 894 autorest.AsJSON(), 895 autorest.AsGet(), 896 autorest.WithBaseURL(to.String(cglr.NextLink))) 897} 898 899// ConsumerGroupListResultPage contains a page of ConsumerGroup values. 900type ConsumerGroupListResultPage struct { 901 fn func(context.Context, ConsumerGroupListResult) (ConsumerGroupListResult, error) 902 cglr ConsumerGroupListResult 903} 904 905// NextWithContext advances to the next page of values. If there was an error making 906// the request the page does not advance and the error is returned. 907func (page *ConsumerGroupListResultPage) NextWithContext(ctx context.Context) (err error) { 908 if tracing.IsEnabled() { 909 ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerGroupListResultPage.NextWithContext") 910 defer func() { 911 sc := -1 912 if page.Response().Response.Response != nil { 913 sc = page.Response().Response.Response.StatusCode 914 } 915 tracing.EndSpan(ctx, sc, err) 916 }() 917 } 918 next, err := page.fn(ctx, page.cglr) 919 if err != nil { 920 return err 921 } 922 page.cglr = next 923 return nil 924} 925 926// Next advances to the next page of values. If there was an error making 927// the request the page does not advance and the error is returned. 928// Deprecated: Use NextWithContext() instead. 929func (page *ConsumerGroupListResultPage) Next() error { 930 return page.NextWithContext(context.Background()) 931} 932 933// NotDone returns true if the page enumeration should be started or is not yet complete. 934func (page ConsumerGroupListResultPage) NotDone() bool { 935 return !page.cglr.IsEmpty() 936} 937 938// Response returns the raw server response from the last page request. 939func (page ConsumerGroupListResultPage) Response() ConsumerGroupListResult { 940 return page.cglr 941} 942 943// Values returns the slice of values for the current page or nil if there are no values. 944func (page ConsumerGroupListResultPage) Values() []ConsumerGroup { 945 if page.cglr.IsEmpty() { 946 return nil 947 } 948 return *page.cglr.Value 949} 950 951// Creates a new instance of the ConsumerGroupListResultPage type. 952func NewConsumerGroupListResultPage(getNextPage func(context.Context, ConsumerGroupListResult) (ConsumerGroupListResult, error)) ConsumerGroupListResultPage { 953 return ConsumerGroupListResultPage{fn: getNextPage} 954} 955 956// ConsumerGroupProperties single item in List or Get Consumer group operation 957type ConsumerGroupProperties struct { 958 // CreatedAt - READ-ONLY; Exact time the message was created. 959 CreatedAt *date.Time `json:"createdAt,omitempty"` 960 // UpdatedAt - READ-ONLY; The exact time the message was updated. 961 UpdatedAt *date.Time `json:"updatedAt,omitempty"` 962 // UserMetadata - User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. 963 UserMetadata *string `json:"userMetadata,omitempty"` 964} 965 966// Destination capture storage details for capture description 967type Destination struct { 968 // Name - Name for capture destination 969 Name *string `json:"name,omitempty"` 970 // DestinationProperties - Properties describing the storage account, blob container and archive name format for capture destination 971 *DestinationProperties `json:"properties,omitempty"` 972} 973 974// MarshalJSON is the custom marshaler for Destination. 975func (d Destination) MarshalJSON() ([]byte, error) { 976 objectMap := make(map[string]interface{}) 977 if d.Name != nil { 978 objectMap["name"] = d.Name 979 } 980 if d.DestinationProperties != nil { 981 objectMap["properties"] = d.DestinationProperties 982 } 983 return json.Marshal(objectMap) 984} 985 986// UnmarshalJSON is the custom unmarshaler for Destination struct. 987func (d *Destination) UnmarshalJSON(body []byte) error { 988 var m map[string]*json.RawMessage 989 err := json.Unmarshal(body, &m) 990 if err != nil { 991 return err 992 } 993 for k, v := range m { 994 switch k { 995 case "name": 996 if v != nil { 997 var name string 998 err = json.Unmarshal(*v, &name) 999 if err != nil { 1000 return err 1001 } 1002 d.Name = &name 1003 } 1004 case "properties": 1005 if v != nil { 1006 var destinationProperties DestinationProperties 1007 err = json.Unmarshal(*v, &destinationProperties) 1008 if err != nil { 1009 return err 1010 } 1011 d.DestinationProperties = &destinationProperties 1012 } 1013 } 1014 } 1015 1016 return nil 1017} 1018 1019// DestinationProperties properties describing the storage account, blob container and archive name format 1020// for capture destination 1021type DestinationProperties struct { 1022 // StorageAccountResourceID - Resource id of the storage account to be used to create the blobs 1023 StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` 1024 // BlobContainer - Blob container Name 1025 BlobContainer *string `json:"blobContainer,omitempty"` 1026 // ArchiveNameFormat - Blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order 1027 ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"` 1028} 1029 1030// EHNamespace single Namespace item in List or Get Operation 1031type EHNamespace struct { 1032 autorest.Response `json:"-"` 1033 // Sku - Properties of sku resource 1034 Sku *Sku `json:"sku,omitempty"` 1035 // EHNamespaceProperties - Namespace properties supplied for create namespace operation. 1036 *EHNamespaceProperties `json:"properties,omitempty"` 1037 // Location - Resource location 1038 Location *string `json:"location,omitempty"` 1039 // Tags - Resource tags 1040 Tags map[string]*string `json:"tags"` 1041 // ID - READ-ONLY; Resource Id 1042 ID *string `json:"id,omitempty"` 1043 // Name - READ-ONLY; Resource name 1044 Name *string `json:"name,omitempty"` 1045 // Type - READ-ONLY; Resource type 1046 Type *string `json:"type,omitempty"` 1047} 1048 1049// MarshalJSON is the custom marshaler for EHNamespace. 1050func (en EHNamespace) MarshalJSON() ([]byte, error) { 1051 objectMap := make(map[string]interface{}) 1052 if en.Sku != nil { 1053 objectMap["sku"] = en.Sku 1054 } 1055 if en.EHNamespaceProperties != nil { 1056 objectMap["properties"] = en.EHNamespaceProperties 1057 } 1058 if en.Location != nil { 1059 objectMap["location"] = en.Location 1060 } 1061 if en.Tags != nil { 1062 objectMap["tags"] = en.Tags 1063 } 1064 return json.Marshal(objectMap) 1065} 1066 1067// UnmarshalJSON is the custom unmarshaler for EHNamespace struct. 1068func (en *EHNamespace) UnmarshalJSON(body []byte) error { 1069 var m map[string]*json.RawMessage 1070 err := json.Unmarshal(body, &m) 1071 if err != nil { 1072 return err 1073 } 1074 for k, v := range m { 1075 switch k { 1076 case "sku": 1077 if v != nil { 1078 var sku Sku 1079 err = json.Unmarshal(*v, &sku) 1080 if err != nil { 1081 return err 1082 } 1083 en.Sku = &sku 1084 } 1085 case "properties": 1086 if v != nil { 1087 var eHNamespaceProperties EHNamespaceProperties 1088 err = json.Unmarshal(*v, &eHNamespaceProperties) 1089 if err != nil { 1090 return err 1091 } 1092 en.EHNamespaceProperties = &eHNamespaceProperties 1093 } 1094 case "location": 1095 if v != nil { 1096 var location string 1097 err = json.Unmarshal(*v, &location) 1098 if err != nil { 1099 return err 1100 } 1101 en.Location = &location 1102 } 1103 case "tags": 1104 if v != nil { 1105 var tags map[string]*string 1106 err = json.Unmarshal(*v, &tags) 1107 if err != nil { 1108 return err 1109 } 1110 en.Tags = tags 1111 } 1112 case "id": 1113 if v != nil { 1114 var ID string 1115 err = json.Unmarshal(*v, &ID) 1116 if err != nil { 1117 return err 1118 } 1119 en.ID = &ID 1120 } 1121 case "name": 1122 if v != nil { 1123 var name string 1124 err = json.Unmarshal(*v, &name) 1125 if err != nil { 1126 return err 1127 } 1128 en.Name = &name 1129 } 1130 case "type": 1131 if v != nil { 1132 var typeVar string 1133 err = json.Unmarshal(*v, &typeVar) 1134 if err != nil { 1135 return err 1136 } 1137 en.Type = &typeVar 1138 } 1139 } 1140 } 1141 1142 return nil 1143} 1144 1145// EHNamespaceListResult the response of the List Namespace operation 1146type EHNamespaceListResult struct { 1147 autorest.Response `json:"-"` 1148 // Value - Result of the List Namespace operation 1149 Value *[]EHNamespace `json:"value,omitempty"` 1150 // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of namespaces. 1151 NextLink *string `json:"nextLink,omitempty"` 1152} 1153 1154// EHNamespaceListResultIterator provides access to a complete listing of EHNamespace values. 1155type EHNamespaceListResultIterator struct { 1156 i int 1157 page EHNamespaceListResultPage 1158} 1159 1160// NextWithContext advances to the next value. If there was an error making 1161// the request the iterator does not advance and the error is returned. 1162func (iter *EHNamespaceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1163 if tracing.IsEnabled() { 1164 ctx = tracing.StartSpan(ctx, fqdn+"/EHNamespaceListResultIterator.NextWithContext") 1165 defer func() { 1166 sc := -1 1167 if iter.Response().Response.Response != nil { 1168 sc = iter.Response().Response.Response.StatusCode 1169 } 1170 tracing.EndSpan(ctx, sc, err) 1171 }() 1172 } 1173 iter.i++ 1174 if iter.i < len(iter.page.Values()) { 1175 return nil 1176 } 1177 err = iter.page.NextWithContext(ctx) 1178 if err != nil { 1179 iter.i-- 1180 return err 1181 } 1182 iter.i = 0 1183 return nil 1184} 1185 1186// Next advances to the next value. If there was an error making 1187// the request the iterator does not advance and the error is returned. 1188// Deprecated: Use NextWithContext() instead. 1189func (iter *EHNamespaceListResultIterator) Next() error { 1190 return iter.NextWithContext(context.Background()) 1191} 1192 1193// NotDone returns true if the enumeration should be started or is not yet complete. 1194func (iter EHNamespaceListResultIterator) NotDone() bool { 1195 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1196} 1197 1198// Response returns the raw server response from the last page request. 1199func (iter EHNamespaceListResultIterator) Response() EHNamespaceListResult { 1200 return iter.page.Response() 1201} 1202 1203// Value returns the current value or a zero-initialized value if the 1204// iterator has advanced beyond the end of the collection. 1205func (iter EHNamespaceListResultIterator) Value() EHNamespace { 1206 if !iter.page.NotDone() { 1207 return EHNamespace{} 1208 } 1209 return iter.page.Values()[iter.i] 1210} 1211 1212// Creates a new instance of the EHNamespaceListResultIterator type. 1213func NewEHNamespaceListResultIterator(page EHNamespaceListResultPage) EHNamespaceListResultIterator { 1214 return EHNamespaceListResultIterator{page: page} 1215} 1216 1217// IsEmpty returns true if the ListResult contains no values. 1218func (enlr EHNamespaceListResult) IsEmpty() bool { 1219 return enlr.Value == nil || len(*enlr.Value) == 0 1220} 1221 1222// eHNamespaceListResultPreparer prepares a request to retrieve the next set of results. 1223// It returns nil if no more results exist. 1224func (enlr EHNamespaceListResult) eHNamespaceListResultPreparer(ctx context.Context) (*http.Request, error) { 1225 if enlr.NextLink == nil || len(to.String(enlr.NextLink)) < 1 { 1226 return nil, nil 1227 } 1228 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1229 autorest.AsJSON(), 1230 autorest.AsGet(), 1231 autorest.WithBaseURL(to.String(enlr.NextLink))) 1232} 1233 1234// EHNamespaceListResultPage contains a page of EHNamespace values. 1235type EHNamespaceListResultPage struct { 1236 fn func(context.Context, EHNamespaceListResult) (EHNamespaceListResult, error) 1237 enlr EHNamespaceListResult 1238} 1239 1240// NextWithContext advances to the next page of values. If there was an error making 1241// the request the page does not advance and the error is returned. 1242func (page *EHNamespaceListResultPage) NextWithContext(ctx context.Context) (err error) { 1243 if tracing.IsEnabled() { 1244 ctx = tracing.StartSpan(ctx, fqdn+"/EHNamespaceListResultPage.NextWithContext") 1245 defer func() { 1246 sc := -1 1247 if page.Response().Response.Response != nil { 1248 sc = page.Response().Response.Response.StatusCode 1249 } 1250 tracing.EndSpan(ctx, sc, err) 1251 }() 1252 } 1253 next, err := page.fn(ctx, page.enlr) 1254 if err != nil { 1255 return err 1256 } 1257 page.enlr = next 1258 return nil 1259} 1260 1261// Next advances to the next page of values. If there was an error making 1262// the request the page does not advance and the error is returned. 1263// Deprecated: Use NextWithContext() instead. 1264func (page *EHNamespaceListResultPage) Next() error { 1265 return page.NextWithContext(context.Background()) 1266} 1267 1268// NotDone returns true if the page enumeration should be started or is not yet complete. 1269func (page EHNamespaceListResultPage) NotDone() bool { 1270 return !page.enlr.IsEmpty() 1271} 1272 1273// Response returns the raw server response from the last page request. 1274func (page EHNamespaceListResultPage) Response() EHNamespaceListResult { 1275 return page.enlr 1276} 1277 1278// Values returns the slice of values for the current page or nil if there are no values. 1279func (page EHNamespaceListResultPage) Values() []EHNamespace { 1280 if page.enlr.IsEmpty() { 1281 return nil 1282 } 1283 return *page.enlr.Value 1284} 1285 1286// Creates a new instance of the EHNamespaceListResultPage type. 1287func NewEHNamespaceListResultPage(getNextPage func(context.Context, EHNamespaceListResult) (EHNamespaceListResult, error)) EHNamespaceListResultPage { 1288 return EHNamespaceListResultPage{fn: getNextPage} 1289} 1290 1291// EHNamespaceProperties namespace properties supplied for create namespace operation. 1292type EHNamespaceProperties struct { 1293 // ProvisioningState - READ-ONLY; Provisioning state of the Namespace. 1294 ProvisioningState *string `json:"provisioningState,omitempty"` 1295 // CreatedAt - READ-ONLY; The time the Namespace was created. 1296 CreatedAt *date.Time `json:"createdAt,omitempty"` 1297 // UpdatedAt - READ-ONLY; The time the Namespace was updated. 1298 UpdatedAt *date.Time `json:"updatedAt,omitempty"` 1299 // ServiceBusEndpoint - READ-ONLY; Endpoint you can use to perform Service Bus operations. 1300 ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` 1301 // MetricID - READ-ONLY; Identifier for Azure Insights metrics. 1302 MetricID *string `json:"metricId,omitempty"` 1303 // IsAutoInflateEnabled - Value that indicates whether AutoInflate is enabled for eventhub namespace. 1304 IsAutoInflateEnabled *bool `json:"isAutoInflateEnabled,omitempty"` 1305 // MaximumThroughputUnits - Upper limit of throughput units when AutoInflate is enabled, value should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true) 1306 MaximumThroughputUnits *int32 `json:"maximumThroughputUnits,omitempty"` 1307 // KafkaEnabled - Value that indicates whether Kafka is enabled for eventhub namespace. 1308 KafkaEnabled *bool `json:"kafkaEnabled,omitempty"` 1309} 1310 1311// ErrorResponse error response indicates EventHub service is not able to process the incoming request. The 1312// reason is provided in the error message. 1313type ErrorResponse struct { 1314 // Code - Error code. 1315 Code *string `json:"code,omitempty"` 1316 // Message - Error message indicating why the operation failed. 1317 Message *string `json:"message,omitempty"` 1318} 1319 1320// ListResult the result of the List EventHubs operation. 1321type ListResult struct { 1322 autorest.Response `json:"-"` 1323 // Value - Result of the List EventHubs operation. 1324 Value *[]Model `json:"value,omitempty"` 1325 // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. 1326 NextLink *string `json:"nextLink,omitempty"` 1327} 1328 1329// ListResultIterator provides access to a complete listing of Model values. 1330type ListResultIterator struct { 1331 i int 1332 page ListResultPage 1333} 1334 1335// NextWithContext advances to the next value. If there was an error making 1336// the request the iterator does not advance and the error is returned. 1337func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 1338 if tracing.IsEnabled() { 1339 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 1340 defer func() { 1341 sc := -1 1342 if iter.Response().Response.Response != nil { 1343 sc = iter.Response().Response.Response.StatusCode 1344 } 1345 tracing.EndSpan(ctx, sc, err) 1346 }() 1347 } 1348 iter.i++ 1349 if iter.i < len(iter.page.Values()) { 1350 return nil 1351 } 1352 err = iter.page.NextWithContext(ctx) 1353 if err != nil { 1354 iter.i-- 1355 return err 1356 } 1357 iter.i = 0 1358 return nil 1359} 1360 1361// Next advances to the next value. If there was an error making 1362// the request the iterator does not advance and the error is returned. 1363// Deprecated: Use NextWithContext() instead. 1364func (iter *ListResultIterator) Next() error { 1365 return iter.NextWithContext(context.Background()) 1366} 1367 1368// NotDone returns true if the enumeration should be started or is not yet complete. 1369func (iter ListResultIterator) NotDone() bool { 1370 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1371} 1372 1373// Response returns the raw server response from the last page request. 1374func (iter ListResultIterator) Response() ListResult { 1375 return iter.page.Response() 1376} 1377 1378// Value returns the current value or a zero-initialized value if the 1379// iterator has advanced beyond the end of the collection. 1380func (iter ListResultIterator) Value() Model { 1381 if !iter.page.NotDone() { 1382 return Model{} 1383 } 1384 return iter.page.Values()[iter.i] 1385} 1386 1387// Creates a new instance of the ListResultIterator type. 1388func NewListResultIterator(page ListResultPage) ListResultIterator { 1389 return ListResultIterator{page: page} 1390} 1391 1392// IsEmpty returns true if the ListResult contains no values. 1393func (lr ListResult) IsEmpty() bool { 1394 return lr.Value == nil || len(*lr.Value) == 0 1395} 1396 1397// listResultPreparer prepares a request to retrieve the next set of results. 1398// It returns nil if no more results exist. 1399func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 1400 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 1401 return nil, nil 1402 } 1403 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1404 autorest.AsJSON(), 1405 autorest.AsGet(), 1406 autorest.WithBaseURL(to.String(lr.NextLink))) 1407} 1408 1409// ListResultPage contains a page of Model values. 1410type ListResultPage struct { 1411 fn func(context.Context, ListResult) (ListResult, error) 1412 lr ListResult 1413} 1414 1415// NextWithContext advances to the next page of values. If there was an error making 1416// the request the page does not advance and the error is returned. 1417func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 1418 if tracing.IsEnabled() { 1419 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 1420 defer func() { 1421 sc := -1 1422 if page.Response().Response.Response != nil { 1423 sc = page.Response().Response.Response.StatusCode 1424 } 1425 tracing.EndSpan(ctx, sc, err) 1426 }() 1427 } 1428 next, err := page.fn(ctx, page.lr) 1429 if err != nil { 1430 return err 1431 } 1432 page.lr = next 1433 return nil 1434} 1435 1436// Next advances to the next page of values. If there was an error making 1437// the request the page does not advance and the error is returned. 1438// Deprecated: Use NextWithContext() instead. 1439func (page *ListResultPage) Next() error { 1440 return page.NextWithContext(context.Background()) 1441} 1442 1443// NotDone returns true if the page enumeration should be started or is not yet complete. 1444func (page ListResultPage) NotDone() bool { 1445 return !page.lr.IsEmpty() 1446} 1447 1448// Response returns the raw server response from the last page request. 1449func (page ListResultPage) Response() ListResult { 1450 return page.lr 1451} 1452 1453// Values returns the slice of values for the current page or nil if there are no values. 1454func (page ListResultPage) Values() []Model { 1455 if page.lr.IsEmpty() { 1456 return nil 1457 } 1458 return *page.lr.Value 1459} 1460 1461// Creates a new instance of the ListResultPage type. 1462func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 1463 return ListResultPage{fn: getNextPage} 1464} 1465 1466// MessagingPlan messaging Plan for the namespace 1467type MessagingPlan struct { 1468 autorest.Response `json:"-"` 1469 *MessagingPlanProperties `json:"properties,omitempty"` 1470 // Location - Resource location 1471 Location *string `json:"location,omitempty"` 1472 // Tags - Resource tags 1473 Tags map[string]*string `json:"tags"` 1474 // ID - READ-ONLY; Resource Id 1475 ID *string `json:"id,omitempty"` 1476 // Name - READ-ONLY; Resource name 1477 Name *string `json:"name,omitempty"` 1478 // Type - READ-ONLY; Resource type 1479 Type *string `json:"type,omitempty"` 1480} 1481 1482// MarshalJSON is the custom marshaler for MessagingPlan. 1483func (mp MessagingPlan) MarshalJSON() ([]byte, error) { 1484 objectMap := make(map[string]interface{}) 1485 if mp.MessagingPlanProperties != nil { 1486 objectMap["properties"] = mp.MessagingPlanProperties 1487 } 1488 if mp.Location != nil { 1489 objectMap["location"] = mp.Location 1490 } 1491 if mp.Tags != nil { 1492 objectMap["tags"] = mp.Tags 1493 } 1494 return json.Marshal(objectMap) 1495} 1496 1497// UnmarshalJSON is the custom unmarshaler for MessagingPlan struct. 1498func (mp *MessagingPlan) UnmarshalJSON(body []byte) error { 1499 var m map[string]*json.RawMessage 1500 err := json.Unmarshal(body, &m) 1501 if err != nil { 1502 return err 1503 } 1504 for k, v := range m { 1505 switch k { 1506 case "properties": 1507 if v != nil { 1508 var messagingPlanProperties MessagingPlanProperties 1509 err = json.Unmarshal(*v, &messagingPlanProperties) 1510 if err != nil { 1511 return err 1512 } 1513 mp.MessagingPlanProperties = &messagingPlanProperties 1514 } 1515 case "location": 1516 if v != nil { 1517 var location string 1518 err = json.Unmarshal(*v, &location) 1519 if err != nil { 1520 return err 1521 } 1522 mp.Location = &location 1523 } 1524 case "tags": 1525 if v != nil { 1526 var tags map[string]*string 1527 err = json.Unmarshal(*v, &tags) 1528 if err != nil { 1529 return err 1530 } 1531 mp.Tags = tags 1532 } 1533 case "id": 1534 if v != nil { 1535 var ID string 1536 err = json.Unmarshal(*v, &ID) 1537 if err != nil { 1538 return err 1539 } 1540 mp.ID = &ID 1541 } 1542 case "name": 1543 if v != nil { 1544 var name string 1545 err = json.Unmarshal(*v, &name) 1546 if err != nil { 1547 return err 1548 } 1549 mp.Name = &name 1550 } 1551 case "type": 1552 if v != nil { 1553 var typeVar string 1554 err = json.Unmarshal(*v, &typeVar) 1555 if err != nil { 1556 return err 1557 } 1558 mp.Type = &typeVar 1559 } 1560 } 1561 } 1562 1563 return nil 1564} 1565 1566// MessagingPlanProperties ... 1567type MessagingPlanProperties struct { 1568 // Sku - READ-ONLY; Sku type 1569 Sku *int32 `json:"sku,omitempty"` 1570 // SelectedEventHubUnit - READ-ONLY; Selected event hub unit 1571 SelectedEventHubUnit *int32 `json:"selectedEventHubUnit,omitempty"` 1572 // UpdatedAt - READ-ONLY; The exact time the messaging plan was updated. 1573 UpdatedAt *date.Time `json:"updatedAt,omitempty"` 1574 // Revision - READ-ONLY; revision number 1575 Revision *int64 `json:"revision,omitempty"` 1576} 1577 1578// MessagingRegions messaging Region 1579type MessagingRegions struct { 1580 Properties *MessagingRegionsProperties `json:"properties,omitempty"` 1581 // Location - Resource location 1582 Location *string `json:"location,omitempty"` 1583 // Tags - Resource tags 1584 Tags map[string]*string `json:"tags"` 1585 // ID - READ-ONLY; Resource Id 1586 ID *string `json:"id,omitempty"` 1587 // Name - READ-ONLY; Resource name 1588 Name *string `json:"name,omitempty"` 1589 // Type - READ-ONLY; Resource type 1590 Type *string `json:"type,omitempty"` 1591} 1592 1593// MarshalJSON is the custom marshaler for MessagingRegions. 1594func (mr MessagingRegions) MarshalJSON() ([]byte, error) { 1595 objectMap := make(map[string]interface{}) 1596 if mr.Properties != nil { 1597 objectMap["properties"] = mr.Properties 1598 } 1599 if mr.Location != nil { 1600 objectMap["location"] = mr.Location 1601 } 1602 if mr.Tags != nil { 1603 objectMap["tags"] = mr.Tags 1604 } 1605 return json.Marshal(objectMap) 1606} 1607 1608// MessagingRegionsListResult the response of the List MessagingRegions operation. 1609type MessagingRegionsListResult struct { 1610 autorest.Response `json:"-"` 1611 // Value - Result of the List MessagingRegions type. 1612 Value *[]MessagingRegions `json:"value,omitempty"` 1613 // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of MessagingRegions. 1614 NextLink *string `json:"nextLink,omitempty"` 1615} 1616 1617// MessagingRegionsListResultIterator provides access to a complete listing of MessagingRegions values. 1618type MessagingRegionsListResultIterator struct { 1619 i int 1620 page MessagingRegionsListResultPage 1621} 1622 1623// NextWithContext advances to the next value. If there was an error making 1624// the request the iterator does not advance and the error is returned. 1625func (iter *MessagingRegionsListResultIterator) NextWithContext(ctx context.Context) (err error) { 1626 if tracing.IsEnabled() { 1627 ctx = tracing.StartSpan(ctx, fqdn+"/MessagingRegionsListResultIterator.NextWithContext") 1628 defer func() { 1629 sc := -1 1630 if iter.Response().Response.Response != nil { 1631 sc = iter.Response().Response.Response.StatusCode 1632 } 1633 tracing.EndSpan(ctx, sc, err) 1634 }() 1635 } 1636 iter.i++ 1637 if iter.i < len(iter.page.Values()) { 1638 return nil 1639 } 1640 err = iter.page.NextWithContext(ctx) 1641 if err != nil { 1642 iter.i-- 1643 return err 1644 } 1645 iter.i = 0 1646 return nil 1647} 1648 1649// Next advances to the next value. If there was an error making 1650// the request the iterator does not advance and the error is returned. 1651// Deprecated: Use NextWithContext() instead. 1652func (iter *MessagingRegionsListResultIterator) Next() error { 1653 return iter.NextWithContext(context.Background()) 1654} 1655 1656// NotDone returns true if the enumeration should be started or is not yet complete. 1657func (iter MessagingRegionsListResultIterator) NotDone() bool { 1658 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1659} 1660 1661// Response returns the raw server response from the last page request. 1662func (iter MessagingRegionsListResultIterator) Response() MessagingRegionsListResult { 1663 return iter.page.Response() 1664} 1665 1666// Value returns the current value or a zero-initialized value if the 1667// iterator has advanced beyond the end of the collection. 1668func (iter MessagingRegionsListResultIterator) Value() MessagingRegions { 1669 if !iter.page.NotDone() { 1670 return MessagingRegions{} 1671 } 1672 return iter.page.Values()[iter.i] 1673} 1674 1675// Creates a new instance of the MessagingRegionsListResultIterator type. 1676func NewMessagingRegionsListResultIterator(page MessagingRegionsListResultPage) MessagingRegionsListResultIterator { 1677 return MessagingRegionsListResultIterator{page: page} 1678} 1679 1680// IsEmpty returns true if the ListResult contains no values. 1681func (mrlr MessagingRegionsListResult) IsEmpty() bool { 1682 return mrlr.Value == nil || len(*mrlr.Value) == 0 1683} 1684 1685// messagingRegionsListResultPreparer prepares a request to retrieve the next set of results. 1686// It returns nil if no more results exist. 1687func (mrlr MessagingRegionsListResult) messagingRegionsListResultPreparer(ctx context.Context) (*http.Request, error) { 1688 if mrlr.NextLink == nil || len(to.String(mrlr.NextLink)) < 1 { 1689 return nil, nil 1690 } 1691 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1692 autorest.AsJSON(), 1693 autorest.AsGet(), 1694 autorest.WithBaseURL(to.String(mrlr.NextLink))) 1695} 1696 1697// MessagingRegionsListResultPage contains a page of MessagingRegions values. 1698type MessagingRegionsListResultPage struct { 1699 fn func(context.Context, MessagingRegionsListResult) (MessagingRegionsListResult, error) 1700 mrlr MessagingRegionsListResult 1701} 1702 1703// NextWithContext advances to the next page of values. If there was an error making 1704// the request the page does not advance and the error is returned. 1705func (page *MessagingRegionsListResultPage) NextWithContext(ctx context.Context) (err error) { 1706 if tracing.IsEnabled() { 1707 ctx = tracing.StartSpan(ctx, fqdn+"/MessagingRegionsListResultPage.NextWithContext") 1708 defer func() { 1709 sc := -1 1710 if page.Response().Response.Response != nil { 1711 sc = page.Response().Response.Response.StatusCode 1712 } 1713 tracing.EndSpan(ctx, sc, err) 1714 }() 1715 } 1716 next, err := page.fn(ctx, page.mrlr) 1717 if err != nil { 1718 return err 1719 } 1720 page.mrlr = next 1721 return nil 1722} 1723 1724// Next advances to the next page of values. If there was an error making 1725// the request the page does not advance and the error is returned. 1726// Deprecated: Use NextWithContext() instead. 1727func (page *MessagingRegionsListResultPage) Next() error { 1728 return page.NextWithContext(context.Background()) 1729} 1730 1731// NotDone returns true if the page enumeration should be started or is not yet complete. 1732func (page MessagingRegionsListResultPage) NotDone() bool { 1733 return !page.mrlr.IsEmpty() 1734} 1735 1736// Response returns the raw server response from the last page request. 1737func (page MessagingRegionsListResultPage) Response() MessagingRegionsListResult { 1738 return page.mrlr 1739} 1740 1741// Values returns the slice of values for the current page or nil if there are no values. 1742func (page MessagingRegionsListResultPage) Values() []MessagingRegions { 1743 if page.mrlr.IsEmpty() { 1744 return nil 1745 } 1746 return *page.mrlr.Value 1747} 1748 1749// Creates a new instance of the MessagingRegionsListResultPage type. 1750func NewMessagingRegionsListResultPage(getNextPage func(context.Context, MessagingRegionsListResult) (MessagingRegionsListResult, error)) MessagingRegionsListResultPage { 1751 return MessagingRegionsListResultPage{fn: getNextPage} 1752} 1753 1754// MessagingRegionsProperties ... 1755type MessagingRegionsProperties struct { 1756 // Code - READ-ONLY; Region code 1757 Code *string `json:"code,omitempty"` 1758 // FullName - READ-ONLY; Full name of the region 1759 FullName *string `json:"fullName,omitempty"` 1760} 1761 1762// Model single item in List or Get Event Hub operation 1763type Model struct { 1764 autorest.Response `json:"-"` 1765 // Properties - Properties supplied to the Create Or Update Event Hub operation. 1766 *Properties `json:"properties,omitempty"` 1767 // ID - READ-ONLY; Resource Id 1768 ID *string `json:"id,omitempty"` 1769 // Name - READ-ONLY; Resource name 1770 Name *string `json:"name,omitempty"` 1771 // Type - READ-ONLY; Resource type 1772 Type *string `json:"type,omitempty"` 1773} 1774 1775// MarshalJSON is the custom marshaler for Model. 1776func (mVar Model) MarshalJSON() ([]byte, error) { 1777 objectMap := make(map[string]interface{}) 1778 if mVar.Properties != nil { 1779 objectMap["properties"] = mVar.Properties 1780 } 1781 return json.Marshal(objectMap) 1782} 1783 1784// UnmarshalJSON is the custom unmarshaler for Model struct. 1785func (mVar *Model) UnmarshalJSON(body []byte) error { 1786 var m map[string]*json.RawMessage 1787 err := json.Unmarshal(body, &m) 1788 if err != nil { 1789 return err 1790 } 1791 for k, v := range m { 1792 switch k { 1793 case "properties": 1794 if v != nil { 1795 var properties Properties 1796 err = json.Unmarshal(*v, &properties) 1797 if err != nil { 1798 return err 1799 } 1800 mVar.Properties = &properties 1801 } 1802 case "id": 1803 if v != nil { 1804 var ID string 1805 err = json.Unmarshal(*v, &ID) 1806 if err != nil { 1807 return err 1808 } 1809 mVar.ID = &ID 1810 } 1811 case "name": 1812 if v != nil { 1813 var name string 1814 err = json.Unmarshal(*v, &name) 1815 if err != nil { 1816 return err 1817 } 1818 mVar.Name = &name 1819 } 1820 case "type": 1821 if v != nil { 1822 var typeVar string 1823 err = json.Unmarshal(*v, &typeVar) 1824 if err != nil { 1825 return err 1826 } 1827 mVar.Type = &typeVar 1828 } 1829 } 1830 } 1831 1832 return nil 1833} 1834 1835// NamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1836// long-running operation. 1837type NamespacesCreateOrUpdateFuture struct { 1838 azure.Future 1839} 1840 1841// Result returns the result of the asynchronous operation. 1842// If the operation has not completed it will return an error. 1843func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (en EHNamespace, err error) { 1844 var done bool 1845 done, err = future.DoneWithContext(context.Background(), client) 1846 if err != nil { 1847 err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1848 return 1849 } 1850 if !done { 1851 err = azure.NewAsyncOpIncompleteError("eventhub.NamespacesCreateOrUpdateFuture") 1852 return 1853 } 1854 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1855 if en.Response.Response, err = future.GetResult(sender); err == nil && en.Response.Response.StatusCode != http.StatusNoContent { 1856 en, err = client.CreateOrUpdateResponder(en.Response.Response) 1857 if err != nil { 1858 err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", en.Response.Response, "Failure responding to request") 1859 } 1860 } 1861 return 1862} 1863 1864// NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1865// operation. 1866type NamespacesDeleteFuture struct { 1867 azure.Future 1868} 1869 1870// Result returns the result of the asynchronous operation. 1871// If the operation has not completed it will return an error. 1872func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { 1873 var done bool 1874 done, err = future.DoneWithContext(context.Background(), client) 1875 if err != nil { 1876 err = autorest.NewErrorWithError(err, "eventhub.NamespacesDeleteFuture", "Result", future.Response(), "Polling failure") 1877 return 1878 } 1879 if !done { 1880 err = azure.NewAsyncOpIncompleteError("eventhub.NamespacesDeleteFuture") 1881 return 1882 } 1883 ar.Response = future.Response() 1884 return 1885} 1886 1887// NetworkRuleSet description of NetworkRuleSet resource. 1888type NetworkRuleSet struct { 1889 autorest.Response `json:"-"` 1890 // NetworkRuleSetProperties - NetworkRuleSet properties 1891 *NetworkRuleSetProperties `json:"properties,omitempty"` 1892 // ID - READ-ONLY; Resource Id 1893 ID *string `json:"id,omitempty"` 1894 // Name - READ-ONLY; Resource name 1895 Name *string `json:"name,omitempty"` 1896 // Type - READ-ONLY; Resource type 1897 Type *string `json:"type,omitempty"` 1898} 1899 1900// MarshalJSON is the custom marshaler for NetworkRuleSet. 1901func (nrs NetworkRuleSet) MarshalJSON() ([]byte, error) { 1902 objectMap := make(map[string]interface{}) 1903 if nrs.NetworkRuleSetProperties != nil { 1904 objectMap["properties"] = nrs.NetworkRuleSetProperties 1905 } 1906 return json.Marshal(objectMap) 1907} 1908 1909// UnmarshalJSON is the custom unmarshaler for NetworkRuleSet struct. 1910func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { 1911 var m map[string]*json.RawMessage 1912 err := json.Unmarshal(body, &m) 1913 if err != nil { 1914 return err 1915 } 1916 for k, v := range m { 1917 switch k { 1918 case "properties": 1919 if v != nil { 1920 var networkRuleSetProperties NetworkRuleSetProperties 1921 err = json.Unmarshal(*v, &networkRuleSetProperties) 1922 if err != nil { 1923 return err 1924 } 1925 nrs.NetworkRuleSetProperties = &networkRuleSetProperties 1926 } 1927 case "id": 1928 if v != nil { 1929 var ID string 1930 err = json.Unmarshal(*v, &ID) 1931 if err != nil { 1932 return err 1933 } 1934 nrs.ID = &ID 1935 } 1936 case "name": 1937 if v != nil { 1938 var name string 1939 err = json.Unmarshal(*v, &name) 1940 if err != nil { 1941 return err 1942 } 1943 nrs.Name = &name 1944 } 1945 case "type": 1946 if v != nil { 1947 var typeVar string 1948 err = json.Unmarshal(*v, &typeVar) 1949 if err != nil { 1950 return err 1951 } 1952 nrs.Type = &typeVar 1953 } 1954 } 1955 } 1956 1957 return nil 1958} 1959 1960// NetworkRuleSetProperties networkRuleSet properties 1961type NetworkRuleSetProperties struct { 1962 // DefaultAction - Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' 1963 DefaultAction DefaultAction `json:"defaultAction,omitempty"` 1964 // VirtualNetworkRules - List VirtualNetwork Rules 1965 VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` 1966 // IPRules - List of IpRules 1967 IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"` 1968} 1969 1970// NWRuleSetIPRules description of NetWorkRuleSet - IpRules resource. 1971type NWRuleSetIPRules struct { 1972 // IPMask - IP Mask 1973 IPMask *string `json:"ipMask,omitempty"` 1974 // Action - The IP Filter Action. Possible values include: 'NetworkRuleIPActionAllow' 1975 Action NetworkRuleIPAction `json:"action,omitempty"` 1976} 1977 1978// NWRuleSetVirtualNetworkRules description of VirtualNetworkRules - NetworkRules resource. 1979type NWRuleSetVirtualNetworkRules struct { 1980 // Subnet - Subnet properties 1981 Subnet *Subnet `json:"subnet,omitempty"` 1982 // IgnoreMissingVnetServiceEndpoint - Value that indicates whether to ignore missing VNet Service Endpoint 1983 IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` 1984} 1985 1986// Operation a Event Hub REST API operation 1987type Operation struct { 1988 // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} 1989 Name *string `json:"name,omitempty"` 1990 // Display - The object that represents the operation. 1991 Display *OperationDisplay `json:"display,omitempty"` 1992} 1993 1994// OperationDisplay the object that represents the operation. 1995type OperationDisplay struct { 1996 // Provider - READ-ONLY; Service provider: Microsoft.EventHub 1997 Provider *string `json:"provider,omitempty"` 1998 // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. 1999 Resource *string `json:"resource,omitempty"` 2000 // Operation - READ-ONLY; Operation type: Read, write, delete, etc. 2001 Operation *string `json:"operation,omitempty"` 2002} 2003 2004// OperationListResult result of the request to list Event Hub operations. It contains a list of operations 2005// and a URL link to get the next set of results. 2006type OperationListResult struct { 2007 autorest.Response `json:"-"` 2008 // Value - READ-ONLY; List of Event Hub operations supported by the Microsoft.EventHub resource provider. 2009 Value *[]Operation `json:"value,omitempty"` 2010 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 2011 NextLink *string `json:"nextLink,omitempty"` 2012} 2013 2014// OperationListResultIterator provides access to a complete listing of Operation values. 2015type OperationListResultIterator struct { 2016 i int 2017 page OperationListResultPage 2018} 2019 2020// NextWithContext advances to the next value. If there was an error making 2021// the request the iterator does not advance and the error is returned. 2022func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2023 if tracing.IsEnabled() { 2024 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 2025 defer func() { 2026 sc := -1 2027 if iter.Response().Response.Response != nil { 2028 sc = iter.Response().Response.Response.StatusCode 2029 } 2030 tracing.EndSpan(ctx, sc, err) 2031 }() 2032 } 2033 iter.i++ 2034 if iter.i < len(iter.page.Values()) { 2035 return nil 2036 } 2037 err = iter.page.NextWithContext(ctx) 2038 if err != nil { 2039 iter.i-- 2040 return err 2041 } 2042 iter.i = 0 2043 return nil 2044} 2045 2046// Next advances to the next value. If there was an error making 2047// the request the iterator does not advance and the error is returned. 2048// Deprecated: Use NextWithContext() instead. 2049func (iter *OperationListResultIterator) Next() error { 2050 return iter.NextWithContext(context.Background()) 2051} 2052 2053// NotDone returns true if the enumeration should be started or is not yet complete. 2054func (iter OperationListResultIterator) NotDone() bool { 2055 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2056} 2057 2058// Response returns the raw server response from the last page request. 2059func (iter OperationListResultIterator) Response() OperationListResult { 2060 return iter.page.Response() 2061} 2062 2063// Value returns the current value or a zero-initialized value if the 2064// iterator has advanced beyond the end of the collection. 2065func (iter OperationListResultIterator) Value() Operation { 2066 if !iter.page.NotDone() { 2067 return Operation{} 2068 } 2069 return iter.page.Values()[iter.i] 2070} 2071 2072// Creates a new instance of the OperationListResultIterator type. 2073func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 2074 return OperationListResultIterator{page: page} 2075} 2076 2077// IsEmpty returns true if the ListResult contains no values. 2078func (olr OperationListResult) IsEmpty() bool { 2079 return olr.Value == nil || len(*olr.Value) == 0 2080} 2081 2082// operationListResultPreparer prepares a request to retrieve the next set of results. 2083// It returns nil if no more results exist. 2084func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 2085 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 2086 return nil, nil 2087 } 2088 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2089 autorest.AsJSON(), 2090 autorest.AsGet(), 2091 autorest.WithBaseURL(to.String(olr.NextLink))) 2092} 2093 2094// OperationListResultPage contains a page of Operation values. 2095type OperationListResultPage struct { 2096 fn func(context.Context, OperationListResult) (OperationListResult, error) 2097 olr OperationListResult 2098} 2099 2100// NextWithContext advances to the next page of values. If there was an error making 2101// the request the page does not advance and the error is returned. 2102func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2103 if tracing.IsEnabled() { 2104 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 2105 defer func() { 2106 sc := -1 2107 if page.Response().Response.Response != nil { 2108 sc = page.Response().Response.Response.StatusCode 2109 } 2110 tracing.EndSpan(ctx, sc, err) 2111 }() 2112 } 2113 next, err := page.fn(ctx, page.olr) 2114 if err != nil { 2115 return err 2116 } 2117 page.olr = next 2118 return nil 2119} 2120 2121// Next advances to the next page of values. If there was an error making 2122// the request the page does not advance and the error is returned. 2123// Deprecated: Use NextWithContext() instead. 2124func (page *OperationListResultPage) Next() error { 2125 return page.NextWithContext(context.Background()) 2126} 2127 2128// NotDone returns true if the page enumeration should be started or is not yet complete. 2129func (page OperationListResultPage) NotDone() bool { 2130 return !page.olr.IsEmpty() 2131} 2132 2133// Response returns the raw server response from the last page request. 2134func (page OperationListResultPage) Response() OperationListResult { 2135 return page.olr 2136} 2137 2138// Values returns the slice of values for the current page or nil if there are no values. 2139func (page OperationListResultPage) Values() []Operation { 2140 if page.olr.IsEmpty() { 2141 return nil 2142 } 2143 return *page.olr.Value 2144} 2145 2146// Creates a new instance of the OperationListResultPage type. 2147func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2148 return OperationListResultPage{fn: getNextPage} 2149} 2150 2151// Properties properties supplied to the Create Or Update Event Hub operation. 2152type Properties struct { 2153 // PartitionIds - READ-ONLY; Current number of shards on the Event Hub. 2154 PartitionIds *[]string `json:"partitionIds,omitempty"` 2155 // CreatedAt - READ-ONLY; Exact time the Event Hub was created. 2156 CreatedAt *date.Time `json:"createdAt,omitempty"` 2157 // UpdatedAt - READ-ONLY; The exact time the message was updated. 2158 UpdatedAt *date.Time `json:"updatedAt,omitempty"` 2159 // MessageRetentionInDays - Number of days to retain the events for this Event Hub, value should be 1 to 7 days 2160 MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` 2161 // PartitionCount - Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. 2162 PartitionCount *int64 `json:"partitionCount,omitempty"` 2163 // Status - Enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' 2164 Status EntityStatus `json:"status,omitempty"` 2165 // CaptureDescription - Properties of capture description 2166 CaptureDescription *CaptureDescription `json:"captureDescription,omitempty"` 2167} 2168 2169// RegenerateAccessKeyParameters parameters supplied to the Regenerate Authorization Rule operation, 2170// specifies which key needs to be reset. 2171type RegenerateAccessKeyParameters struct { 2172 // KeyType - The access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey' 2173 KeyType KeyType `json:"keyType,omitempty"` 2174 // Key - Optional, if the key value provided, is set for KeyType or autogenerated Key value set for keyType 2175 Key *string `json:"key,omitempty"` 2176} 2177 2178// Resource the Resource definition 2179type Resource struct { 2180 // ID - READ-ONLY; Resource Id 2181 ID *string `json:"id,omitempty"` 2182 // Name - READ-ONLY; Resource name 2183 Name *string `json:"name,omitempty"` 2184 // Type - READ-ONLY; Resource type 2185 Type *string `json:"type,omitempty"` 2186} 2187 2188// Sku SKU parameters supplied to the create namespace operation 2189type Sku struct { 2190 // Name - Name of this SKU. Possible values include: 'Basic', 'Standard' 2191 Name SkuName `json:"name,omitempty"` 2192 // Tier - The billing tier of this particular SKU. Possible values include: 'SkuTierBasic', 'SkuTierStandard' 2193 Tier SkuTier `json:"tier,omitempty"` 2194 // Capacity - The Event Hubs throughput units, value should be 0 to 20 throughput units. 2195 Capacity *int32 `json:"capacity,omitempty"` 2196} 2197 2198// Subnet properties supplied for Subnet 2199type Subnet struct { 2200 // ID - Resource ID of Virtual Network Subnet 2201 ID *string `json:"id,omitempty"` 2202} 2203 2204// TrackedResource definition of Resource 2205type TrackedResource struct { 2206 // Location - Resource location 2207 Location *string `json:"location,omitempty"` 2208 // Tags - Resource tags 2209 Tags map[string]*string `json:"tags"` 2210 // ID - READ-ONLY; Resource Id 2211 ID *string `json:"id,omitempty"` 2212 // Name - READ-ONLY; Resource name 2213 Name *string `json:"name,omitempty"` 2214 // Type - READ-ONLY; Resource type 2215 Type *string `json:"type,omitempty"` 2216} 2217 2218// MarshalJSON is the custom marshaler for TrackedResource. 2219func (tr TrackedResource) MarshalJSON() ([]byte, error) { 2220 objectMap := make(map[string]interface{}) 2221 if tr.Location != nil { 2222 objectMap["location"] = tr.Location 2223 } 2224 if tr.Tags != nil { 2225 objectMap["tags"] = tr.Tags 2226 } 2227 return json.Marshal(objectMap) 2228} 2229