1package peering 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/to" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// The package's fully qualified name. 30const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/peering/mgmt/2019-08-01-preview/peering" 31 32// ConnectionState enumerates the values for connection state. 33type ConnectionState string 34 35const ( 36 // Active ... 37 Active ConnectionState = "Active" 38 // Approved ... 39 Approved ConnectionState = "Approved" 40 // None ... 41 None ConnectionState = "None" 42 // PendingApproval ... 43 PendingApproval ConnectionState = "PendingApproval" 44 // ProvisioningCompleted ... 45 ProvisioningCompleted ConnectionState = "ProvisioningCompleted" 46 // ProvisioningFailed ... 47 ProvisioningFailed ConnectionState = "ProvisioningFailed" 48 // ProvisioningStarted ... 49 ProvisioningStarted ConnectionState = "ProvisioningStarted" 50 // Validating ... 51 Validating ConnectionState = "Validating" 52) 53 54// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. 55func PossibleConnectionStateValues() []ConnectionState { 56 return []ConnectionState{Active, Approved, None, PendingApproval, ProvisioningCompleted, ProvisioningFailed, ProvisioningStarted, Validating} 57} 58 59// DirectPeeringType enumerates the values for direct peering type. 60type DirectPeeringType string 61 62const ( 63 // Cdn ... 64 Cdn DirectPeeringType = "Cdn" 65 // Edge ... 66 Edge DirectPeeringType = "Edge" 67 // Internal ... 68 Internal DirectPeeringType = "Internal" 69 // Transit ... 70 Transit DirectPeeringType = "Transit" 71) 72 73// PossibleDirectPeeringTypeValues returns an array of possible values for the DirectPeeringType const type. 74func PossibleDirectPeeringTypeValues() []DirectPeeringType { 75 return []DirectPeeringType{Cdn, Edge, Internal, Transit} 76} 77 78// Family enumerates the values for family. 79type Family string 80 81const ( 82 // Direct ... 83 Direct Family = "Direct" 84 // Exchange ... 85 Exchange Family = "Exchange" 86) 87 88// PossibleFamilyValues returns an array of possible values for the Family const type. 89func PossibleFamilyValues() []Family { 90 return []Family{Direct, Exchange} 91} 92 93// Kind enumerates the values for kind. 94type Kind string 95 96const ( 97 // KindDirect ... 98 KindDirect Kind = "Direct" 99 // KindExchange ... 100 KindExchange Kind = "Exchange" 101) 102 103// PossibleKindValues returns an array of possible values for the Kind const type. 104func PossibleKindValues() []Kind { 105 return []Kind{KindDirect, KindExchange} 106} 107 108// LearnedType enumerates the values for learned type. 109type LearnedType string 110 111const ( 112 // LearnedTypeNone ... 113 LearnedTypeNone LearnedType = "None" 114 // LearnedTypeViaPartner ... 115 LearnedTypeViaPartner LearnedType = "ViaPartner" 116 // LearnedTypeViaSession ... 117 LearnedTypeViaSession LearnedType = "ViaSession" 118) 119 120// PossibleLearnedTypeValues returns an array of possible values for the LearnedType const type. 121func PossibleLearnedTypeValues() []LearnedType { 122 return []LearnedType{LearnedTypeNone, LearnedTypeViaPartner, LearnedTypeViaSession} 123} 124 125// Name enumerates the values for name. 126type Name string 127 128const ( 129 // BasicDirectFree ... 130 BasicDirectFree Name = "Basic_Direct_Free" 131 // BasicExchangeFree ... 132 BasicExchangeFree Name = "Basic_Exchange_Free" 133 // PremiumDirectFree ... 134 PremiumDirectFree Name = "Premium_Direct_Free" 135 // PremiumDirectMetered ... 136 PremiumDirectMetered Name = "Premium_Direct_Metered" 137 // PremiumDirectUnlimited ... 138 PremiumDirectUnlimited Name = "Premium_Direct_Unlimited" 139 // PremiumExchangeMetered ... 140 PremiumExchangeMetered Name = "Premium_Exchange_Metered" 141) 142 143// PossibleNameValues returns an array of possible values for the Name const type. 144func PossibleNameValues() []Name { 145 return []Name{BasicDirectFree, BasicExchangeFree, PremiumDirectFree, PremiumDirectMetered, PremiumDirectUnlimited, PremiumExchangeMetered} 146} 147 148// PrefixValidationState enumerates the values for prefix validation state. 149type PrefixValidationState string 150 151const ( 152 // PrefixValidationStateFailed ... 153 PrefixValidationStateFailed PrefixValidationState = "Failed" 154 // PrefixValidationStateInvalid ... 155 PrefixValidationStateInvalid PrefixValidationState = "Invalid" 156 // PrefixValidationStateNone ... 157 PrefixValidationStateNone PrefixValidationState = "None" 158 // PrefixValidationStatePending ... 159 PrefixValidationStatePending PrefixValidationState = "Pending" 160 // PrefixValidationStateUnknown ... 161 PrefixValidationStateUnknown PrefixValidationState = "Unknown" 162 // PrefixValidationStateVerified ... 163 PrefixValidationStateVerified PrefixValidationState = "Verified" 164) 165 166// PossiblePrefixValidationStateValues returns an array of possible values for the PrefixValidationState const type. 167func PossiblePrefixValidationStateValues() []PrefixValidationState { 168 return []PrefixValidationState{PrefixValidationStateFailed, PrefixValidationStateInvalid, PrefixValidationStateNone, PrefixValidationStatePending, PrefixValidationStateUnknown, PrefixValidationStateVerified} 169} 170 171// ProvisioningState enumerates the values for provisioning state. 172type ProvisioningState string 173 174const ( 175 // Deleting ... 176 Deleting ProvisioningState = "Deleting" 177 // Failed ... 178 Failed ProvisioningState = "Failed" 179 // Succeeded ... 180 Succeeded ProvisioningState = "Succeeded" 181 // Updating ... 182 Updating ProvisioningState = "Updating" 183) 184 185// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 186func PossibleProvisioningStateValues() []ProvisioningState { 187 return []ProvisioningState{Deleting, Failed, Succeeded, Updating} 188} 189 190// SessionAddressProvider enumerates the values for session address provider. 191type SessionAddressProvider string 192 193const ( 194 // Microsoft ... 195 Microsoft SessionAddressProvider = "Microsoft" 196 // Peer ... 197 Peer SessionAddressProvider = "Peer" 198) 199 200// PossibleSessionAddressProviderValues returns an array of possible values for the SessionAddressProvider const type. 201func PossibleSessionAddressProviderValues() []SessionAddressProvider { 202 return []SessionAddressProvider{Microsoft, Peer} 203} 204 205// SessionStateV4 enumerates the values for session state v4. 206type SessionStateV4 string 207 208const ( 209 // SessionStateV4Active ... 210 SessionStateV4Active SessionStateV4 = "Active" 211 // SessionStateV4Connect ... 212 SessionStateV4Connect SessionStateV4 = "Connect" 213 // SessionStateV4Established ... 214 SessionStateV4Established SessionStateV4 = "Established" 215 // SessionStateV4Idle ... 216 SessionStateV4Idle SessionStateV4 = "Idle" 217 // SessionStateV4None ... 218 SessionStateV4None SessionStateV4 = "None" 219 // SessionStateV4OpenConfirm ... 220 SessionStateV4OpenConfirm SessionStateV4 = "OpenConfirm" 221 // SessionStateV4OpenReceived ... 222 SessionStateV4OpenReceived SessionStateV4 = "OpenReceived" 223 // SessionStateV4OpenSent ... 224 SessionStateV4OpenSent SessionStateV4 = "OpenSent" 225 // SessionStateV4PendingAdd ... 226 SessionStateV4PendingAdd SessionStateV4 = "PendingAdd" 227 // SessionStateV4PendingRemove ... 228 SessionStateV4PendingRemove SessionStateV4 = "PendingRemove" 229 // SessionStateV4PendingUpdate ... 230 SessionStateV4PendingUpdate SessionStateV4 = "PendingUpdate" 231) 232 233// PossibleSessionStateV4Values returns an array of possible values for the SessionStateV4 const type. 234func PossibleSessionStateV4Values() []SessionStateV4 { 235 return []SessionStateV4{SessionStateV4Active, SessionStateV4Connect, SessionStateV4Established, SessionStateV4Idle, SessionStateV4None, SessionStateV4OpenConfirm, SessionStateV4OpenReceived, SessionStateV4OpenSent, SessionStateV4PendingAdd, SessionStateV4PendingRemove, SessionStateV4PendingUpdate} 236} 237 238// SessionStateV6 enumerates the values for session state v6. 239type SessionStateV6 string 240 241const ( 242 // SessionStateV6Active ... 243 SessionStateV6Active SessionStateV6 = "Active" 244 // SessionStateV6Connect ... 245 SessionStateV6Connect SessionStateV6 = "Connect" 246 // SessionStateV6Established ... 247 SessionStateV6Established SessionStateV6 = "Established" 248 // SessionStateV6Idle ... 249 SessionStateV6Idle SessionStateV6 = "Idle" 250 // SessionStateV6None ... 251 SessionStateV6None SessionStateV6 = "None" 252 // SessionStateV6OpenConfirm ... 253 SessionStateV6OpenConfirm SessionStateV6 = "OpenConfirm" 254 // SessionStateV6OpenReceived ... 255 SessionStateV6OpenReceived SessionStateV6 = "OpenReceived" 256 // SessionStateV6OpenSent ... 257 SessionStateV6OpenSent SessionStateV6 = "OpenSent" 258 // SessionStateV6PendingAdd ... 259 SessionStateV6PendingAdd SessionStateV6 = "PendingAdd" 260 // SessionStateV6PendingRemove ... 261 SessionStateV6PendingRemove SessionStateV6 = "PendingRemove" 262 // SessionStateV6PendingUpdate ... 263 SessionStateV6PendingUpdate SessionStateV6 = "PendingUpdate" 264) 265 266// PossibleSessionStateV6Values returns an array of possible values for the SessionStateV6 const type. 267func PossibleSessionStateV6Values() []SessionStateV6 { 268 return []SessionStateV6{SessionStateV6Active, SessionStateV6Connect, SessionStateV6Established, SessionStateV6Idle, SessionStateV6None, SessionStateV6OpenConfirm, SessionStateV6OpenReceived, SessionStateV6OpenSent, SessionStateV6PendingAdd, SessionStateV6PendingRemove, SessionStateV6PendingUpdate} 269} 270 271// Size enumerates the values for size. 272type Size string 273 274const ( 275 // Free ... 276 Free Size = "Free" 277 // Metered ... 278 Metered Size = "Metered" 279 // Unlimited ... 280 Unlimited Size = "Unlimited" 281) 282 283// PossibleSizeValues returns an array of possible values for the Size const type. 284func PossibleSizeValues() []Size { 285 return []Size{Free, Metered, Unlimited} 286} 287 288// Tier enumerates the values for tier. 289type Tier string 290 291const ( 292 // Basic ... 293 Basic Tier = "Basic" 294 // Premium ... 295 Premium Tier = "Premium" 296) 297 298// PossibleTierValues returns an array of possible values for the Tier const type. 299func PossibleTierValues() []Tier { 300 return []Tier{Basic, Premium} 301} 302 303// ValidationState enumerates the values for validation state. 304type ValidationState string 305 306const ( 307 // ValidationStateApproved ... 308 ValidationStateApproved ValidationState = "Approved" 309 // ValidationStateFailed ... 310 ValidationStateFailed ValidationState = "Failed" 311 // ValidationStateNone ... 312 ValidationStateNone ValidationState = "None" 313 // ValidationStatePending ... 314 ValidationStatePending ValidationState = "Pending" 315) 316 317// PossibleValidationStateValues returns an array of possible values for the ValidationState const type. 318func PossibleValidationStateValues() []ValidationState { 319 return []ValidationState{ValidationStateApproved, ValidationStateFailed, ValidationStateNone, ValidationStatePending} 320} 321 322// BandwidthOffer the properties that define a peering bandwidth offer. 323type BandwidthOffer struct { 324 // OfferName - The name of the bandwidth offer. 325 OfferName *string `json:"offerName,omitempty"` 326 // ValueInMbps - The value of the bandwidth offer in Mbps. 327 ValueInMbps *int32 `json:"valueInMbps,omitempty"` 328} 329 330// BgpSession the properties that define a BGP session. 331type BgpSession struct { 332 // SessionPrefixV4 - The IPv4 prefix that contains both ends' IPv4 addresses. 333 SessionPrefixV4 *string `json:"sessionPrefixV4,omitempty"` 334 // SessionPrefixV6 - The IPv6 prefix that contains both ends' IPv6 addresses. 335 SessionPrefixV6 *string `json:"sessionPrefixV6,omitempty"` 336 // MicrosoftSessionIPv4Address - READ-ONLY; The IPv4 session address on Microsoft's end. 337 MicrosoftSessionIPv4Address *string `json:"microsoftSessionIPv4Address,omitempty"` 338 // MicrosoftSessionIPv6Address - READ-ONLY; The IPv6 session address on Microsoft's end. 339 MicrosoftSessionIPv6Address *string `json:"microsoftSessionIPv6Address,omitempty"` 340 // PeerSessionIPv4Address - The IPv4 session address on peer's end. 341 PeerSessionIPv4Address *string `json:"peerSessionIPv4Address,omitempty"` 342 // PeerSessionIPv6Address - The IPv6 session address on peer's end. 343 PeerSessionIPv6Address *string `json:"peerSessionIPv6Address,omitempty"` 344 // SessionStateV4 - READ-ONLY; The state of the IPv4 session. Possible values include: 'SessionStateV4None', 'SessionStateV4Idle', 'SessionStateV4Connect', 'SessionStateV4Active', 'SessionStateV4OpenSent', 'SessionStateV4OpenConfirm', 'SessionStateV4OpenReceived', 'SessionStateV4Established', 'SessionStateV4PendingAdd', 'SessionStateV4PendingUpdate', 'SessionStateV4PendingRemove' 345 SessionStateV4 SessionStateV4 `json:"sessionStateV4,omitempty"` 346 // SessionStateV6 - READ-ONLY; The state of the IPv6 session. Possible values include: 'SessionStateV6None', 'SessionStateV6Idle', 'SessionStateV6Connect', 'SessionStateV6Active', 'SessionStateV6OpenSent', 'SessionStateV6OpenConfirm', 'SessionStateV6OpenReceived', 'SessionStateV6Established', 'SessionStateV6PendingAdd', 'SessionStateV6PendingUpdate', 'SessionStateV6PendingRemove' 347 SessionStateV6 SessionStateV6 `json:"sessionStateV6,omitempty"` 348 // MaxPrefixesAdvertisedV4 - The maximum number of prefixes advertised over the IPv4 session. 349 MaxPrefixesAdvertisedV4 *int32 `json:"maxPrefixesAdvertisedV4,omitempty"` 350 // MaxPrefixesAdvertisedV6 - The maximum number of prefixes advertised over the IPv6 session. 351 MaxPrefixesAdvertisedV6 *int32 `json:"maxPrefixesAdvertisedV6,omitempty"` 352 // Md5AuthenticationKey - The MD5 authentication key of the session. 353 Md5AuthenticationKey *string `json:"md5AuthenticationKey,omitempty"` 354} 355 356// CheckServiceProviderAvailabilityInput class for CheckServiceProviderAvailabilityInput 357type CheckServiceProviderAvailabilityInput struct { 358 // PeeringServiceLocation - Gets or sets the PeeringServiceLocation 359 PeeringServiceLocation *string `json:"peeringServiceLocation,omitempty"` 360 // PeeringServiceProvider - Gets or sets the PeeringServiceProvider 361 PeeringServiceProvider *string `json:"peeringServiceProvider,omitempty"` 362} 363 364// ContactInfo the contact information of the peer. 365type ContactInfo struct { 366 // Emails - The list of email addresses. 367 Emails *[]string `json:"emails,omitempty"` 368 // Phone - The list of contact numbers. 369 Phone *[]string `json:"phone,omitempty"` 370} 371 372// DirectConnection the properties that define a direct connection. 373type DirectConnection struct { 374 // BandwidthInMbps - The bandwidth of the connection. 375 BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` 376 // ProvisionedBandwidthInMbps - The bandwidth that is actually provisioned. 377 ProvisionedBandwidthInMbps *int32 `json:"provisionedBandwidthInMbps,omitempty"` 378 // SessionAddressProvider - The field indicating if Microsoft provides session ip addresses. Possible values include: 'Microsoft', 'Peer' 379 SessionAddressProvider SessionAddressProvider `json:"sessionAddressProvider,omitempty"` 380 // UseForPeeringService - The flag that indicates whether or not the connection is used for peering service. 381 UseForPeeringService *bool `json:"useForPeeringService,omitempty"` 382 // PeeringDBFacilityID - The PeeringDB.com ID of the facility at which the connection has to be set up. 383 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 384 // ConnectionState - READ-ONLY; The state of the connection. Possible values include: 'None', 'PendingApproval', 'Approved', 'ProvisioningStarted', 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active' 385 ConnectionState ConnectionState `json:"connectionState,omitempty"` 386 // BgpSession - The BGP session associated with the connection. 387 BgpSession *BgpSession `json:"bgpSession,omitempty"` 388 // ConnectionIdentifier - The unique identifier (GUID) for the connection. 389 ConnectionIdentifier *string `json:"connectionIdentifier,omitempty"` 390} 391 392// DirectPeeringFacility the properties that define a direct peering facility. 393type DirectPeeringFacility struct { 394 // Address - The address of the direct peering facility. 395 Address *string `json:"address,omitempty"` 396 // DirectPeeringType - The type of the direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal' 397 DirectPeeringType DirectPeeringType `json:"directPeeringType,omitempty"` 398 // PeeringDBFacilityID - The PeeringDB.com ID of the facility. 399 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 400 // PeeringDBFacilityLink - The PeeringDB.com URL of the facility. 401 PeeringDBFacilityLink *string `json:"peeringDBFacilityLink,omitempty"` 402} 403 404// ErrorResponse the error response that indicates why an operation has failed. 405type ErrorResponse struct { 406 // Code - READ-ONLY; The error code. 407 Code *string `json:"code,omitempty"` 408 // Message - READ-ONLY; The error message. 409 Message *string `json:"message,omitempty"` 410} 411 412// ExchangeConnection the properties that define an exchange connection. 413type ExchangeConnection struct { 414 // PeeringDBFacilityID - The PeeringDB.com ID of the facility at which the connection has to be set up. 415 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 416 // ConnectionState - READ-ONLY; The state of the connection. Possible values include: 'None', 'PendingApproval', 'Approved', 'ProvisioningStarted', 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active' 417 ConnectionState ConnectionState `json:"connectionState,omitempty"` 418 // BgpSession - The BGP session associated with the connection. 419 BgpSession *BgpSession `json:"bgpSession,omitempty"` 420 // ConnectionIdentifier - The unique identifier (GUID) for the connection. 421 ConnectionIdentifier *string `json:"connectionIdentifier,omitempty"` 422} 423 424// ExchangePeeringFacility the properties that define an exchange peering facility. 425type ExchangePeeringFacility struct { 426 // ExchangeName - The name of the exchange peering facility. 427 ExchangeName *string `json:"exchangeName,omitempty"` 428 // BandwidthInMbps - The bandwidth of the connection between Microsoft and the exchange peering facility. 429 BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` 430 // MicrosoftIPv4Address - The IPv4 address of Microsoft at the exchange peering facility. 431 MicrosoftIPv4Address *string `json:"microsoftIPv4Address,omitempty"` 432 // MicrosoftIPv6Address - The IPv6 address of Microsoft at the exchange peering facility. 433 MicrosoftIPv6Address *string `json:"microsoftIPv6Address,omitempty"` 434 // FacilityIPv4Prefix - The IPv4 prefixes associated with the exchange peering facility. 435 FacilityIPv4Prefix *string `json:"facilityIPv4Prefix,omitempty"` 436 // FacilityIPv6Prefix - The IPv6 prefixes associated with the exchange peering facility. 437 FacilityIPv6Prefix *string `json:"facilityIPv6Prefix,omitempty"` 438 // PeeringDBFacilityID - The PeeringDB.com ID of the facility. 439 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 440 // PeeringDBFacilityLink - The PeeringDB.com URL of the facility. 441 PeeringDBFacilityLink *string `json:"peeringDBFacilityLink,omitempty"` 442} 443 444// ListResult the paginated list of peerings. 445type ListResult struct { 446 autorest.Response `json:"-"` 447 // Value - The list of peerings. 448 Value *[]Model `json:"value,omitempty"` 449 // NextLink - The link to fetch the next page of peerings. 450 NextLink *string `json:"nextLink,omitempty"` 451} 452 453// ListResultIterator provides access to a complete listing of Model values. 454type ListResultIterator struct { 455 i int 456 page ListResultPage 457} 458 459// NextWithContext advances to the next value. If there was an error making 460// the request the iterator does not advance and the error is returned. 461func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 462 if tracing.IsEnabled() { 463 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 464 defer func() { 465 sc := -1 466 if iter.Response().Response.Response != nil { 467 sc = iter.Response().Response.Response.StatusCode 468 } 469 tracing.EndSpan(ctx, sc, err) 470 }() 471 } 472 iter.i++ 473 if iter.i < len(iter.page.Values()) { 474 return nil 475 } 476 err = iter.page.NextWithContext(ctx) 477 if err != nil { 478 iter.i-- 479 return err 480 } 481 iter.i = 0 482 return nil 483} 484 485// Next advances to the next value. If there was an error making 486// the request the iterator does not advance and the error is returned. 487// Deprecated: Use NextWithContext() instead. 488func (iter *ListResultIterator) Next() error { 489 return iter.NextWithContext(context.Background()) 490} 491 492// NotDone returns true if the enumeration should be started or is not yet complete. 493func (iter ListResultIterator) NotDone() bool { 494 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 495} 496 497// Response returns the raw server response from the last page request. 498func (iter ListResultIterator) Response() ListResult { 499 return iter.page.Response() 500} 501 502// Value returns the current value or a zero-initialized value if the 503// iterator has advanced beyond the end of the collection. 504func (iter ListResultIterator) Value() Model { 505 if !iter.page.NotDone() { 506 return Model{} 507 } 508 return iter.page.Values()[iter.i] 509} 510 511// Creates a new instance of the ListResultIterator type. 512func NewListResultIterator(page ListResultPage) ListResultIterator { 513 return ListResultIterator{page: page} 514} 515 516// IsEmpty returns true if the ListResult contains no values. 517func (lr ListResult) IsEmpty() bool { 518 return lr.Value == nil || len(*lr.Value) == 0 519} 520 521// listResultPreparer prepares a request to retrieve the next set of results. 522// It returns nil if no more results exist. 523func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 524 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 525 return nil, nil 526 } 527 return autorest.Prepare((&http.Request{}).WithContext(ctx), 528 autorest.AsJSON(), 529 autorest.AsGet(), 530 autorest.WithBaseURL(to.String(lr.NextLink))) 531} 532 533// ListResultPage contains a page of Model values. 534type ListResultPage struct { 535 fn func(context.Context, ListResult) (ListResult, error) 536 lr ListResult 537} 538 539// NextWithContext advances to the next page of values. If there was an error making 540// the request the page does not advance and the error is returned. 541func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 542 if tracing.IsEnabled() { 543 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 544 defer func() { 545 sc := -1 546 if page.Response().Response.Response != nil { 547 sc = page.Response().Response.Response.StatusCode 548 } 549 tracing.EndSpan(ctx, sc, err) 550 }() 551 } 552 next, err := page.fn(ctx, page.lr) 553 if err != nil { 554 return err 555 } 556 page.lr = next 557 return nil 558} 559 560// Next advances to the next page of values. If there was an error making 561// the request the page does not advance and the error is returned. 562// Deprecated: Use NextWithContext() instead. 563func (page *ListResultPage) Next() error { 564 return page.NextWithContext(context.Background()) 565} 566 567// NotDone returns true if the page enumeration should be started or is not yet complete. 568func (page ListResultPage) NotDone() bool { 569 return !page.lr.IsEmpty() 570} 571 572// Response returns the raw server response from the last page request. 573func (page ListResultPage) Response() ListResult { 574 return page.lr 575} 576 577// Values returns the slice of values for the current page or nil if there are no values. 578func (page ListResultPage) Values() []Model { 579 if page.lr.IsEmpty() { 580 return nil 581 } 582 return *page.lr.Value 583} 584 585// Creates a new instance of the ListResultPage type. 586func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 587 return ListResultPage{fn: getNextPage} 588} 589 590// Location peering location is where connectivity could be established to the Microsoft Cloud Edge. 591type Location struct { 592 // Kind - The kind of peering that the peering location supports. Possible values include: 'KindDirect', 'KindExchange' 593 Kind Kind `json:"kind,omitempty"` 594 // LocationProperties - The properties that define a peering location. 595 *LocationProperties `json:"properties,omitempty"` 596 // Name - READ-ONLY; The name of the resource. 597 Name *string `json:"name,omitempty"` 598 // ID - READ-ONLY; The ID of the resource. 599 ID *string `json:"id,omitempty"` 600 // Type - READ-ONLY; The type of the resource. 601 Type *string `json:"type,omitempty"` 602} 603 604// MarshalJSON is the custom marshaler for Location. 605func (l Location) MarshalJSON() ([]byte, error) { 606 objectMap := make(map[string]interface{}) 607 if l.Kind != "" { 608 objectMap["kind"] = l.Kind 609 } 610 if l.LocationProperties != nil { 611 objectMap["properties"] = l.LocationProperties 612 } 613 return json.Marshal(objectMap) 614} 615 616// UnmarshalJSON is the custom unmarshaler for Location struct. 617func (l *Location) UnmarshalJSON(body []byte) error { 618 var m map[string]*json.RawMessage 619 err := json.Unmarshal(body, &m) 620 if err != nil { 621 return err 622 } 623 for k, v := range m { 624 switch k { 625 case "kind": 626 if v != nil { 627 var kind Kind 628 err = json.Unmarshal(*v, &kind) 629 if err != nil { 630 return err 631 } 632 l.Kind = kind 633 } 634 case "properties": 635 if v != nil { 636 var locationProperties LocationProperties 637 err = json.Unmarshal(*v, &locationProperties) 638 if err != nil { 639 return err 640 } 641 l.LocationProperties = &locationProperties 642 } 643 case "name": 644 if v != nil { 645 var name string 646 err = json.Unmarshal(*v, &name) 647 if err != nil { 648 return err 649 } 650 l.Name = &name 651 } 652 case "id": 653 if v != nil { 654 var ID string 655 err = json.Unmarshal(*v, &ID) 656 if err != nil { 657 return err 658 } 659 l.ID = &ID 660 } 661 case "type": 662 if v != nil { 663 var typeVar string 664 err = json.Unmarshal(*v, &typeVar) 665 if err != nil { 666 return err 667 } 668 l.Type = &typeVar 669 } 670 } 671 } 672 673 return nil 674} 675 676// LocationListResult the paginated list of peering locations. 677type LocationListResult struct { 678 autorest.Response `json:"-"` 679 // Value - The list of peering locations. 680 Value *[]Location `json:"value,omitempty"` 681 // NextLink - The link to fetch the next page of peering locations. 682 NextLink *string `json:"nextLink,omitempty"` 683} 684 685// LocationListResultIterator provides access to a complete listing of Location values. 686type LocationListResultIterator struct { 687 i int 688 page LocationListResultPage 689} 690 691// NextWithContext advances to the next value. If there was an error making 692// the request the iterator does not advance and the error is returned. 693func (iter *LocationListResultIterator) NextWithContext(ctx context.Context) (err error) { 694 if tracing.IsEnabled() { 695 ctx = tracing.StartSpan(ctx, fqdn+"/LocationListResultIterator.NextWithContext") 696 defer func() { 697 sc := -1 698 if iter.Response().Response.Response != nil { 699 sc = iter.Response().Response.Response.StatusCode 700 } 701 tracing.EndSpan(ctx, sc, err) 702 }() 703 } 704 iter.i++ 705 if iter.i < len(iter.page.Values()) { 706 return nil 707 } 708 err = iter.page.NextWithContext(ctx) 709 if err != nil { 710 iter.i-- 711 return err 712 } 713 iter.i = 0 714 return nil 715} 716 717// Next advances to the next value. If there was an error making 718// the request the iterator does not advance and the error is returned. 719// Deprecated: Use NextWithContext() instead. 720func (iter *LocationListResultIterator) Next() error { 721 return iter.NextWithContext(context.Background()) 722} 723 724// NotDone returns true if the enumeration should be started or is not yet complete. 725func (iter LocationListResultIterator) NotDone() bool { 726 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 727} 728 729// Response returns the raw server response from the last page request. 730func (iter LocationListResultIterator) Response() LocationListResult { 731 return iter.page.Response() 732} 733 734// Value returns the current value or a zero-initialized value if the 735// iterator has advanced beyond the end of the collection. 736func (iter LocationListResultIterator) Value() Location { 737 if !iter.page.NotDone() { 738 return Location{} 739 } 740 return iter.page.Values()[iter.i] 741} 742 743// Creates a new instance of the LocationListResultIterator type. 744func NewLocationListResultIterator(page LocationListResultPage) LocationListResultIterator { 745 return LocationListResultIterator{page: page} 746} 747 748// IsEmpty returns true if the ListResult contains no values. 749func (llr LocationListResult) IsEmpty() bool { 750 return llr.Value == nil || len(*llr.Value) == 0 751} 752 753// locationListResultPreparer prepares a request to retrieve the next set of results. 754// It returns nil if no more results exist. 755func (llr LocationListResult) locationListResultPreparer(ctx context.Context) (*http.Request, error) { 756 if llr.NextLink == nil || len(to.String(llr.NextLink)) < 1 { 757 return nil, nil 758 } 759 return autorest.Prepare((&http.Request{}).WithContext(ctx), 760 autorest.AsJSON(), 761 autorest.AsGet(), 762 autorest.WithBaseURL(to.String(llr.NextLink))) 763} 764 765// LocationListResultPage contains a page of Location values. 766type LocationListResultPage struct { 767 fn func(context.Context, LocationListResult) (LocationListResult, error) 768 llr LocationListResult 769} 770 771// NextWithContext advances to the next page of values. If there was an error making 772// the request the page does not advance and the error is returned. 773func (page *LocationListResultPage) NextWithContext(ctx context.Context) (err error) { 774 if tracing.IsEnabled() { 775 ctx = tracing.StartSpan(ctx, fqdn+"/LocationListResultPage.NextWithContext") 776 defer func() { 777 sc := -1 778 if page.Response().Response.Response != nil { 779 sc = page.Response().Response.Response.StatusCode 780 } 781 tracing.EndSpan(ctx, sc, err) 782 }() 783 } 784 next, err := page.fn(ctx, page.llr) 785 if err != nil { 786 return err 787 } 788 page.llr = next 789 return nil 790} 791 792// Next advances to the next page of values. If there was an error making 793// the request the page does not advance and the error is returned. 794// Deprecated: Use NextWithContext() instead. 795func (page *LocationListResultPage) Next() error { 796 return page.NextWithContext(context.Background()) 797} 798 799// NotDone returns true if the page enumeration should be started or is not yet complete. 800func (page LocationListResultPage) NotDone() bool { 801 return !page.llr.IsEmpty() 802} 803 804// Response returns the raw server response from the last page request. 805func (page LocationListResultPage) Response() LocationListResult { 806 return page.llr 807} 808 809// Values returns the slice of values for the current page or nil if there are no values. 810func (page LocationListResultPage) Values() []Location { 811 if page.llr.IsEmpty() { 812 return nil 813 } 814 return *page.llr.Value 815} 816 817// Creates a new instance of the LocationListResultPage type. 818func NewLocationListResultPage(getNextPage func(context.Context, LocationListResult) (LocationListResult, error)) LocationListResultPage { 819 return LocationListResultPage{fn: getNextPage} 820} 821 822// LocationProperties the properties that define a peering location. 823type LocationProperties struct { 824 // Direct - The properties that define a direct peering location. 825 Direct *LocationPropertiesDirect `json:"direct,omitempty"` 826 // Exchange - The properties that define an exchange peering location. 827 Exchange *LocationPropertiesExchange `json:"exchange,omitempty"` 828 // PeeringLocation - The name of the peering location. 829 PeeringLocation *string `json:"peeringLocation,omitempty"` 830 // Country - The country in which the peering location exists. 831 Country *string `json:"country,omitempty"` 832 // AzureRegion - The Azure region associated with the peering location. 833 AzureRegion *string `json:"azureRegion,omitempty"` 834} 835 836// LocationPropertiesDirect the properties that define a direct peering location. 837type LocationPropertiesDirect struct { 838 // PeeringFacilities - The list of direct peering facilities at the peering location. 839 PeeringFacilities *[]DirectPeeringFacility `json:"peeringFacilities,omitempty"` 840 // BandwidthOffers - The list of bandwidth offers available at the peering location. 841 BandwidthOffers *[]BandwidthOffer `json:"bandwidthOffers,omitempty"` 842} 843 844// LocationPropertiesExchange the properties that define an exchange peering location. 845type LocationPropertiesExchange struct { 846 // PeeringFacilities - The list of exchange peering facilities at the peering location. 847 PeeringFacilities *[]ExchangePeeringFacility `json:"peeringFacilities,omitempty"` 848} 849 850// Model peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a 851// location. 852type Model struct { 853 autorest.Response `json:"-"` 854 // Sku - The SKU that defines the tier and kind of the peering. 855 Sku *Sku `json:"sku,omitempty"` 856 // Kind - The kind of the peering. Possible values include: 'KindDirect', 'KindExchange' 857 Kind Kind `json:"kind,omitempty"` 858 // Properties - The properties that define a peering. 859 *Properties `json:"properties,omitempty"` 860 // Location - The location of the resource. 861 Location *string `json:"location,omitempty"` 862 // Tags - The resource tags. 863 Tags map[string]*string `json:"tags"` 864 // Name - READ-ONLY; The name of the resource. 865 Name *string `json:"name,omitempty"` 866 // ID - READ-ONLY; The ID of the resource. 867 ID *string `json:"id,omitempty"` 868 // Type - READ-ONLY; The type of the resource. 869 Type *string `json:"type,omitempty"` 870} 871 872// MarshalJSON is the custom marshaler for Model. 873func (mVar Model) MarshalJSON() ([]byte, error) { 874 objectMap := make(map[string]interface{}) 875 if mVar.Sku != nil { 876 objectMap["sku"] = mVar.Sku 877 } 878 if mVar.Kind != "" { 879 objectMap["kind"] = mVar.Kind 880 } 881 if mVar.Properties != nil { 882 objectMap["properties"] = mVar.Properties 883 } 884 if mVar.Location != nil { 885 objectMap["location"] = mVar.Location 886 } 887 if mVar.Tags != nil { 888 objectMap["tags"] = mVar.Tags 889 } 890 return json.Marshal(objectMap) 891} 892 893// UnmarshalJSON is the custom unmarshaler for Model struct. 894func (mVar *Model) UnmarshalJSON(body []byte) error { 895 var m map[string]*json.RawMessage 896 err := json.Unmarshal(body, &m) 897 if err != nil { 898 return err 899 } 900 for k, v := range m { 901 switch k { 902 case "sku": 903 if v != nil { 904 var sku Sku 905 err = json.Unmarshal(*v, &sku) 906 if err != nil { 907 return err 908 } 909 mVar.Sku = &sku 910 } 911 case "kind": 912 if v != nil { 913 var kind Kind 914 err = json.Unmarshal(*v, &kind) 915 if err != nil { 916 return err 917 } 918 mVar.Kind = kind 919 } 920 case "properties": 921 if v != nil { 922 var properties Properties 923 err = json.Unmarshal(*v, &properties) 924 if err != nil { 925 return err 926 } 927 mVar.Properties = &properties 928 } 929 case "location": 930 if v != nil { 931 var location string 932 err = json.Unmarshal(*v, &location) 933 if err != nil { 934 return err 935 } 936 mVar.Location = &location 937 } 938 case "tags": 939 if v != nil { 940 var tags map[string]*string 941 err = json.Unmarshal(*v, &tags) 942 if err != nil { 943 return err 944 } 945 mVar.Tags = tags 946 } 947 case "name": 948 if v != nil { 949 var name string 950 err = json.Unmarshal(*v, &name) 951 if err != nil { 952 return err 953 } 954 mVar.Name = &name 955 } 956 case "id": 957 if v != nil { 958 var ID string 959 err = json.Unmarshal(*v, &ID) 960 if err != nil { 961 return err 962 } 963 mVar.ID = &ID 964 } 965 case "type": 966 if v != nil { 967 var typeVar string 968 err = json.Unmarshal(*v, &typeVar) 969 if err != nil { 970 return err 971 } 972 mVar.Type = &typeVar 973 } 974 } 975 } 976 977 return nil 978} 979 980// Operation the peering API operation. 981type Operation struct { 982 // Name - READ-ONLY; The name of the operation. 983 Name *string `json:"name,omitempty"` 984 // Display - READ-ONLY; The information related to the operation. 985 Display *OperationDisplayInfo `json:"display,omitempty"` 986 // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. 987 IsDataAction *bool `json:"isDataAction,omitempty"` 988} 989 990// OperationDisplayInfo the information related to the operation. 991type OperationDisplayInfo struct { 992 // Provider - READ-ONLY; The name of the resource provider. 993 Provider *string `json:"provider,omitempty"` 994 // Resource - READ-ONLY; The type of the resource. 995 Resource *string `json:"resource,omitempty"` 996 // Operation - READ-ONLY; The name of the operation. 997 Operation *string `json:"operation,omitempty"` 998 // Description - READ-ONLY; The description of the operation. 999 Description *string `json:"description,omitempty"` 1000} 1001 1002// OperationListResult the paginated list of peering API operations. 1003type OperationListResult struct { 1004 autorest.Response `json:"-"` 1005 // Value - The list of peering API operations. 1006 Value *[]Operation `json:"value,omitempty"` 1007 // NextLink - The link to fetch the next page of peering API operations. 1008 NextLink *string `json:"nextLink,omitempty"` 1009} 1010 1011// OperationListResultIterator provides access to a complete listing of Operation values. 1012type OperationListResultIterator struct { 1013 i int 1014 page OperationListResultPage 1015} 1016 1017// NextWithContext advances to the next value. If there was an error making 1018// the request the iterator does not advance and the error is returned. 1019func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1020 if tracing.IsEnabled() { 1021 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1022 defer func() { 1023 sc := -1 1024 if iter.Response().Response.Response != nil { 1025 sc = iter.Response().Response.Response.StatusCode 1026 } 1027 tracing.EndSpan(ctx, sc, err) 1028 }() 1029 } 1030 iter.i++ 1031 if iter.i < len(iter.page.Values()) { 1032 return nil 1033 } 1034 err = iter.page.NextWithContext(ctx) 1035 if err != nil { 1036 iter.i-- 1037 return err 1038 } 1039 iter.i = 0 1040 return nil 1041} 1042 1043// Next advances to the next value. If there was an error making 1044// the request the iterator does not advance and the error is returned. 1045// Deprecated: Use NextWithContext() instead. 1046func (iter *OperationListResultIterator) Next() error { 1047 return iter.NextWithContext(context.Background()) 1048} 1049 1050// NotDone returns true if the enumeration should be started or is not yet complete. 1051func (iter OperationListResultIterator) NotDone() bool { 1052 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1053} 1054 1055// Response returns the raw server response from the last page request. 1056func (iter OperationListResultIterator) Response() OperationListResult { 1057 return iter.page.Response() 1058} 1059 1060// Value returns the current value or a zero-initialized value if the 1061// iterator has advanced beyond the end of the collection. 1062func (iter OperationListResultIterator) Value() Operation { 1063 if !iter.page.NotDone() { 1064 return Operation{} 1065 } 1066 return iter.page.Values()[iter.i] 1067} 1068 1069// Creates a new instance of the OperationListResultIterator type. 1070func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1071 return OperationListResultIterator{page: page} 1072} 1073 1074// IsEmpty returns true if the ListResult contains no values. 1075func (olr OperationListResult) IsEmpty() bool { 1076 return olr.Value == nil || len(*olr.Value) == 0 1077} 1078 1079// operationListResultPreparer prepares a request to retrieve the next set of results. 1080// It returns nil if no more results exist. 1081func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1082 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 1083 return nil, nil 1084 } 1085 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1086 autorest.AsJSON(), 1087 autorest.AsGet(), 1088 autorest.WithBaseURL(to.String(olr.NextLink))) 1089} 1090 1091// OperationListResultPage contains a page of Operation values. 1092type OperationListResultPage struct { 1093 fn func(context.Context, OperationListResult) (OperationListResult, error) 1094 olr OperationListResult 1095} 1096 1097// NextWithContext advances to the next page of values. If there was an error making 1098// the request the page does not advance and the error is returned. 1099func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1100 if tracing.IsEnabled() { 1101 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1102 defer func() { 1103 sc := -1 1104 if page.Response().Response.Response != nil { 1105 sc = page.Response().Response.Response.StatusCode 1106 } 1107 tracing.EndSpan(ctx, sc, err) 1108 }() 1109 } 1110 next, err := page.fn(ctx, page.olr) 1111 if err != nil { 1112 return err 1113 } 1114 page.olr = next 1115 return nil 1116} 1117 1118// Next advances to the next page of values. If there was an error making 1119// the request the page does not advance and the error is returned. 1120// Deprecated: Use NextWithContext() instead. 1121func (page *OperationListResultPage) Next() error { 1122 return page.NextWithContext(context.Background()) 1123} 1124 1125// NotDone returns true if the page enumeration should be started or is not yet complete. 1126func (page OperationListResultPage) NotDone() bool { 1127 return !page.olr.IsEmpty() 1128} 1129 1130// Response returns the raw server response from the last page request. 1131func (page OperationListResultPage) Response() OperationListResult { 1132 return page.olr 1133} 1134 1135// Values returns the slice of values for the current page or nil if there are no values. 1136func (page OperationListResultPage) Values() []Operation { 1137 if page.olr.IsEmpty() { 1138 return nil 1139 } 1140 return *page.olr.Value 1141} 1142 1143// Creates a new instance of the OperationListResultPage type. 1144func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1145 return OperationListResultPage{fn: getNextPage} 1146} 1147 1148// PeerAsn the essential information related to the peer's ASN. 1149type PeerAsn struct { 1150 autorest.Response `json:"-"` 1151 // PeerAsnProperties - The properties that define a peer's ASN. 1152 *PeerAsnProperties `json:"properties,omitempty"` 1153 // Name - READ-ONLY; The name of the resource. 1154 Name *string `json:"name,omitempty"` 1155 // ID - READ-ONLY; The ID of the resource. 1156 ID *string `json:"id,omitempty"` 1157 // Type - READ-ONLY; The type of the resource. 1158 Type *string `json:"type,omitempty"` 1159} 1160 1161// MarshalJSON is the custom marshaler for PeerAsn. 1162func (pa PeerAsn) MarshalJSON() ([]byte, error) { 1163 objectMap := make(map[string]interface{}) 1164 if pa.PeerAsnProperties != nil { 1165 objectMap["properties"] = pa.PeerAsnProperties 1166 } 1167 return json.Marshal(objectMap) 1168} 1169 1170// UnmarshalJSON is the custom unmarshaler for PeerAsn struct. 1171func (pa *PeerAsn) UnmarshalJSON(body []byte) error { 1172 var m map[string]*json.RawMessage 1173 err := json.Unmarshal(body, &m) 1174 if err != nil { 1175 return err 1176 } 1177 for k, v := range m { 1178 switch k { 1179 case "properties": 1180 if v != nil { 1181 var peerAsnProperties PeerAsnProperties 1182 err = json.Unmarshal(*v, &peerAsnProperties) 1183 if err != nil { 1184 return err 1185 } 1186 pa.PeerAsnProperties = &peerAsnProperties 1187 } 1188 case "name": 1189 if v != nil { 1190 var name string 1191 err = json.Unmarshal(*v, &name) 1192 if err != nil { 1193 return err 1194 } 1195 pa.Name = &name 1196 } 1197 case "id": 1198 if v != nil { 1199 var ID string 1200 err = json.Unmarshal(*v, &ID) 1201 if err != nil { 1202 return err 1203 } 1204 pa.ID = &ID 1205 } 1206 case "type": 1207 if v != nil { 1208 var typeVar string 1209 err = json.Unmarshal(*v, &typeVar) 1210 if err != nil { 1211 return err 1212 } 1213 pa.Type = &typeVar 1214 } 1215 } 1216 } 1217 1218 return nil 1219} 1220 1221// PeerAsnListResult the paginated list of peer ASNs. 1222type PeerAsnListResult struct { 1223 autorest.Response `json:"-"` 1224 // Value - The list of peer ASNs. 1225 Value *[]PeerAsn `json:"value,omitempty"` 1226 // NextLink - The link to fetch the next page of peer ASNs. 1227 NextLink *string `json:"nextLink,omitempty"` 1228} 1229 1230// PeerAsnListResultIterator provides access to a complete listing of PeerAsn values. 1231type PeerAsnListResultIterator struct { 1232 i int 1233 page PeerAsnListResultPage 1234} 1235 1236// NextWithContext advances to the next value. If there was an error making 1237// the request the iterator does not advance and the error is returned. 1238func (iter *PeerAsnListResultIterator) NextWithContext(ctx context.Context) (err error) { 1239 if tracing.IsEnabled() { 1240 ctx = tracing.StartSpan(ctx, fqdn+"/PeerAsnListResultIterator.NextWithContext") 1241 defer func() { 1242 sc := -1 1243 if iter.Response().Response.Response != nil { 1244 sc = iter.Response().Response.Response.StatusCode 1245 } 1246 tracing.EndSpan(ctx, sc, err) 1247 }() 1248 } 1249 iter.i++ 1250 if iter.i < len(iter.page.Values()) { 1251 return nil 1252 } 1253 err = iter.page.NextWithContext(ctx) 1254 if err != nil { 1255 iter.i-- 1256 return err 1257 } 1258 iter.i = 0 1259 return nil 1260} 1261 1262// Next advances to the next value. If there was an error making 1263// the request the iterator does not advance and the error is returned. 1264// Deprecated: Use NextWithContext() instead. 1265func (iter *PeerAsnListResultIterator) Next() error { 1266 return iter.NextWithContext(context.Background()) 1267} 1268 1269// NotDone returns true if the enumeration should be started or is not yet complete. 1270func (iter PeerAsnListResultIterator) NotDone() bool { 1271 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1272} 1273 1274// Response returns the raw server response from the last page request. 1275func (iter PeerAsnListResultIterator) Response() PeerAsnListResult { 1276 return iter.page.Response() 1277} 1278 1279// Value returns the current value or a zero-initialized value if the 1280// iterator has advanced beyond the end of the collection. 1281func (iter PeerAsnListResultIterator) Value() PeerAsn { 1282 if !iter.page.NotDone() { 1283 return PeerAsn{} 1284 } 1285 return iter.page.Values()[iter.i] 1286} 1287 1288// Creates a new instance of the PeerAsnListResultIterator type. 1289func NewPeerAsnListResultIterator(page PeerAsnListResultPage) PeerAsnListResultIterator { 1290 return PeerAsnListResultIterator{page: page} 1291} 1292 1293// IsEmpty returns true if the ListResult contains no values. 1294func (palr PeerAsnListResult) IsEmpty() bool { 1295 return palr.Value == nil || len(*palr.Value) == 0 1296} 1297 1298// peerAsnListResultPreparer prepares a request to retrieve the next set of results. 1299// It returns nil if no more results exist. 1300func (palr PeerAsnListResult) peerAsnListResultPreparer(ctx context.Context) (*http.Request, error) { 1301 if palr.NextLink == nil || len(to.String(palr.NextLink)) < 1 { 1302 return nil, nil 1303 } 1304 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1305 autorest.AsJSON(), 1306 autorest.AsGet(), 1307 autorest.WithBaseURL(to.String(palr.NextLink))) 1308} 1309 1310// PeerAsnListResultPage contains a page of PeerAsn values. 1311type PeerAsnListResultPage struct { 1312 fn func(context.Context, PeerAsnListResult) (PeerAsnListResult, error) 1313 palr PeerAsnListResult 1314} 1315 1316// NextWithContext advances to the next page of values. If there was an error making 1317// the request the page does not advance and the error is returned. 1318func (page *PeerAsnListResultPage) NextWithContext(ctx context.Context) (err error) { 1319 if tracing.IsEnabled() { 1320 ctx = tracing.StartSpan(ctx, fqdn+"/PeerAsnListResultPage.NextWithContext") 1321 defer func() { 1322 sc := -1 1323 if page.Response().Response.Response != nil { 1324 sc = page.Response().Response.Response.StatusCode 1325 } 1326 tracing.EndSpan(ctx, sc, err) 1327 }() 1328 } 1329 next, err := page.fn(ctx, page.palr) 1330 if err != nil { 1331 return err 1332 } 1333 page.palr = next 1334 return nil 1335} 1336 1337// Next advances to the next page of values. If there was an error making 1338// the request the page does not advance and the error is returned. 1339// Deprecated: Use NextWithContext() instead. 1340func (page *PeerAsnListResultPage) Next() error { 1341 return page.NextWithContext(context.Background()) 1342} 1343 1344// NotDone returns true if the page enumeration should be started or is not yet complete. 1345func (page PeerAsnListResultPage) NotDone() bool { 1346 return !page.palr.IsEmpty() 1347} 1348 1349// Response returns the raw server response from the last page request. 1350func (page PeerAsnListResultPage) Response() PeerAsnListResult { 1351 return page.palr 1352} 1353 1354// Values returns the slice of values for the current page or nil if there are no values. 1355func (page PeerAsnListResultPage) Values() []PeerAsn { 1356 if page.palr.IsEmpty() { 1357 return nil 1358 } 1359 return *page.palr.Value 1360} 1361 1362// Creates a new instance of the PeerAsnListResultPage type. 1363func NewPeerAsnListResultPage(getNextPage func(context.Context, PeerAsnListResult) (PeerAsnListResult, error)) PeerAsnListResultPage { 1364 return PeerAsnListResultPage{fn: getNextPage} 1365} 1366 1367// PeerAsnProperties the properties that define a peer's ASN. 1368type PeerAsnProperties struct { 1369 // PeerAsn - The Autonomous System Number (ASN) of the peer. 1370 PeerAsn *int32 `json:"peerAsn,omitempty"` 1371 // PeerContactInfo - The contact information of the peer. 1372 PeerContactInfo *ContactInfo `json:"peerContactInfo,omitempty"` 1373 // PeerName - The name of the peer. 1374 PeerName *string `json:"peerName,omitempty"` 1375 // ValidationState - The validation state of the ASN associated with the peer. Possible values include: 'ValidationStateNone', 'ValidationStatePending', 'ValidationStateApproved', 'ValidationStateFailed' 1376 ValidationState ValidationState `json:"validationState,omitempty"` 1377} 1378 1379// Properties the properties that define connectivity to the Microsoft Cloud Edge. 1380type Properties struct { 1381 // Direct - The properties that define a direct peering. 1382 Direct *PropertiesDirect `json:"direct,omitempty"` 1383 // Exchange - The properties that define an exchange peering. 1384 Exchange *PropertiesExchange `json:"exchange,omitempty"` 1385 // PeeringLocation - The location of the peering. 1386 PeeringLocation *string `json:"peeringLocation,omitempty"` 1387 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 1388 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1389} 1390 1391// PropertiesDirect the properties that define a direct peering. 1392type PropertiesDirect struct { 1393 // Connections - The set of connections that constitute a direct peering. 1394 Connections *[]DirectConnection `json:"connections,omitempty"` 1395 // UseForPeeringService - The flag that indicates whether or not the peering is used for peering service. 1396 UseForPeeringService *bool `json:"useForPeeringService,omitempty"` 1397 // PeerAsn - The reference of the peer ASN. 1398 PeerAsn *SubResource `json:"peerAsn,omitempty"` 1399 // DirectPeeringType - The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal' 1400 DirectPeeringType DirectPeeringType `json:"directPeeringType,omitempty"` 1401} 1402 1403// PropertiesExchange the properties that define an exchange peering. 1404type PropertiesExchange struct { 1405 // Connections - The set of connections that constitute an exchange peering. 1406 Connections *[]ExchangeConnection `json:"connections,omitempty"` 1407 // PeerAsn - The reference of the peer ASN. 1408 PeerAsn *SubResource `json:"peerAsn,omitempty"` 1409} 1410 1411// Resource the ARM resource class. 1412type Resource struct { 1413 // Name - READ-ONLY; The name of the resource. 1414 Name *string `json:"name,omitempty"` 1415 // ID - READ-ONLY; The ID of the resource. 1416 ID *string `json:"id,omitempty"` 1417 // Type - READ-ONLY; The type of the resource. 1418 Type *string `json:"type,omitempty"` 1419} 1420 1421// ResourceTags the resource tags. 1422type ResourceTags struct { 1423 // Tags - Gets or sets the tags, a dictionary of descriptors arm object 1424 Tags map[string]*string `json:"tags"` 1425} 1426 1427// MarshalJSON is the custom marshaler for ResourceTags. 1428func (rt ResourceTags) MarshalJSON() ([]byte, error) { 1429 objectMap := make(map[string]interface{}) 1430 if rt.Tags != nil { 1431 objectMap["tags"] = rt.Tags 1432 } 1433 return json.Marshal(objectMap) 1434} 1435 1436// Service peering Service 1437type Service struct { 1438 autorest.Response `json:"-"` 1439 // ServiceProperties - The properties that define a peering service. 1440 *ServiceProperties `json:"properties,omitempty"` 1441 // Location - The location of the resource. 1442 Location *string `json:"location,omitempty"` 1443 // Tags - The resource tags. 1444 Tags map[string]*string `json:"tags"` 1445 // Name - READ-ONLY; The name of the resource. 1446 Name *string `json:"name,omitempty"` 1447 // ID - READ-ONLY; The ID of the resource. 1448 ID *string `json:"id,omitempty"` 1449 // Type - READ-ONLY; The type of the resource. 1450 Type *string `json:"type,omitempty"` 1451} 1452 1453// MarshalJSON is the custom marshaler for Service. 1454func (s Service) MarshalJSON() ([]byte, error) { 1455 objectMap := make(map[string]interface{}) 1456 if s.ServiceProperties != nil { 1457 objectMap["properties"] = s.ServiceProperties 1458 } 1459 if s.Location != nil { 1460 objectMap["location"] = s.Location 1461 } 1462 if s.Tags != nil { 1463 objectMap["tags"] = s.Tags 1464 } 1465 return json.Marshal(objectMap) 1466} 1467 1468// UnmarshalJSON is the custom unmarshaler for Service struct. 1469func (s *Service) UnmarshalJSON(body []byte) error { 1470 var m map[string]*json.RawMessage 1471 err := json.Unmarshal(body, &m) 1472 if err != nil { 1473 return err 1474 } 1475 for k, v := range m { 1476 switch k { 1477 case "properties": 1478 if v != nil { 1479 var serviceProperties ServiceProperties 1480 err = json.Unmarshal(*v, &serviceProperties) 1481 if err != nil { 1482 return err 1483 } 1484 s.ServiceProperties = &serviceProperties 1485 } 1486 case "location": 1487 if v != nil { 1488 var location string 1489 err = json.Unmarshal(*v, &location) 1490 if err != nil { 1491 return err 1492 } 1493 s.Location = &location 1494 } 1495 case "tags": 1496 if v != nil { 1497 var tags map[string]*string 1498 err = json.Unmarshal(*v, &tags) 1499 if err != nil { 1500 return err 1501 } 1502 s.Tags = tags 1503 } 1504 case "name": 1505 if v != nil { 1506 var name string 1507 err = json.Unmarshal(*v, &name) 1508 if err != nil { 1509 return err 1510 } 1511 s.Name = &name 1512 } 1513 case "id": 1514 if v != nil { 1515 var ID string 1516 err = json.Unmarshal(*v, &ID) 1517 if err != nil { 1518 return err 1519 } 1520 s.ID = &ID 1521 } 1522 case "type": 1523 if v != nil { 1524 var typeVar string 1525 err = json.Unmarshal(*v, &typeVar) 1526 if err != nil { 1527 return err 1528 } 1529 s.Type = &typeVar 1530 } 1531 } 1532 } 1533 1534 return nil 1535} 1536 1537// ServiceListResult the paginated list of peering services. 1538type ServiceListResult struct { 1539 autorest.Response `json:"-"` 1540 // Value - The list of peering services. 1541 Value *[]Service `json:"value,omitempty"` 1542 // NextLink - The link to fetch the next page of peering services. 1543 NextLink *string `json:"nextLink,omitempty"` 1544} 1545 1546// ServiceListResultIterator provides access to a complete listing of Service values. 1547type ServiceListResultIterator struct { 1548 i int 1549 page ServiceListResultPage 1550} 1551 1552// NextWithContext advances to the next value. If there was an error making 1553// the request the iterator does not advance and the error is returned. 1554func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1555 if tracing.IsEnabled() { 1556 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.NextWithContext") 1557 defer func() { 1558 sc := -1 1559 if iter.Response().Response.Response != nil { 1560 sc = iter.Response().Response.Response.StatusCode 1561 } 1562 tracing.EndSpan(ctx, sc, err) 1563 }() 1564 } 1565 iter.i++ 1566 if iter.i < len(iter.page.Values()) { 1567 return nil 1568 } 1569 err = iter.page.NextWithContext(ctx) 1570 if err != nil { 1571 iter.i-- 1572 return err 1573 } 1574 iter.i = 0 1575 return nil 1576} 1577 1578// Next advances to the next value. If there was an error making 1579// the request the iterator does not advance and the error is returned. 1580// Deprecated: Use NextWithContext() instead. 1581func (iter *ServiceListResultIterator) Next() error { 1582 return iter.NextWithContext(context.Background()) 1583} 1584 1585// NotDone returns true if the enumeration should be started or is not yet complete. 1586func (iter ServiceListResultIterator) NotDone() bool { 1587 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1588} 1589 1590// Response returns the raw server response from the last page request. 1591func (iter ServiceListResultIterator) Response() ServiceListResult { 1592 return iter.page.Response() 1593} 1594 1595// Value returns the current value or a zero-initialized value if the 1596// iterator has advanced beyond the end of the collection. 1597func (iter ServiceListResultIterator) Value() Service { 1598 if !iter.page.NotDone() { 1599 return Service{} 1600 } 1601 return iter.page.Values()[iter.i] 1602} 1603 1604// Creates a new instance of the ServiceListResultIterator type. 1605func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { 1606 return ServiceListResultIterator{page: page} 1607} 1608 1609// IsEmpty returns true if the ListResult contains no values. 1610func (slr ServiceListResult) IsEmpty() bool { 1611 return slr.Value == nil || len(*slr.Value) == 0 1612} 1613 1614// serviceListResultPreparer prepares a request to retrieve the next set of results. 1615// It returns nil if no more results exist. 1616func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) { 1617 if slr.NextLink == nil || len(to.String(slr.NextLink)) < 1 { 1618 return nil, nil 1619 } 1620 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1621 autorest.AsJSON(), 1622 autorest.AsGet(), 1623 autorest.WithBaseURL(to.String(slr.NextLink))) 1624} 1625 1626// ServiceListResultPage contains a page of Service values. 1627type ServiceListResultPage struct { 1628 fn func(context.Context, ServiceListResult) (ServiceListResult, error) 1629 slr ServiceListResult 1630} 1631 1632// NextWithContext advances to the next page of values. If there was an error making 1633// the request the page does not advance and the error is returned. 1634func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { 1635 if tracing.IsEnabled() { 1636 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.NextWithContext") 1637 defer func() { 1638 sc := -1 1639 if page.Response().Response.Response != nil { 1640 sc = page.Response().Response.Response.StatusCode 1641 } 1642 tracing.EndSpan(ctx, sc, err) 1643 }() 1644 } 1645 next, err := page.fn(ctx, page.slr) 1646 if err != nil { 1647 return err 1648 } 1649 page.slr = next 1650 return nil 1651} 1652 1653// Next advances to the next page of values. If there was an error making 1654// the request the page does not advance and the error is returned. 1655// Deprecated: Use NextWithContext() instead. 1656func (page *ServiceListResultPage) Next() error { 1657 return page.NextWithContext(context.Background()) 1658} 1659 1660// NotDone returns true if the page enumeration should be started or is not yet complete. 1661func (page ServiceListResultPage) NotDone() bool { 1662 return !page.slr.IsEmpty() 1663} 1664 1665// Response returns the raw server response from the last page request. 1666func (page ServiceListResultPage) Response() ServiceListResult { 1667 return page.slr 1668} 1669 1670// Values returns the slice of values for the current page or nil if there are no values. 1671func (page ServiceListResultPage) Values() []Service { 1672 if page.slr.IsEmpty() { 1673 return nil 1674 } 1675 return *page.slr.Value 1676} 1677 1678// Creates a new instance of the ServiceListResultPage type. 1679func NewServiceListResultPage(getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { 1680 return ServiceListResultPage{fn: getNextPage} 1681} 1682 1683// ServiceLocation peeringService location 1684type ServiceLocation struct { 1685 // ServiceLocationProperties - The properties that define a peering service location. 1686 *ServiceLocationProperties `json:"properties,omitempty"` 1687 // Name - READ-ONLY; The name of the resource. 1688 Name *string `json:"name,omitempty"` 1689 // ID - READ-ONLY; The ID of the resource. 1690 ID *string `json:"id,omitempty"` 1691 // Type - READ-ONLY; The type of the resource. 1692 Type *string `json:"type,omitempty"` 1693} 1694 1695// MarshalJSON is the custom marshaler for ServiceLocation. 1696func (sl ServiceLocation) MarshalJSON() ([]byte, error) { 1697 objectMap := make(map[string]interface{}) 1698 if sl.ServiceLocationProperties != nil { 1699 objectMap["properties"] = sl.ServiceLocationProperties 1700 } 1701 return json.Marshal(objectMap) 1702} 1703 1704// UnmarshalJSON is the custom unmarshaler for ServiceLocation struct. 1705func (sl *ServiceLocation) UnmarshalJSON(body []byte) error { 1706 var m map[string]*json.RawMessage 1707 err := json.Unmarshal(body, &m) 1708 if err != nil { 1709 return err 1710 } 1711 for k, v := range m { 1712 switch k { 1713 case "properties": 1714 if v != nil { 1715 var serviceLocationProperties ServiceLocationProperties 1716 err = json.Unmarshal(*v, &serviceLocationProperties) 1717 if err != nil { 1718 return err 1719 } 1720 sl.ServiceLocationProperties = &serviceLocationProperties 1721 } 1722 case "name": 1723 if v != nil { 1724 var name string 1725 err = json.Unmarshal(*v, &name) 1726 if err != nil { 1727 return err 1728 } 1729 sl.Name = &name 1730 } 1731 case "id": 1732 if v != nil { 1733 var ID string 1734 err = json.Unmarshal(*v, &ID) 1735 if err != nil { 1736 return err 1737 } 1738 sl.ID = &ID 1739 } 1740 case "type": 1741 if v != nil { 1742 var typeVar string 1743 err = json.Unmarshal(*v, &typeVar) 1744 if err != nil { 1745 return err 1746 } 1747 sl.Type = &typeVar 1748 } 1749 } 1750 } 1751 1752 return nil 1753} 1754 1755// ServiceLocationListResult the paginated list of peering service locations. 1756type ServiceLocationListResult struct { 1757 autorest.Response `json:"-"` 1758 // Value - The list of peering service locations. 1759 Value *[]ServiceLocation `json:"value,omitempty"` 1760 // NextLink - The link to fetch the next page of peering service locations. 1761 NextLink *string `json:"nextLink,omitempty"` 1762} 1763 1764// ServiceLocationListResultIterator provides access to a complete listing of ServiceLocation values. 1765type ServiceLocationListResultIterator struct { 1766 i int 1767 page ServiceLocationListResultPage 1768} 1769 1770// NextWithContext advances to the next value. If there was an error making 1771// the request the iterator does not advance and the error is returned. 1772func (iter *ServiceLocationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1773 if tracing.IsEnabled() { 1774 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceLocationListResultIterator.NextWithContext") 1775 defer func() { 1776 sc := -1 1777 if iter.Response().Response.Response != nil { 1778 sc = iter.Response().Response.Response.StatusCode 1779 } 1780 tracing.EndSpan(ctx, sc, err) 1781 }() 1782 } 1783 iter.i++ 1784 if iter.i < len(iter.page.Values()) { 1785 return nil 1786 } 1787 err = iter.page.NextWithContext(ctx) 1788 if err != nil { 1789 iter.i-- 1790 return err 1791 } 1792 iter.i = 0 1793 return nil 1794} 1795 1796// Next advances to the next value. If there was an error making 1797// the request the iterator does not advance and the error is returned. 1798// Deprecated: Use NextWithContext() instead. 1799func (iter *ServiceLocationListResultIterator) Next() error { 1800 return iter.NextWithContext(context.Background()) 1801} 1802 1803// NotDone returns true if the enumeration should be started or is not yet complete. 1804func (iter ServiceLocationListResultIterator) NotDone() bool { 1805 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1806} 1807 1808// Response returns the raw server response from the last page request. 1809func (iter ServiceLocationListResultIterator) Response() ServiceLocationListResult { 1810 return iter.page.Response() 1811} 1812 1813// Value returns the current value or a zero-initialized value if the 1814// iterator has advanced beyond the end of the collection. 1815func (iter ServiceLocationListResultIterator) Value() ServiceLocation { 1816 if !iter.page.NotDone() { 1817 return ServiceLocation{} 1818 } 1819 return iter.page.Values()[iter.i] 1820} 1821 1822// Creates a new instance of the ServiceLocationListResultIterator type. 1823func NewServiceLocationListResultIterator(page ServiceLocationListResultPage) ServiceLocationListResultIterator { 1824 return ServiceLocationListResultIterator{page: page} 1825} 1826 1827// IsEmpty returns true if the ListResult contains no values. 1828func (sllr ServiceLocationListResult) IsEmpty() bool { 1829 return sllr.Value == nil || len(*sllr.Value) == 0 1830} 1831 1832// serviceLocationListResultPreparer prepares a request to retrieve the next set of results. 1833// It returns nil if no more results exist. 1834func (sllr ServiceLocationListResult) serviceLocationListResultPreparer(ctx context.Context) (*http.Request, error) { 1835 if sllr.NextLink == nil || len(to.String(sllr.NextLink)) < 1 { 1836 return nil, nil 1837 } 1838 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1839 autorest.AsJSON(), 1840 autorest.AsGet(), 1841 autorest.WithBaseURL(to.String(sllr.NextLink))) 1842} 1843 1844// ServiceLocationListResultPage contains a page of ServiceLocation values. 1845type ServiceLocationListResultPage struct { 1846 fn func(context.Context, ServiceLocationListResult) (ServiceLocationListResult, error) 1847 sllr ServiceLocationListResult 1848} 1849 1850// NextWithContext advances to the next page of values. If there was an error making 1851// the request the page does not advance and the error is returned. 1852func (page *ServiceLocationListResultPage) NextWithContext(ctx context.Context) (err error) { 1853 if tracing.IsEnabled() { 1854 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceLocationListResultPage.NextWithContext") 1855 defer func() { 1856 sc := -1 1857 if page.Response().Response.Response != nil { 1858 sc = page.Response().Response.Response.StatusCode 1859 } 1860 tracing.EndSpan(ctx, sc, err) 1861 }() 1862 } 1863 next, err := page.fn(ctx, page.sllr) 1864 if err != nil { 1865 return err 1866 } 1867 page.sllr = next 1868 return nil 1869} 1870 1871// Next advances to the next page of values. If there was an error making 1872// the request the page does not advance and the error is returned. 1873// Deprecated: Use NextWithContext() instead. 1874func (page *ServiceLocationListResultPage) Next() error { 1875 return page.NextWithContext(context.Background()) 1876} 1877 1878// NotDone returns true if the page enumeration should be started or is not yet complete. 1879func (page ServiceLocationListResultPage) NotDone() bool { 1880 return !page.sllr.IsEmpty() 1881} 1882 1883// Response returns the raw server response from the last page request. 1884func (page ServiceLocationListResultPage) Response() ServiceLocationListResult { 1885 return page.sllr 1886} 1887 1888// Values returns the slice of values for the current page or nil if there are no values. 1889func (page ServiceLocationListResultPage) Values() []ServiceLocation { 1890 if page.sllr.IsEmpty() { 1891 return nil 1892 } 1893 return *page.sllr.Value 1894} 1895 1896// Creates a new instance of the ServiceLocationListResultPage type. 1897func NewServiceLocationListResultPage(getNextPage func(context.Context, ServiceLocationListResult) (ServiceLocationListResult, error)) ServiceLocationListResultPage { 1898 return ServiceLocationListResultPage{fn: getNextPage} 1899} 1900 1901// ServiceLocationProperties the properties that define connectivity to the Peering Service Location. 1902type ServiceLocationProperties struct { 1903 // Country - Country of the customer 1904 Country *string `json:"country,omitempty"` 1905 // State - State of the customer 1906 State *string `json:"state,omitempty"` 1907 // AzureRegion - Azure region for the location 1908 AzureRegion *string `json:"azureRegion,omitempty"` 1909} 1910 1911// ServicePrefix the peering service prefix class. 1912type ServicePrefix struct { 1913 autorest.Response `json:"-"` 1914 // ServicePrefixProperties - Gets or sets the peering prefix properties. 1915 *ServicePrefixProperties `json:"properties,omitempty"` 1916 // Name - READ-ONLY; The name of the resource. 1917 Name *string `json:"name,omitempty"` 1918 // ID - READ-ONLY; The ID of the resource. 1919 ID *string `json:"id,omitempty"` 1920 // Type - READ-ONLY; The type of the resource. 1921 Type *string `json:"type,omitempty"` 1922} 1923 1924// MarshalJSON is the custom marshaler for ServicePrefix. 1925func (sp ServicePrefix) MarshalJSON() ([]byte, error) { 1926 objectMap := make(map[string]interface{}) 1927 if sp.ServicePrefixProperties != nil { 1928 objectMap["properties"] = sp.ServicePrefixProperties 1929 } 1930 return json.Marshal(objectMap) 1931} 1932 1933// UnmarshalJSON is the custom unmarshaler for ServicePrefix struct. 1934func (sp *ServicePrefix) UnmarshalJSON(body []byte) error { 1935 var m map[string]*json.RawMessage 1936 err := json.Unmarshal(body, &m) 1937 if err != nil { 1938 return err 1939 } 1940 for k, v := range m { 1941 switch k { 1942 case "properties": 1943 if v != nil { 1944 var servicePrefixProperties ServicePrefixProperties 1945 err = json.Unmarshal(*v, &servicePrefixProperties) 1946 if err != nil { 1947 return err 1948 } 1949 sp.ServicePrefixProperties = &servicePrefixProperties 1950 } 1951 case "name": 1952 if v != nil { 1953 var name string 1954 err = json.Unmarshal(*v, &name) 1955 if err != nil { 1956 return err 1957 } 1958 sp.Name = &name 1959 } 1960 case "id": 1961 if v != nil { 1962 var ID string 1963 err = json.Unmarshal(*v, &ID) 1964 if err != nil { 1965 return err 1966 } 1967 sp.ID = &ID 1968 } 1969 case "type": 1970 if v != nil { 1971 var typeVar string 1972 err = json.Unmarshal(*v, &typeVar) 1973 if err != nil { 1974 return err 1975 } 1976 sp.Type = &typeVar 1977 } 1978 } 1979 } 1980 1981 return nil 1982} 1983 1984// ServicePrefixListResult the paginated list of [T]. 1985type ServicePrefixListResult struct { 1986 autorest.Response `json:"-"` 1987 // Value - The list of [T]. 1988 Value *[]ServicePrefix `json:"value,omitempty"` 1989 // NextLink - The link to fetch the next page of [T]. 1990 NextLink *string `json:"nextLink,omitempty"` 1991} 1992 1993// ServicePrefixListResultIterator provides access to a complete listing of ServicePrefix values. 1994type ServicePrefixListResultIterator struct { 1995 i int 1996 page ServicePrefixListResultPage 1997} 1998 1999// NextWithContext advances to the next value. If there was an error making 2000// the request the iterator does not advance and the error is returned. 2001func (iter *ServicePrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { 2002 if tracing.IsEnabled() { 2003 ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrefixListResultIterator.NextWithContext") 2004 defer func() { 2005 sc := -1 2006 if iter.Response().Response.Response != nil { 2007 sc = iter.Response().Response.Response.StatusCode 2008 } 2009 tracing.EndSpan(ctx, sc, err) 2010 }() 2011 } 2012 iter.i++ 2013 if iter.i < len(iter.page.Values()) { 2014 return nil 2015 } 2016 err = iter.page.NextWithContext(ctx) 2017 if err != nil { 2018 iter.i-- 2019 return err 2020 } 2021 iter.i = 0 2022 return nil 2023} 2024 2025// Next advances to the next value. If there was an error making 2026// the request the iterator does not advance and the error is returned. 2027// Deprecated: Use NextWithContext() instead. 2028func (iter *ServicePrefixListResultIterator) Next() error { 2029 return iter.NextWithContext(context.Background()) 2030} 2031 2032// NotDone returns true if the enumeration should be started or is not yet complete. 2033func (iter ServicePrefixListResultIterator) NotDone() bool { 2034 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2035} 2036 2037// Response returns the raw server response from the last page request. 2038func (iter ServicePrefixListResultIterator) Response() ServicePrefixListResult { 2039 return iter.page.Response() 2040} 2041 2042// Value returns the current value or a zero-initialized value if the 2043// iterator has advanced beyond the end of the collection. 2044func (iter ServicePrefixListResultIterator) Value() ServicePrefix { 2045 if !iter.page.NotDone() { 2046 return ServicePrefix{} 2047 } 2048 return iter.page.Values()[iter.i] 2049} 2050 2051// Creates a new instance of the ServicePrefixListResultIterator type. 2052func NewServicePrefixListResultIterator(page ServicePrefixListResultPage) ServicePrefixListResultIterator { 2053 return ServicePrefixListResultIterator{page: page} 2054} 2055 2056// IsEmpty returns true if the ListResult contains no values. 2057func (splr ServicePrefixListResult) IsEmpty() bool { 2058 return splr.Value == nil || len(*splr.Value) == 0 2059} 2060 2061// servicePrefixListResultPreparer prepares a request to retrieve the next set of results. 2062// It returns nil if no more results exist. 2063func (splr ServicePrefixListResult) servicePrefixListResultPreparer(ctx context.Context) (*http.Request, error) { 2064 if splr.NextLink == nil || len(to.String(splr.NextLink)) < 1 { 2065 return nil, nil 2066 } 2067 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2068 autorest.AsJSON(), 2069 autorest.AsGet(), 2070 autorest.WithBaseURL(to.String(splr.NextLink))) 2071} 2072 2073// ServicePrefixListResultPage contains a page of ServicePrefix values. 2074type ServicePrefixListResultPage struct { 2075 fn func(context.Context, ServicePrefixListResult) (ServicePrefixListResult, error) 2076 splr ServicePrefixListResult 2077} 2078 2079// NextWithContext advances to the next page of values. If there was an error making 2080// the request the page does not advance and the error is returned. 2081func (page *ServicePrefixListResultPage) NextWithContext(ctx context.Context) (err error) { 2082 if tracing.IsEnabled() { 2083 ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrefixListResultPage.NextWithContext") 2084 defer func() { 2085 sc := -1 2086 if page.Response().Response.Response != nil { 2087 sc = page.Response().Response.Response.StatusCode 2088 } 2089 tracing.EndSpan(ctx, sc, err) 2090 }() 2091 } 2092 next, err := page.fn(ctx, page.splr) 2093 if err != nil { 2094 return err 2095 } 2096 page.splr = next 2097 return nil 2098} 2099 2100// Next 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. 2102// Deprecated: Use NextWithContext() instead. 2103func (page *ServicePrefixListResultPage) Next() error { 2104 return page.NextWithContext(context.Background()) 2105} 2106 2107// NotDone returns true if the page enumeration should be started or is not yet complete. 2108func (page ServicePrefixListResultPage) NotDone() bool { 2109 return !page.splr.IsEmpty() 2110} 2111 2112// Response returns the raw server response from the last page request. 2113func (page ServicePrefixListResultPage) Response() ServicePrefixListResult { 2114 return page.splr 2115} 2116 2117// Values returns the slice of values for the current page or nil if there are no values. 2118func (page ServicePrefixListResultPage) Values() []ServicePrefix { 2119 if page.splr.IsEmpty() { 2120 return nil 2121 } 2122 return *page.splr.Value 2123} 2124 2125// Creates a new instance of the ServicePrefixListResultPage type. 2126func NewServicePrefixListResultPage(getNextPage func(context.Context, ServicePrefixListResult) (ServicePrefixListResult, error)) ServicePrefixListResultPage { 2127 return ServicePrefixListResultPage{fn: getNextPage} 2128} 2129 2130// ServicePrefixProperties the peering service prefix properties class. 2131type ServicePrefixProperties struct { 2132 // Prefix - Valid route prefix 2133 Prefix *string `json:"prefix,omitempty"` 2134 // PrefixValidationState - The prefix validation state. Possible values include: 'PrefixValidationStateNone', 'PrefixValidationStateInvalid', 'PrefixValidationStateVerified', 'PrefixValidationStateFailed', 'PrefixValidationStatePending', 'PrefixValidationStateUnknown' 2135 PrefixValidationState PrefixValidationState `json:"prefixValidationState,omitempty"` 2136 // LearnedType - The prefix learned type. Possible values include: 'LearnedTypeNone', 'LearnedTypeViaPartner', 'LearnedTypeViaSession' 2137 LearnedType LearnedType `json:"learnedType,omitempty"` 2138 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 2139 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2140} 2141 2142// ServiceProperties the properties that define connectivity to the Peering Service. 2143type ServiceProperties struct { 2144 // PeeringServiceLocation - The PeeringServiceLocation of the Customer. 2145 PeeringServiceLocation *string `json:"peeringServiceLocation,omitempty"` 2146 // PeeringServiceProvider - The MAPS Provider Name. 2147 PeeringServiceProvider *string `json:"peeringServiceProvider,omitempty"` 2148 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 2149 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2150} 2151 2152// ServiceProvider peeringService provider 2153type ServiceProvider struct { 2154 // ServiceProviderProperties - The properties that define a peering service provider. 2155 *ServiceProviderProperties `json:"properties,omitempty"` 2156 // Name - READ-ONLY; The name of the resource. 2157 Name *string `json:"name,omitempty"` 2158 // ID - READ-ONLY; The ID of the resource. 2159 ID *string `json:"id,omitempty"` 2160 // Type - READ-ONLY; The type of the resource. 2161 Type *string `json:"type,omitempty"` 2162} 2163 2164// MarshalJSON is the custom marshaler for ServiceProvider. 2165func (sp ServiceProvider) MarshalJSON() ([]byte, error) { 2166 objectMap := make(map[string]interface{}) 2167 if sp.ServiceProviderProperties != nil { 2168 objectMap["properties"] = sp.ServiceProviderProperties 2169 } 2170 return json.Marshal(objectMap) 2171} 2172 2173// UnmarshalJSON is the custom unmarshaler for ServiceProvider struct. 2174func (sp *ServiceProvider) UnmarshalJSON(body []byte) error { 2175 var m map[string]*json.RawMessage 2176 err := json.Unmarshal(body, &m) 2177 if err != nil { 2178 return err 2179 } 2180 for k, v := range m { 2181 switch k { 2182 case "properties": 2183 if v != nil { 2184 var serviceProviderProperties ServiceProviderProperties 2185 err = json.Unmarshal(*v, &serviceProviderProperties) 2186 if err != nil { 2187 return err 2188 } 2189 sp.ServiceProviderProperties = &serviceProviderProperties 2190 } 2191 case "name": 2192 if v != nil { 2193 var name string 2194 err = json.Unmarshal(*v, &name) 2195 if err != nil { 2196 return err 2197 } 2198 sp.Name = &name 2199 } 2200 case "id": 2201 if v != nil { 2202 var ID string 2203 err = json.Unmarshal(*v, &ID) 2204 if err != nil { 2205 return err 2206 } 2207 sp.ID = &ID 2208 } 2209 case "type": 2210 if v != nil { 2211 var typeVar string 2212 err = json.Unmarshal(*v, &typeVar) 2213 if err != nil { 2214 return err 2215 } 2216 sp.Type = &typeVar 2217 } 2218 } 2219 } 2220 2221 return nil 2222} 2223 2224// ServiceProviderListResult the paginated list of peering service providers. 2225type ServiceProviderListResult struct { 2226 autorest.Response `json:"-"` 2227 // Value - The list of peering service providers. 2228 Value *[]ServiceProvider `json:"value,omitempty"` 2229 // NextLink - The link to fetch the next page of peering service providers. 2230 NextLink *string `json:"nextLink,omitempty"` 2231} 2232 2233// ServiceProviderListResultIterator provides access to a complete listing of ServiceProvider values. 2234type ServiceProviderListResultIterator struct { 2235 i int 2236 page ServiceProviderListResultPage 2237} 2238 2239// NextWithContext advances to the next value. If there was an error making 2240// the request the iterator does not advance and the error is returned. 2241func (iter *ServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { 2242 if tracing.IsEnabled() { 2243 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceProviderListResultIterator.NextWithContext") 2244 defer func() { 2245 sc := -1 2246 if iter.Response().Response.Response != nil { 2247 sc = iter.Response().Response.Response.StatusCode 2248 } 2249 tracing.EndSpan(ctx, sc, err) 2250 }() 2251 } 2252 iter.i++ 2253 if iter.i < len(iter.page.Values()) { 2254 return nil 2255 } 2256 err = iter.page.NextWithContext(ctx) 2257 if err != nil { 2258 iter.i-- 2259 return err 2260 } 2261 iter.i = 0 2262 return nil 2263} 2264 2265// Next advances to the next value. If there was an error making 2266// the request the iterator does not advance and the error is returned. 2267// Deprecated: Use NextWithContext() instead. 2268func (iter *ServiceProviderListResultIterator) Next() error { 2269 return iter.NextWithContext(context.Background()) 2270} 2271 2272// NotDone returns true if the enumeration should be started or is not yet complete. 2273func (iter ServiceProviderListResultIterator) NotDone() bool { 2274 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2275} 2276 2277// Response returns the raw server response from the last page request. 2278func (iter ServiceProviderListResultIterator) Response() ServiceProviderListResult { 2279 return iter.page.Response() 2280} 2281 2282// Value returns the current value or a zero-initialized value if the 2283// iterator has advanced beyond the end of the collection. 2284func (iter ServiceProviderListResultIterator) Value() ServiceProvider { 2285 if !iter.page.NotDone() { 2286 return ServiceProvider{} 2287 } 2288 return iter.page.Values()[iter.i] 2289} 2290 2291// Creates a new instance of the ServiceProviderListResultIterator type. 2292func NewServiceProviderListResultIterator(page ServiceProviderListResultPage) ServiceProviderListResultIterator { 2293 return ServiceProviderListResultIterator{page: page} 2294} 2295 2296// IsEmpty returns true if the ListResult contains no values. 2297func (splr ServiceProviderListResult) IsEmpty() bool { 2298 return splr.Value == nil || len(*splr.Value) == 0 2299} 2300 2301// serviceProviderListResultPreparer prepares a request to retrieve the next set of results. 2302// It returns nil if no more results exist. 2303func (splr ServiceProviderListResult) serviceProviderListResultPreparer(ctx context.Context) (*http.Request, error) { 2304 if splr.NextLink == nil || len(to.String(splr.NextLink)) < 1 { 2305 return nil, nil 2306 } 2307 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2308 autorest.AsJSON(), 2309 autorest.AsGet(), 2310 autorest.WithBaseURL(to.String(splr.NextLink))) 2311} 2312 2313// ServiceProviderListResultPage contains a page of ServiceProvider values. 2314type ServiceProviderListResultPage struct { 2315 fn func(context.Context, ServiceProviderListResult) (ServiceProviderListResult, error) 2316 splr ServiceProviderListResult 2317} 2318 2319// NextWithContext advances to the next page of values. If there was an error making 2320// the request the page does not advance and the error is returned. 2321func (page *ServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) { 2322 if tracing.IsEnabled() { 2323 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceProviderListResultPage.NextWithContext") 2324 defer func() { 2325 sc := -1 2326 if page.Response().Response.Response != nil { 2327 sc = page.Response().Response.Response.StatusCode 2328 } 2329 tracing.EndSpan(ctx, sc, err) 2330 }() 2331 } 2332 next, err := page.fn(ctx, page.splr) 2333 if err != nil { 2334 return err 2335 } 2336 page.splr = next 2337 return nil 2338} 2339 2340// Next advances to the next page of values. If there was an error making 2341// the request the page does not advance and the error is returned. 2342// Deprecated: Use NextWithContext() instead. 2343func (page *ServiceProviderListResultPage) Next() error { 2344 return page.NextWithContext(context.Background()) 2345} 2346 2347// NotDone returns true if the page enumeration should be started or is not yet complete. 2348func (page ServiceProviderListResultPage) NotDone() bool { 2349 return !page.splr.IsEmpty() 2350} 2351 2352// Response returns the raw server response from the last page request. 2353func (page ServiceProviderListResultPage) Response() ServiceProviderListResult { 2354 return page.splr 2355} 2356 2357// Values returns the slice of values for the current page or nil if there are no values. 2358func (page ServiceProviderListResultPage) Values() []ServiceProvider { 2359 if page.splr.IsEmpty() { 2360 return nil 2361 } 2362 return *page.splr.Value 2363} 2364 2365// Creates a new instance of the ServiceProviderListResultPage type. 2366func NewServiceProviderListResultPage(getNextPage func(context.Context, ServiceProviderListResult) (ServiceProviderListResult, error)) ServiceProviderListResultPage { 2367 return ServiceProviderListResultPage{fn: getNextPage} 2368} 2369 2370// ServiceProviderProperties the properties that define connectivity to the Peering Service Provider. 2371type ServiceProviderProperties struct { 2372 // ServiceProviderName - The name of the service provider. 2373 ServiceProviderName *string `json:"serviceProviderName,omitempty"` 2374} 2375 2376// Sku the SKU that defines the tier and kind of the peering. 2377type Sku struct { 2378 // Name - The name of the peering SKU. Possible values include: 'BasicExchangeFree', 'BasicDirectFree', 'PremiumDirectFree', 'PremiumExchangeMetered', 'PremiumDirectMetered', 'PremiumDirectUnlimited' 2379 Name Name `json:"name,omitempty"` 2380 // Tier - The tier of the peering SKU. Possible values include: 'Basic', 'Premium' 2381 Tier Tier `json:"tier,omitempty"` 2382 // Family - The family of the peering SKU. Possible values include: 'Direct', 'Exchange' 2383 Family Family `json:"family,omitempty"` 2384 // Size - The size of the peering SKU. Possible values include: 'Free', 'Metered', 'Unlimited' 2385 Size Size `json:"size,omitempty"` 2386} 2387 2388// String ... 2389type String struct { 2390 autorest.Response `json:"-"` 2391 // Value - Possible values include: 'Available', 'UnAvailable' 2392 Value *string `json:"value,omitempty"` 2393} 2394 2395// SubResource the sub resource. 2396type SubResource struct { 2397 // ID - The identifier of the referenced resource. 2398 ID *string `json:"id,omitempty"` 2399} 2400