1package peering 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/date" 14 "github.com/Azure/go-autorest/autorest/to" 15 "github.com/Azure/go-autorest/tracing" 16 "net/http" 17) 18 19// The package's fully qualified name. 20const fqdn = "github.com/Azure/azure-sdk-for-go/services/peering/mgmt/2020-10-01/peering" 21 22// BandwidthOffer the properties that define a peering bandwidth offer. 23type BandwidthOffer struct { 24 // OfferName - The name of the bandwidth offer. 25 OfferName *string `json:"offerName,omitempty"` 26 // ValueInMbps - The value of the bandwidth offer in Mbps. 27 ValueInMbps *int32 `json:"valueInMbps,omitempty"` 28} 29 30// BgpSession the properties that define a BGP session. 31type BgpSession struct { 32 // SessionPrefixV4 - The IPv4 prefix that contains both ends' IPv4 addresses. 33 SessionPrefixV4 *string `json:"sessionPrefixV4,omitempty"` 34 // SessionPrefixV6 - The IPv6 prefix that contains both ends' IPv6 addresses. 35 SessionPrefixV6 *string `json:"sessionPrefixV6,omitempty"` 36 // MicrosoftSessionIPv4Address - The IPv4 session address on Microsoft's end. 37 MicrosoftSessionIPv4Address *string `json:"microsoftSessionIPv4Address,omitempty"` 38 // MicrosoftSessionIPv6Address - The IPv6 session address on Microsoft's end. 39 MicrosoftSessionIPv6Address *string `json:"microsoftSessionIPv6Address,omitempty"` 40 // PeerSessionIPv4Address - The IPv4 session address on peer's end. 41 PeerSessionIPv4Address *string `json:"peerSessionIPv4Address,omitempty"` 42 // PeerSessionIPv6Address - The IPv6 session address on peer's end. 43 PeerSessionIPv6Address *string `json:"peerSessionIPv6Address,omitempty"` 44 // SessionStateV4 - READ-ONLY; The state of the IPv4 session. Possible values include: 'SessionStateV4None', 'SessionStateV4Idle', 'SessionStateV4Connect', 'SessionStateV4Active', 'SessionStateV4OpenSent', 'SessionStateV4OpenConfirm', 'SessionStateV4OpenReceived', 'SessionStateV4Established', 'SessionStateV4PendingAdd', 'SessionStateV4PendingUpdate', 'SessionStateV4PendingRemove' 45 SessionStateV4 SessionStateV4 `json:"sessionStateV4,omitempty"` 46 // SessionStateV6 - READ-ONLY; The state of the IPv6 session. Possible values include: 'SessionStateV6None', 'SessionStateV6Idle', 'SessionStateV6Connect', 'SessionStateV6Active', 'SessionStateV6OpenSent', 'SessionStateV6OpenConfirm', 'SessionStateV6OpenReceived', 'SessionStateV6Established', 'SessionStateV6PendingAdd', 'SessionStateV6PendingUpdate', 'SessionStateV6PendingRemove' 47 SessionStateV6 SessionStateV6 `json:"sessionStateV6,omitempty"` 48 // MaxPrefixesAdvertisedV4 - The maximum number of prefixes advertised over the IPv4 session. 49 MaxPrefixesAdvertisedV4 *int32 `json:"maxPrefixesAdvertisedV4,omitempty"` 50 // MaxPrefixesAdvertisedV6 - The maximum number of prefixes advertised over the IPv6 session. 51 MaxPrefixesAdvertisedV6 *int32 `json:"maxPrefixesAdvertisedV6,omitempty"` 52 // Md5AuthenticationKey - The MD5 authentication key of the session. 53 Md5AuthenticationKey *string `json:"md5AuthenticationKey,omitempty"` 54} 55 56// MarshalJSON is the custom marshaler for BgpSession. 57func (bs BgpSession) MarshalJSON() ([]byte, error) { 58 objectMap := make(map[string]interface{}) 59 if bs.SessionPrefixV4 != nil { 60 objectMap["sessionPrefixV4"] = bs.SessionPrefixV4 61 } 62 if bs.SessionPrefixV6 != nil { 63 objectMap["sessionPrefixV6"] = bs.SessionPrefixV6 64 } 65 if bs.MicrosoftSessionIPv4Address != nil { 66 objectMap["microsoftSessionIPv4Address"] = bs.MicrosoftSessionIPv4Address 67 } 68 if bs.MicrosoftSessionIPv6Address != nil { 69 objectMap["microsoftSessionIPv6Address"] = bs.MicrosoftSessionIPv6Address 70 } 71 if bs.PeerSessionIPv4Address != nil { 72 objectMap["peerSessionIPv4Address"] = bs.PeerSessionIPv4Address 73 } 74 if bs.PeerSessionIPv6Address != nil { 75 objectMap["peerSessionIPv6Address"] = bs.PeerSessionIPv6Address 76 } 77 if bs.MaxPrefixesAdvertisedV4 != nil { 78 objectMap["maxPrefixesAdvertisedV4"] = bs.MaxPrefixesAdvertisedV4 79 } 80 if bs.MaxPrefixesAdvertisedV6 != nil { 81 objectMap["maxPrefixesAdvertisedV6"] = bs.MaxPrefixesAdvertisedV6 82 } 83 if bs.Md5AuthenticationKey != nil { 84 objectMap["md5AuthenticationKey"] = bs.Md5AuthenticationKey 85 } 86 return json.Marshal(objectMap) 87} 88 89// CdnPeeringPrefix the CDN peering prefix 90type CdnPeeringPrefix struct { 91 // CdnPeeringPrefixProperties - The properties that define a cdn peering prefix. 92 *CdnPeeringPrefixProperties `json:"properties,omitempty"` 93 // Name - READ-ONLY; The name of the resource. 94 Name *string `json:"name,omitempty"` 95 // ID - READ-ONLY; The ID of the resource. 96 ID *string `json:"id,omitempty"` 97 // Type - READ-ONLY; The type of the resource. 98 Type *string `json:"type,omitempty"` 99} 100 101// MarshalJSON is the custom marshaler for CdnPeeringPrefix. 102func (cpp CdnPeeringPrefix) MarshalJSON() ([]byte, error) { 103 objectMap := make(map[string]interface{}) 104 if cpp.CdnPeeringPrefixProperties != nil { 105 objectMap["properties"] = cpp.CdnPeeringPrefixProperties 106 } 107 return json.Marshal(objectMap) 108} 109 110// UnmarshalJSON is the custom unmarshaler for CdnPeeringPrefix struct. 111func (cpp *CdnPeeringPrefix) UnmarshalJSON(body []byte) error { 112 var m map[string]*json.RawMessage 113 err := json.Unmarshal(body, &m) 114 if err != nil { 115 return err 116 } 117 for k, v := range m { 118 switch k { 119 case "properties": 120 if v != nil { 121 var cdnPeeringPrefixProperties CdnPeeringPrefixProperties 122 err = json.Unmarshal(*v, &cdnPeeringPrefixProperties) 123 if err != nil { 124 return err 125 } 126 cpp.CdnPeeringPrefixProperties = &cdnPeeringPrefixProperties 127 } 128 case "name": 129 if v != nil { 130 var name string 131 err = json.Unmarshal(*v, &name) 132 if err != nil { 133 return err 134 } 135 cpp.Name = &name 136 } 137 case "id": 138 if v != nil { 139 var ID string 140 err = json.Unmarshal(*v, &ID) 141 if err != nil { 142 return err 143 } 144 cpp.ID = &ID 145 } 146 case "type": 147 if v != nil { 148 var typeVar string 149 err = json.Unmarshal(*v, &typeVar) 150 if err != nil { 151 return err 152 } 153 cpp.Type = &typeVar 154 } 155 } 156 } 157 158 return nil 159} 160 161// CdnPeeringPrefixListResult the paginated list of CDN peering prefixes. 162type CdnPeeringPrefixListResult struct { 163 autorest.Response `json:"-"` 164 // Value - The list of CDN peering prefixes. 165 Value *[]CdnPeeringPrefix `json:"value,omitempty"` 166 // NextLink - The link to fetch the next page of CDN peering prefixes. 167 NextLink *string `json:"nextLink,omitempty"` 168} 169 170// CdnPeeringPrefixListResultIterator provides access to a complete listing of CdnPeeringPrefix values. 171type CdnPeeringPrefixListResultIterator struct { 172 i int 173 page CdnPeeringPrefixListResultPage 174} 175 176// NextWithContext advances to the next value. If there was an error making 177// the request the iterator does not advance and the error is returned. 178func (iter *CdnPeeringPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { 179 if tracing.IsEnabled() { 180 ctx = tracing.StartSpan(ctx, fqdn+"/CdnPeeringPrefixListResultIterator.NextWithContext") 181 defer func() { 182 sc := -1 183 if iter.Response().Response.Response != nil { 184 sc = iter.Response().Response.Response.StatusCode 185 } 186 tracing.EndSpan(ctx, sc, err) 187 }() 188 } 189 iter.i++ 190 if iter.i < len(iter.page.Values()) { 191 return nil 192 } 193 err = iter.page.NextWithContext(ctx) 194 if err != nil { 195 iter.i-- 196 return err 197 } 198 iter.i = 0 199 return nil 200} 201 202// Next advances to the next value. If there was an error making 203// the request the iterator does not advance and the error is returned. 204// Deprecated: Use NextWithContext() instead. 205func (iter *CdnPeeringPrefixListResultIterator) Next() error { 206 return iter.NextWithContext(context.Background()) 207} 208 209// NotDone returns true if the enumeration should be started or is not yet complete. 210func (iter CdnPeeringPrefixListResultIterator) NotDone() bool { 211 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 212} 213 214// Response returns the raw server response from the last page request. 215func (iter CdnPeeringPrefixListResultIterator) Response() CdnPeeringPrefixListResult { 216 return iter.page.Response() 217} 218 219// Value returns the current value or a zero-initialized value if the 220// iterator has advanced beyond the end of the collection. 221func (iter CdnPeeringPrefixListResultIterator) Value() CdnPeeringPrefix { 222 if !iter.page.NotDone() { 223 return CdnPeeringPrefix{} 224 } 225 return iter.page.Values()[iter.i] 226} 227 228// Creates a new instance of the CdnPeeringPrefixListResultIterator type. 229func NewCdnPeeringPrefixListResultIterator(page CdnPeeringPrefixListResultPage) CdnPeeringPrefixListResultIterator { 230 return CdnPeeringPrefixListResultIterator{page: page} 231} 232 233// IsEmpty returns true if the ListResult contains no values. 234func (cpplr CdnPeeringPrefixListResult) IsEmpty() bool { 235 return cpplr.Value == nil || len(*cpplr.Value) == 0 236} 237 238// hasNextLink returns true if the NextLink is not empty. 239func (cpplr CdnPeeringPrefixListResult) hasNextLink() bool { 240 return cpplr.NextLink != nil && len(*cpplr.NextLink) != 0 241} 242 243// cdnPeeringPrefixListResultPreparer prepares a request to retrieve the next set of results. 244// It returns nil if no more results exist. 245func (cpplr CdnPeeringPrefixListResult) cdnPeeringPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { 246 if !cpplr.hasNextLink() { 247 return nil, nil 248 } 249 return autorest.Prepare((&http.Request{}).WithContext(ctx), 250 autorest.AsJSON(), 251 autorest.AsGet(), 252 autorest.WithBaseURL(to.String(cpplr.NextLink))) 253} 254 255// CdnPeeringPrefixListResultPage contains a page of CdnPeeringPrefix values. 256type CdnPeeringPrefixListResultPage struct { 257 fn func(context.Context, CdnPeeringPrefixListResult) (CdnPeeringPrefixListResult, error) 258 cpplr CdnPeeringPrefixListResult 259} 260 261// NextWithContext advances to the next page of values. If there was an error making 262// the request the page does not advance and the error is returned. 263func (page *CdnPeeringPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { 264 if tracing.IsEnabled() { 265 ctx = tracing.StartSpan(ctx, fqdn+"/CdnPeeringPrefixListResultPage.NextWithContext") 266 defer func() { 267 sc := -1 268 if page.Response().Response.Response != nil { 269 sc = page.Response().Response.Response.StatusCode 270 } 271 tracing.EndSpan(ctx, sc, err) 272 }() 273 } 274 for { 275 next, err := page.fn(ctx, page.cpplr) 276 if err != nil { 277 return err 278 } 279 page.cpplr = next 280 if !next.hasNextLink() || !next.IsEmpty() { 281 break 282 } 283 } 284 return nil 285} 286 287// Next advances to the next page of values. If there was an error making 288// the request the page does not advance and the error is returned. 289// Deprecated: Use NextWithContext() instead. 290func (page *CdnPeeringPrefixListResultPage) Next() error { 291 return page.NextWithContext(context.Background()) 292} 293 294// NotDone returns true if the page enumeration should be started or is not yet complete. 295func (page CdnPeeringPrefixListResultPage) NotDone() bool { 296 return !page.cpplr.IsEmpty() 297} 298 299// Response returns the raw server response from the last page request. 300func (page CdnPeeringPrefixListResultPage) Response() CdnPeeringPrefixListResult { 301 return page.cpplr 302} 303 304// Values returns the slice of values for the current page or nil if there are no values. 305func (page CdnPeeringPrefixListResultPage) Values() []CdnPeeringPrefix { 306 if page.cpplr.IsEmpty() { 307 return nil 308 } 309 return *page.cpplr.Value 310} 311 312// Creates a new instance of the CdnPeeringPrefixListResultPage type. 313func NewCdnPeeringPrefixListResultPage(cur CdnPeeringPrefixListResult, getNextPage func(context.Context, CdnPeeringPrefixListResult) (CdnPeeringPrefixListResult, error)) CdnPeeringPrefixListResultPage { 314 return CdnPeeringPrefixListResultPage{ 315 fn: getNextPage, 316 cpplr: cur, 317 } 318} 319 320// CdnPeeringPrefixProperties the properties that define a CDN peering prefix 321type CdnPeeringPrefixProperties struct { 322 // Prefix - READ-ONLY; The prefix. 323 Prefix *string `json:"prefix,omitempty"` 324 // AzureRegion - READ-ONLY; The Azure region. 325 AzureRegion *string `json:"azureRegion,omitempty"` 326 // AzureService - READ-ONLY; The Azure service. 327 AzureService *string `json:"azureService,omitempty"` 328 // IsPrimaryRegion - READ-ONLY; The flag that indicates whether or not this is the primary region. 329 IsPrimaryRegion *bool `json:"isPrimaryRegion,omitempty"` 330 // BgpCommunity - READ-ONLY; The BGP Community 331 BgpCommunity *string `json:"bgpCommunity,omitempty"` 332} 333 334// MarshalJSON is the custom marshaler for CdnPeeringPrefixProperties. 335func (cppp CdnPeeringPrefixProperties) MarshalJSON() ([]byte, error) { 336 objectMap := make(map[string]interface{}) 337 return json.Marshal(objectMap) 338} 339 340// CheckServiceProviderAvailabilityInput class for CheckServiceProviderAvailabilityInput 341type CheckServiceProviderAvailabilityInput struct { 342 // PeeringServiceLocation - Gets or sets the peering service location. 343 PeeringServiceLocation *string `json:"peeringServiceLocation,omitempty"` 344 // PeeringServiceProvider - Gets or sets the peering service provider. 345 PeeringServiceProvider *string `json:"peeringServiceProvider,omitempty"` 346} 347 348// ContactDetail the contact detail class. 349type ContactDetail struct { 350 // Role - The role of the contact. Possible values include: 'RoleNoc', 'RolePolicy', 'RoleTechnical', 'RoleService', 'RoleEscalation', 'RoleOther' 351 Role Role `json:"role,omitempty"` 352 // Email - The e-mail address of the contact. 353 Email *string `json:"email,omitempty"` 354 // Phone - The phone number of the contact. 355 Phone *string `json:"phone,omitempty"` 356} 357 358// DirectConnection the properties that define a direct connection. 359type DirectConnection struct { 360 // BandwidthInMbps - The bandwidth of the connection. 361 BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` 362 // ProvisionedBandwidthInMbps - READ-ONLY; The bandwidth that is actually provisioned. 363 ProvisionedBandwidthInMbps *int32 `json:"provisionedBandwidthInMbps,omitempty"` 364 // SessionAddressProvider - The field indicating if Microsoft provides session ip addresses. Possible values include: 'Microsoft', 'Peer' 365 SessionAddressProvider SessionAddressProvider `json:"sessionAddressProvider,omitempty"` 366 // UseForPeeringService - The flag that indicates whether or not the connection is used for peering service. 367 UseForPeeringService *bool `json:"useForPeeringService,omitempty"` 368 // MicrosoftTrackingID - READ-ONLY; The ID used within Microsoft's peering provisioning system to track the connection 369 MicrosoftTrackingID *string `json:"microsoftTrackingId,omitempty"` 370 // PeeringDBFacilityID - The PeeringDB.com ID of the facility at which the connection has to be set up. 371 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 372 // ConnectionState - READ-ONLY; The state of the connection. Possible values include: 'None', 'PendingApproval', 'Approved', 'ProvisioningStarted', 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active' 373 ConnectionState ConnectionState `json:"connectionState,omitempty"` 374 // BgpSession - The BGP session associated with the connection. 375 BgpSession *BgpSession `json:"bgpSession,omitempty"` 376 // ConnectionIdentifier - The unique identifier (GUID) for the connection. 377 ConnectionIdentifier *string `json:"connectionIdentifier,omitempty"` 378 // ErrorMessage - READ-ONLY; The error message related to the connection state, if any. 379 ErrorMessage *string `json:"errorMessage,omitempty"` 380} 381 382// MarshalJSON is the custom marshaler for DirectConnection. 383func (dc DirectConnection) MarshalJSON() ([]byte, error) { 384 objectMap := make(map[string]interface{}) 385 if dc.BandwidthInMbps != nil { 386 objectMap["bandwidthInMbps"] = dc.BandwidthInMbps 387 } 388 if dc.SessionAddressProvider != "" { 389 objectMap["sessionAddressProvider"] = dc.SessionAddressProvider 390 } 391 if dc.UseForPeeringService != nil { 392 objectMap["useForPeeringService"] = dc.UseForPeeringService 393 } 394 if dc.PeeringDBFacilityID != nil { 395 objectMap["peeringDBFacilityId"] = dc.PeeringDBFacilityID 396 } 397 if dc.BgpSession != nil { 398 objectMap["bgpSession"] = dc.BgpSession 399 } 400 if dc.ConnectionIdentifier != nil { 401 objectMap["connectionIdentifier"] = dc.ConnectionIdentifier 402 } 403 return json.Marshal(objectMap) 404} 405 406// DirectPeeringFacility the properties that define a direct peering facility. 407type DirectPeeringFacility struct { 408 // Address - The address of the direct peering facility. 409 Address *string `json:"address,omitempty"` 410 // DirectPeeringType - The type of the direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' 411 DirectPeeringType DirectPeeringType `json:"directPeeringType,omitempty"` 412 // PeeringDBFacilityID - The PeeringDB.com ID of the facility. 413 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 414 // PeeringDBFacilityLink - The PeeringDB.com URL of the facility. 415 PeeringDBFacilityLink *string `json:"peeringDBFacilityLink,omitempty"` 416} 417 418// ErrorDetail the error detail that describes why an operation has failed. 419type ErrorDetail struct { 420 // Code - READ-ONLY; The error code. 421 Code *string `json:"code,omitempty"` 422 // Message - READ-ONLY; The error message. 423 Message *string `json:"message,omitempty"` 424} 425 426// MarshalJSON is the custom marshaler for ErrorDetail. 427func (ed ErrorDetail) MarshalJSON() ([]byte, error) { 428 objectMap := make(map[string]interface{}) 429 return json.Marshal(objectMap) 430} 431 432// ErrorResponse the error response that indicates why an operation has failed. 433type ErrorResponse struct { 434 // Error - The error detail that describes why an operation has failed. 435 Error *ErrorDetail `json:"error,omitempty"` 436} 437 438// ExchangeConnection the properties that define an exchange connection. 439type ExchangeConnection struct { 440 // PeeringDBFacilityID - The PeeringDB.com ID of the facility at which the connection has to be set up. 441 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 442 // ConnectionState - READ-ONLY; The state of the connection. Possible values include: 'None', 'PendingApproval', 'Approved', 'ProvisioningStarted', 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active' 443 ConnectionState ConnectionState `json:"connectionState,omitempty"` 444 // BgpSession - The BGP session associated with the connection. 445 BgpSession *BgpSession `json:"bgpSession,omitempty"` 446 // ConnectionIdentifier - The unique identifier (GUID) for the connection. 447 ConnectionIdentifier *string `json:"connectionIdentifier,omitempty"` 448 // ErrorMessage - READ-ONLY; The error message related to the connection state, if any. 449 ErrorMessage *string `json:"errorMessage,omitempty"` 450} 451 452// MarshalJSON is the custom marshaler for ExchangeConnection. 453func (ec ExchangeConnection) MarshalJSON() ([]byte, error) { 454 objectMap := make(map[string]interface{}) 455 if ec.PeeringDBFacilityID != nil { 456 objectMap["peeringDBFacilityId"] = ec.PeeringDBFacilityID 457 } 458 if ec.BgpSession != nil { 459 objectMap["bgpSession"] = ec.BgpSession 460 } 461 if ec.ConnectionIdentifier != nil { 462 objectMap["connectionIdentifier"] = ec.ConnectionIdentifier 463 } 464 return json.Marshal(objectMap) 465} 466 467// ExchangePeeringFacility the properties that define an exchange peering facility. 468type ExchangePeeringFacility struct { 469 // ExchangeName - The name of the exchange peering facility. 470 ExchangeName *string `json:"exchangeName,omitempty"` 471 // BandwidthInMbps - The bandwidth of the connection between Microsoft and the exchange peering facility. 472 BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` 473 // MicrosoftIPv4Address - The IPv4 address of Microsoft at the exchange peering facility. 474 MicrosoftIPv4Address *string `json:"microsoftIPv4Address,omitempty"` 475 // MicrosoftIPv6Address - The IPv6 address of Microsoft at the exchange peering facility. 476 MicrosoftIPv6Address *string `json:"microsoftIPv6Address,omitempty"` 477 // FacilityIPv4Prefix - The IPv4 prefixes associated with the exchange peering facility. 478 FacilityIPv4Prefix *string `json:"facilityIPv4Prefix,omitempty"` 479 // FacilityIPv6Prefix - The IPv6 prefixes associated with the exchange peering facility. 480 FacilityIPv6Prefix *string `json:"facilityIPv6Prefix,omitempty"` 481 // PeeringDBFacilityID - The PeeringDB.com ID of the facility. 482 PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` 483 // PeeringDBFacilityLink - The PeeringDB.com URL of the facility. 484 PeeringDBFacilityLink *string `json:"peeringDBFacilityLink,omitempty"` 485} 486 487// ListResult the paginated list of peerings. 488type ListResult struct { 489 autorest.Response `json:"-"` 490 // Value - The list of peerings. 491 Value *[]Model `json:"value,omitempty"` 492 // NextLink - The link to fetch the next page of peerings. 493 NextLink *string `json:"nextLink,omitempty"` 494} 495 496// ListResultIterator provides access to a complete listing of Model values. 497type ListResultIterator struct { 498 i int 499 page ListResultPage 500} 501 502// NextWithContext advances to the next value. If there was an error making 503// the request the iterator does not advance and the error is returned. 504func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 505 if tracing.IsEnabled() { 506 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 507 defer func() { 508 sc := -1 509 if iter.Response().Response.Response != nil { 510 sc = iter.Response().Response.Response.StatusCode 511 } 512 tracing.EndSpan(ctx, sc, err) 513 }() 514 } 515 iter.i++ 516 if iter.i < len(iter.page.Values()) { 517 return nil 518 } 519 err = iter.page.NextWithContext(ctx) 520 if err != nil { 521 iter.i-- 522 return err 523 } 524 iter.i = 0 525 return nil 526} 527 528// Next advances to the next value. If there was an error making 529// the request the iterator does not advance and the error is returned. 530// Deprecated: Use NextWithContext() instead. 531func (iter *ListResultIterator) Next() error { 532 return iter.NextWithContext(context.Background()) 533} 534 535// NotDone returns true if the enumeration should be started or is not yet complete. 536func (iter ListResultIterator) NotDone() bool { 537 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 538} 539 540// Response returns the raw server response from the last page request. 541func (iter ListResultIterator) Response() ListResult { 542 return iter.page.Response() 543} 544 545// Value returns the current value or a zero-initialized value if the 546// iterator has advanced beyond the end of the collection. 547func (iter ListResultIterator) Value() Model { 548 if !iter.page.NotDone() { 549 return Model{} 550 } 551 return iter.page.Values()[iter.i] 552} 553 554// Creates a new instance of the ListResultIterator type. 555func NewListResultIterator(page ListResultPage) ListResultIterator { 556 return ListResultIterator{page: page} 557} 558 559// IsEmpty returns true if the ListResult contains no values. 560func (lr ListResult) IsEmpty() bool { 561 return lr.Value == nil || len(*lr.Value) == 0 562} 563 564// hasNextLink returns true if the NextLink is not empty. 565func (lr ListResult) hasNextLink() bool { 566 return lr.NextLink != nil && len(*lr.NextLink) != 0 567} 568 569// listResultPreparer prepares a request to retrieve the next set of results. 570// It returns nil if no more results exist. 571func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 572 if !lr.hasNextLink() { 573 return nil, nil 574 } 575 return autorest.Prepare((&http.Request{}).WithContext(ctx), 576 autorest.AsJSON(), 577 autorest.AsGet(), 578 autorest.WithBaseURL(to.String(lr.NextLink))) 579} 580 581// ListResultPage contains a page of Model values. 582type ListResultPage struct { 583 fn func(context.Context, ListResult) (ListResult, error) 584 lr ListResult 585} 586 587// NextWithContext advances to the next page of values. If there was an error making 588// the request the page does not advance and the error is returned. 589func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 590 if tracing.IsEnabled() { 591 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 592 defer func() { 593 sc := -1 594 if page.Response().Response.Response != nil { 595 sc = page.Response().Response.Response.StatusCode 596 } 597 tracing.EndSpan(ctx, sc, err) 598 }() 599 } 600 for { 601 next, err := page.fn(ctx, page.lr) 602 if err != nil { 603 return err 604 } 605 page.lr = next 606 if !next.hasNextLink() || !next.IsEmpty() { 607 break 608 } 609 } 610 return nil 611} 612 613// Next advances to the next page of values. If there was an error making 614// the request the page does not advance and the error is returned. 615// Deprecated: Use NextWithContext() instead. 616func (page *ListResultPage) Next() error { 617 return page.NextWithContext(context.Background()) 618} 619 620// NotDone returns true if the page enumeration should be started or is not yet complete. 621func (page ListResultPage) NotDone() bool { 622 return !page.lr.IsEmpty() 623} 624 625// Response returns the raw server response from the last page request. 626func (page ListResultPage) Response() ListResult { 627 return page.lr 628} 629 630// Values returns the slice of values for the current page or nil if there are no values. 631func (page ListResultPage) Values() []Model { 632 if page.lr.IsEmpty() { 633 return nil 634 } 635 return *page.lr.Value 636} 637 638// Creates a new instance of the ListResultPage type. 639func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 640 return ListResultPage{ 641 fn: getNextPage, 642 lr: cur, 643 } 644} 645 646// Location peering location is where connectivity could be established to the Microsoft Cloud Edge. 647type Location struct { 648 // Kind - The kind of peering that the peering location supports. Possible values include: 'KindDirect', 'KindExchange' 649 Kind Kind `json:"kind,omitempty"` 650 // LocationProperties - The properties that define a peering location. 651 *LocationProperties `json:"properties,omitempty"` 652 // Name - READ-ONLY; The name of the resource. 653 Name *string `json:"name,omitempty"` 654 // ID - READ-ONLY; The ID of the resource. 655 ID *string `json:"id,omitempty"` 656 // Type - READ-ONLY; The type of the resource. 657 Type *string `json:"type,omitempty"` 658} 659 660// MarshalJSON is the custom marshaler for Location. 661func (l Location) MarshalJSON() ([]byte, error) { 662 objectMap := make(map[string]interface{}) 663 if l.Kind != "" { 664 objectMap["kind"] = l.Kind 665 } 666 if l.LocationProperties != nil { 667 objectMap["properties"] = l.LocationProperties 668 } 669 return json.Marshal(objectMap) 670} 671 672// UnmarshalJSON is the custom unmarshaler for Location struct. 673func (l *Location) UnmarshalJSON(body []byte) error { 674 var m map[string]*json.RawMessage 675 err := json.Unmarshal(body, &m) 676 if err != nil { 677 return err 678 } 679 for k, v := range m { 680 switch k { 681 case "kind": 682 if v != nil { 683 var kind Kind 684 err = json.Unmarshal(*v, &kind) 685 if err != nil { 686 return err 687 } 688 l.Kind = kind 689 } 690 case "properties": 691 if v != nil { 692 var locationProperties LocationProperties 693 err = json.Unmarshal(*v, &locationProperties) 694 if err != nil { 695 return err 696 } 697 l.LocationProperties = &locationProperties 698 } 699 case "name": 700 if v != nil { 701 var name string 702 err = json.Unmarshal(*v, &name) 703 if err != nil { 704 return err 705 } 706 l.Name = &name 707 } 708 case "id": 709 if v != nil { 710 var ID string 711 err = json.Unmarshal(*v, &ID) 712 if err != nil { 713 return err 714 } 715 l.ID = &ID 716 } 717 case "type": 718 if v != nil { 719 var typeVar string 720 err = json.Unmarshal(*v, &typeVar) 721 if err != nil { 722 return err 723 } 724 l.Type = &typeVar 725 } 726 } 727 } 728 729 return nil 730} 731 732// LocationListResult the paginated list of peering locations. 733type LocationListResult struct { 734 autorest.Response `json:"-"` 735 // Value - The list of peering locations. 736 Value *[]Location `json:"value,omitempty"` 737 // NextLink - The link to fetch the next page of peering locations. 738 NextLink *string `json:"nextLink,omitempty"` 739} 740 741// LocationListResultIterator provides access to a complete listing of Location values. 742type LocationListResultIterator struct { 743 i int 744 page LocationListResultPage 745} 746 747// NextWithContext advances to the next value. If there was an error making 748// the request the iterator does not advance and the error is returned. 749func (iter *LocationListResultIterator) NextWithContext(ctx context.Context) (err error) { 750 if tracing.IsEnabled() { 751 ctx = tracing.StartSpan(ctx, fqdn+"/LocationListResultIterator.NextWithContext") 752 defer func() { 753 sc := -1 754 if iter.Response().Response.Response != nil { 755 sc = iter.Response().Response.Response.StatusCode 756 } 757 tracing.EndSpan(ctx, sc, err) 758 }() 759 } 760 iter.i++ 761 if iter.i < len(iter.page.Values()) { 762 return nil 763 } 764 err = iter.page.NextWithContext(ctx) 765 if err != nil { 766 iter.i-- 767 return err 768 } 769 iter.i = 0 770 return nil 771} 772 773// Next advances to the next value. If there was an error making 774// the request the iterator does not advance and the error is returned. 775// Deprecated: Use NextWithContext() instead. 776func (iter *LocationListResultIterator) Next() error { 777 return iter.NextWithContext(context.Background()) 778} 779 780// NotDone returns true if the enumeration should be started or is not yet complete. 781func (iter LocationListResultIterator) NotDone() bool { 782 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 783} 784 785// Response returns the raw server response from the last page request. 786func (iter LocationListResultIterator) Response() LocationListResult { 787 return iter.page.Response() 788} 789 790// Value returns the current value or a zero-initialized value if the 791// iterator has advanced beyond the end of the collection. 792func (iter LocationListResultIterator) Value() Location { 793 if !iter.page.NotDone() { 794 return Location{} 795 } 796 return iter.page.Values()[iter.i] 797} 798 799// Creates a new instance of the LocationListResultIterator type. 800func NewLocationListResultIterator(page LocationListResultPage) LocationListResultIterator { 801 return LocationListResultIterator{page: page} 802} 803 804// IsEmpty returns true if the ListResult contains no values. 805func (llr LocationListResult) IsEmpty() bool { 806 return llr.Value == nil || len(*llr.Value) == 0 807} 808 809// hasNextLink returns true if the NextLink is not empty. 810func (llr LocationListResult) hasNextLink() bool { 811 return llr.NextLink != nil && len(*llr.NextLink) != 0 812} 813 814// locationListResultPreparer prepares a request to retrieve the next set of results. 815// It returns nil if no more results exist. 816func (llr LocationListResult) locationListResultPreparer(ctx context.Context) (*http.Request, error) { 817 if !llr.hasNextLink() { 818 return nil, nil 819 } 820 return autorest.Prepare((&http.Request{}).WithContext(ctx), 821 autorest.AsJSON(), 822 autorest.AsGet(), 823 autorest.WithBaseURL(to.String(llr.NextLink))) 824} 825 826// LocationListResultPage contains a page of Location values. 827type LocationListResultPage struct { 828 fn func(context.Context, LocationListResult) (LocationListResult, error) 829 llr LocationListResult 830} 831 832// NextWithContext advances to the next page of values. If there was an error making 833// the request the page does not advance and the error is returned. 834func (page *LocationListResultPage) NextWithContext(ctx context.Context) (err error) { 835 if tracing.IsEnabled() { 836 ctx = tracing.StartSpan(ctx, fqdn+"/LocationListResultPage.NextWithContext") 837 defer func() { 838 sc := -1 839 if page.Response().Response.Response != nil { 840 sc = page.Response().Response.Response.StatusCode 841 } 842 tracing.EndSpan(ctx, sc, err) 843 }() 844 } 845 for { 846 next, err := page.fn(ctx, page.llr) 847 if err != nil { 848 return err 849 } 850 page.llr = next 851 if !next.hasNextLink() || !next.IsEmpty() { 852 break 853 } 854 } 855 return nil 856} 857 858// Next advances to the next page of values. If there was an error making 859// the request the page does not advance and the error is returned. 860// Deprecated: Use NextWithContext() instead. 861func (page *LocationListResultPage) Next() error { 862 return page.NextWithContext(context.Background()) 863} 864 865// NotDone returns true if the page enumeration should be started or is not yet complete. 866func (page LocationListResultPage) NotDone() bool { 867 return !page.llr.IsEmpty() 868} 869 870// Response returns the raw server response from the last page request. 871func (page LocationListResultPage) Response() LocationListResult { 872 return page.llr 873} 874 875// Values returns the slice of values for the current page or nil if there are no values. 876func (page LocationListResultPage) Values() []Location { 877 if page.llr.IsEmpty() { 878 return nil 879 } 880 return *page.llr.Value 881} 882 883// Creates a new instance of the LocationListResultPage type. 884func NewLocationListResultPage(cur LocationListResult, getNextPage func(context.Context, LocationListResult) (LocationListResult, error)) LocationListResultPage { 885 return LocationListResultPage{ 886 fn: getNextPage, 887 llr: cur, 888 } 889} 890 891// LocationProperties the properties that define a peering location. 892type LocationProperties struct { 893 // Direct - The properties that define a direct peering location. 894 Direct *LocationPropertiesDirect `json:"direct,omitempty"` 895 // Exchange - The properties that define an exchange peering location. 896 Exchange *LocationPropertiesExchange `json:"exchange,omitempty"` 897 // PeeringLocation - The name of the peering location. 898 PeeringLocation *string `json:"peeringLocation,omitempty"` 899 // Country - The country in which the peering location exists. 900 Country *string `json:"country,omitempty"` 901 // AzureRegion - The Azure region associated with the peering location. 902 AzureRegion *string `json:"azureRegion,omitempty"` 903} 904 905// LocationPropertiesDirect the properties that define a direct peering location. 906type LocationPropertiesDirect struct { 907 // PeeringFacilities - The list of direct peering facilities at the peering location. 908 PeeringFacilities *[]DirectPeeringFacility `json:"peeringFacilities,omitempty"` 909 // BandwidthOffers - The list of bandwidth offers available at the peering location. 910 BandwidthOffers *[]BandwidthOffer `json:"bandwidthOffers,omitempty"` 911} 912 913// LocationPropertiesExchange the properties that define an exchange peering location. 914type LocationPropertiesExchange struct { 915 // PeeringFacilities - The list of exchange peering facilities at the peering location. 916 PeeringFacilities *[]ExchangePeeringFacility `json:"peeringFacilities,omitempty"` 917} 918 919// Model peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a 920// location. 921type Model struct { 922 autorest.Response `json:"-"` 923 // Sku - The SKU that defines the tier and kind of the peering. 924 Sku *Sku `json:"sku,omitempty"` 925 // Kind - The kind of the peering. Possible values include: 'KindDirect', 'KindExchange' 926 Kind Kind `json:"kind,omitempty"` 927 // Properties - The properties that define a peering. 928 *Properties `json:"properties,omitempty"` 929 // Location - The location of the resource. 930 Location *string `json:"location,omitempty"` 931 // Tags - The resource tags. 932 Tags map[string]*string `json:"tags"` 933 // Name - READ-ONLY; The name of the resource. 934 Name *string `json:"name,omitempty"` 935 // ID - READ-ONLY; The ID of the resource. 936 ID *string `json:"id,omitempty"` 937 // Type - READ-ONLY; The type of the resource. 938 Type *string `json:"type,omitempty"` 939} 940 941// MarshalJSON is the custom marshaler for Model. 942func (mVar Model) MarshalJSON() ([]byte, error) { 943 objectMap := make(map[string]interface{}) 944 if mVar.Sku != nil { 945 objectMap["sku"] = mVar.Sku 946 } 947 if mVar.Kind != "" { 948 objectMap["kind"] = mVar.Kind 949 } 950 if mVar.Properties != nil { 951 objectMap["properties"] = mVar.Properties 952 } 953 if mVar.Location != nil { 954 objectMap["location"] = mVar.Location 955 } 956 if mVar.Tags != nil { 957 objectMap["tags"] = mVar.Tags 958 } 959 return json.Marshal(objectMap) 960} 961 962// UnmarshalJSON is the custom unmarshaler for Model struct. 963func (mVar *Model) UnmarshalJSON(body []byte) error { 964 var m map[string]*json.RawMessage 965 err := json.Unmarshal(body, &m) 966 if err != nil { 967 return err 968 } 969 for k, v := range m { 970 switch k { 971 case "sku": 972 if v != nil { 973 var sku Sku 974 err = json.Unmarshal(*v, &sku) 975 if err != nil { 976 return err 977 } 978 mVar.Sku = &sku 979 } 980 case "kind": 981 if v != nil { 982 var kind Kind 983 err = json.Unmarshal(*v, &kind) 984 if err != nil { 985 return err 986 } 987 mVar.Kind = kind 988 } 989 case "properties": 990 if v != nil { 991 var properties Properties 992 err = json.Unmarshal(*v, &properties) 993 if err != nil { 994 return err 995 } 996 mVar.Properties = &properties 997 } 998 case "location": 999 if v != nil { 1000 var location string 1001 err = json.Unmarshal(*v, &location) 1002 if err != nil { 1003 return err 1004 } 1005 mVar.Location = &location 1006 } 1007 case "tags": 1008 if v != nil { 1009 var tags map[string]*string 1010 err = json.Unmarshal(*v, &tags) 1011 if err != nil { 1012 return err 1013 } 1014 mVar.Tags = tags 1015 } 1016 case "name": 1017 if v != nil { 1018 var name string 1019 err = json.Unmarshal(*v, &name) 1020 if err != nil { 1021 return err 1022 } 1023 mVar.Name = &name 1024 } 1025 case "id": 1026 if v != nil { 1027 var ID string 1028 err = json.Unmarshal(*v, &ID) 1029 if err != nil { 1030 return err 1031 } 1032 mVar.ID = &ID 1033 } 1034 case "type": 1035 if v != nil { 1036 var typeVar string 1037 err = json.Unmarshal(*v, &typeVar) 1038 if err != nil { 1039 return err 1040 } 1041 mVar.Type = &typeVar 1042 } 1043 } 1044 } 1045 1046 return nil 1047} 1048 1049// Operation the peering API operation. 1050type Operation struct { 1051 // Name - READ-ONLY; The name of the operation. 1052 Name *string `json:"name,omitempty"` 1053 // Display - READ-ONLY; The information related to the operation. 1054 Display *OperationDisplayInfo `json:"display,omitempty"` 1055 // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. 1056 IsDataAction *bool `json:"isDataAction,omitempty"` 1057} 1058 1059// MarshalJSON is the custom marshaler for Operation. 1060func (o Operation) MarshalJSON() ([]byte, error) { 1061 objectMap := make(map[string]interface{}) 1062 return json.Marshal(objectMap) 1063} 1064 1065// OperationDisplayInfo the information related to the operation. 1066type OperationDisplayInfo struct { 1067 // Provider - READ-ONLY; The name of the resource provider. 1068 Provider *string `json:"provider,omitempty"` 1069 // Resource - READ-ONLY; The type of the resource. 1070 Resource *string `json:"resource,omitempty"` 1071 // Operation - READ-ONLY; The name of the operation. 1072 Operation *string `json:"operation,omitempty"` 1073 // Description - READ-ONLY; The description of the operation. 1074 Description *string `json:"description,omitempty"` 1075} 1076 1077// MarshalJSON is the custom marshaler for OperationDisplayInfo. 1078func (odi OperationDisplayInfo) MarshalJSON() ([]byte, error) { 1079 objectMap := make(map[string]interface{}) 1080 return json.Marshal(objectMap) 1081} 1082 1083// OperationListResult the paginated list of peering API operations. 1084type OperationListResult struct { 1085 autorest.Response `json:"-"` 1086 // Value - The list of peering API operations. 1087 Value *[]Operation `json:"value,omitempty"` 1088 // NextLink - The link to fetch the next page of peering API operations. 1089 NextLink *string `json:"nextLink,omitempty"` 1090} 1091 1092// OperationListResultIterator provides access to a complete listing of Operation values. 1093type OperationListResultIterator struct { 1094 i int 1095 page OperationListResultPage 1096} 1097 1098// NextWithContext advances to the next value. If there was an error making 1099// the request the iterator does not advance and the error is returned. 1100func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1101 if tracing.IsEnabled() { 1102 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1103 defer func() { 1104 sc := -1 1105 if iter.Response().Response.Response != nil { 1106 sc = iter.Response().Response.Response.StatusCode 1107 } 1108 tracing.EndSpan(ctx, sc, err) 1109 }() 1110 } 1111 iter.i++ 1112 if iter.i < len(iter.page.Values()) { 1113 return nil 1114 } 1115 err = iter.page.NextWithContext(ctx) 1116 if err != nil { 1117 iter.i-- 1118 return err 1119 } 1120 iter.i = 0 1121 return nil 1122} 1123 1124// Next advances to the next value. If there was an error making 1125// the request the iterator does not advance and the error is returned. 1126// Deprecated: Use NextWithContext() instead. 1127func (iter *OperationListResultIterator) Next() error { 1128 return iter.NextWithContext(context.Background()) 1129} 1130 1131// NotDone returns true if the enumeration should be started or is not yet complete. 1132func (iter OperationListResultIterator) NotDone() bool { 1133 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1134} 1135 1136// Response returns the raw server response from the last page request. 1137func (iter OperationListResultIterator) Response() OperationListResult { 1138 return iter.page.Response() 1139} 1140 1141// Value returns the current value or a zero-initialized value if the 1142// iterator has advanced beyond the end of the collection. 1143func (iter OperationListResultIterator) Value() Operation { 1144 if !iter.page.NotDone() { 1145 return Operation{} 1146 } 1147 return iter.page.Values()[iter.i] 1148} 1149 1150// Creates a new instance of the OperationListResultIterator type. 1151func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1152 return OperationListResultIterator{page: page} 1153} 1154 1155// IsEmpty returns true if the ListResult contains no values. 1156func (olr OperationListResult) IsEmpty() bool { 1157 return olr.Value == nil || len(*olr.Value) == 0 1158} 1159 1160// hasNextLink returns true if the NextLink is not empty. 1161func (olr OperationListResult) hasNextLink() bool { 1162 return olr.NextLink != nil && len(*olr.NextLink) != 0 1163} 1164 1165// operationListResultPreparer prepares a request to retrieve the next set of results. 1166// It returns nil if no more results exist. 1167func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1168 if !olr.hasNextLink() { 1169 return nil, nil 1170 } 1171 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1172 autorest.AsJSON(), 1173 autorest.AsGet(), 1174 autorest.WithBaseURL(to.String(olr.NextLink))) 1175} 1176 1177// OperationListResultPage contains a page of Operation values. 1178type OperationListResultPage struct { 1179 fn func(context.Context, OperationListResult) (OperationListResult, error) 1180 olr OperationListResult 1181} 1182 1183// NextWithContext advances to the next page of values. If there was an error making 1184// the request the page does not advance and the error is returned. 1185func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1186 if tracing.IsEnabled() { 1187 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1188 defer func() { 1189 sc := -1 1190 if page.Response().Response.Response != nil { 1191 sc = page.Response().Response.Response.StatusCode 1192 } 1193 tracing.EndSpan(ctx, sc, err) 1194 }() 1195 } 1196 for { 1197 next, err := page.fn(ctx, page.olr) 1198 if err != nil { 1199 return err 1200 } 1201 page.olr = next 1202 if !next.hasNextLink() || !next.IsEmpty() { 1203 break 1204 } 1205 } 1206 return nil 1207} 1208 1209// Next advances to the next page of values. If there was an error making 1210// the request the page does not advance and the error is returned. 1211// Deprecated: Use NextWithContext() instead. 1212func (page *OperationListResultPage) Next() error { 1213 return page.NextWithContext(context.Background()) 1214} 1215 1216// NotDone returns true if the page enumeration should be started or is not yet complete. 1217func (page OperationListResultPage) NotDone() bool { 1218 return !page.olr.IsEmpty() 1219} 1220 1221// Response returns the raw server response from the last page request. 1222func (page OperationListResultPage) Response() OperationListResult { 1223 return page.olr 1224} 1225 1226// Values returns the slice of values for the current page or nil if there are no values. 1227func (page OperationListResultPage) Values() []Operation { 1228 if page.olr.IsEmpty() { 1229 return nil 1230 } 1231 return *page.olr.Value 1232} 1233 1234// Creates a new instance of the OperationListResultPage type. 1235func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1236 return OperationListResultPage{ 1237 fn: getNextPage, 1238 olr: cur, 1239 } 1240} 1241 1242// PeerAsn the essential information related to the peer's ASN. 1243type PeerAsn struct { 1244 autorest.Response `json:"-"` 1245 // PeerAsnProperties - The properties that define a peer's ASN. 1246 *PeerAsnProperties `json:"properties,omitempty"` 1247 // Name - READ-ONLY; The name of the resource. 1248 Name *string `json:"name,omitempty"` 1249 // ID - READ-ONLY; The ID of the resource. 1250 ID *string `json:"id,omitempty"` 1251 // Type - READ-ONLY; The type of the resource. 1252 Type *string `json:"type,omitempty"` 1253} 1254 1255// MarshalJSON is the custom marshaler for PeerAsn. 1256func (pa PeerAsn) MarshalJSON() ([]byte, error) { 1257 objectMap := make(map[string]interface{}) 1258 if pa.PeerAsnProperties != nil { 1259 objectMap["properties"] = pa.PeerAsnProperties 1260 } 1261 return json.Marshal(objectMap) 1262} 1263 1264// UnmarshalJSON is the custom unmarshaler for PeerAsn struct. 1265func (pa *PeerAsn) UnmarshalJSON(body []byte) error { 1266 var m map[string]*json.RawMessage 1267 err := json.Unmarshal(body, &m) 1268 if err != nil { 1269 return err 1270 } 1271 for k, v := range m { 1272 switch k { 1273 case "properties": 1274 if v != nil { 1275 var peerAsnProperties PeerAsnProperties 1276 err = json.Unmarshal(*v, &peerAsnProperties) 1277 if err != nil { 1278 return err 1279 } 1280 pa.PeerAsnProperties = &peerAsnProperties 1281 } 1282 case "name": 1283 if v != nil { 1284 var name string 1285 err = json.Unmarshal(*v, &name) 1286 if err != nil { 1287 return err 1288 } 1289 pa.Name = &name 1290 } 1291 case "id": 1292 if v != nil { 1293 var ID string 1294 err = json.Unmarshal(*v, &ID) 1295 if err != nil { 1296 return err 1297 } 1298 pa.ID = &ID 1299 } 1300 case "type": 1301 if v != nil { 1302 var typeVar string 1303 err = json.Unmarshal(*v, &typeVar) 1304 if err != nil { 1305 return err 1306 } 1307 pa.Type = &typeVar 1308 } 1309 } 1310 } 1311 1312 return nil 1313} 1314 1315// PeerAsnListResult the paginated list of peer ASNs. 1316type PeerAsnListResult struct { 1317 autorest.Response `json:"-"` 1318 // Value - The list of peer ASNs. 1319 Value *[]PeerAsn `json:"value,omitempty"` 1320 // NextLink - The link to fetch the next page of peer ASNs. 1321 NextLink *string `json:"nextLink,omitempty"` 1322} 1323 1324// PeerAsnListResultIterator provides access to a complete listing of PeerAsn values. 1325type PeerAsnListResultIterator struct { 1326 i int 1327 page PeerAsnListResultPage 1328} 1329 1330// NextWithContext advances to the next value. If there was an error making 1331// the request the iterator does not advance and the error is returned. 1332func (iter *PeerAsnListResultIterator) NextWithContext(ctx context.Context) (err error) { 1333 if tracing.IsEnabled() { 1334 ctx = tracing.StartSpan(ctx, fqdn+"/PeerAsnListResultIterator.NextWithContext") 1335 defer func() { 1336 sc := -1 1337 if iter.Response().Response.Response != nil { 1338 sc = iter.Response().Response.Response.StatusCode 1339 } 1340 tracing.EndSpan(ctx, sc, err) 1341 }() 1342 } 1343 iter.i++ 1344 if iter.i < len(iter.page.Values()) { 1345 return nil 1346 } 1347 err = iter.page.NextWithContext(ctx) 1348 if err != nil { 1349 iter.i-- 1350 return err 1351 } 1352 iter.i = 0 1353 return nil 1354} 1355 1356// Next advances to the next value. If there was an error making 1357// the request the iterator does not advance and the error is returned. 1358// Deprecated: Use NextWithContext() instead. 1359func (iter *PeerAsnListResultIterator) Next() error { 1360 return iter.NextWithContext(context.Background()) 1361} 1362 1363// NotDone returns true if the enumeration should be started or is not yet complete. 1364func (iter PeerAsnListResultIterator) NotDone() bool { 1365 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1366} 1367 1368// Response returns the raw server response from the last page request. 1369func (iter PeerAsnListResultIterator) Response() PeerAsnListResult { 1370 return iter.page.Response() 1371} 1372 1373// Value returns the current value or a zero-initialized value if the 1374// iterator has advanced beyond the end of the collection. 1375func (iter PeerAsnListResultIterator) Value() PeerAsn { 1376 if !iter.page.NotDone() { 1377 return PeerAsn{} 1378 } 1379 return iter.page.Values()[iter.i] 1380} 1381 1382// Creates a new instance of the PeerAsnListResultIterator type. 1383func NewPeerAsnListResultIterator(page PeerAsnListResultPage) PeerAsnListResultIterator { 1384 return PeerAsnListResultIterator{page: page} 1385} 1386 1387// IsEmpty returns true if the ListResult contains no values. 1388func (palr PeerAsnListResult) IsEmpty() bool { 1389 return palr.Value == nil || len(*palr.Value) == 0 1390} 1391 1392// hasNextLink returns true if the NextLink is not empty. 1393func (palr PeerAsnListResult) hasNextLink() bool { 1394 return palr.NextLink != nil && len(*palr.NextLink) != 0 1395} 1396 1397// peerAsnListResultPreparer prepares a request to retrieve the next set of results. 1398// It returns nil if no more results exist. 1399func (palr PeerAsnListResult) peerAsnListResultPreparer(ctx context.Context) (*http.Request, error) { 1400 if !palr.hasNextLink() { 1401 return nil, nil 1402 } 1403 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1404 autorest.AsJSON(), 1405 autorest.AsGet(), 1406 autorest.WithBaseURL(to.String(palr.NextLink))) 1407} 1408 1409// PeerAsnListResultPage contains a page of PeerAsn values. 1410type PeerAsnListResultPage struct { 1411 fn func(context.Context, PeerAsnListResult) (PeerAsnListResult, error) 1412 palr PeerAsnListResult 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 *PeerAsnListResultPage) NextWithContext(ctx context.Context) (err error) { 1418 if tracing.IsEnabled() { 1419 ctx = tracing.StartSpan(ctx, fqdn+"/PeerAsnListResultPage.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 for { 1429 next, err := page.fn(ctx, page.palr) 1430 if err != nil { 1431 return err 1432 } 1433 page.palr = next 1434 if !next.hasNextLink() || !next.IsEmpty() { 1435 break 1436 } 1437 } 1438 return nil 1439} 1440 1441// Next advances to the next page of values. If there was an error making 1442// the request the page does not advance and the error is returned. 1443// Deprecated: Use NextWithContext() instead. 1444func (page *PeerAsnListResultPage) Next() error { 1445 return page.NextWithContext(context.Background()) 1446} 1447 1448// NotDone returns true if the page enumeration should be started or is not yet complete. 1449func (page PeerAsnListResultPage) NotDone() bool { 1450 return !page.palr.IsEmpty() 1451} 1452 1453// Response returns the raw server response from the last page request. 1454func (page PeerAsnListResultPage) Response() PeerAsnListResult { 1455 return page.palr 1456} 1457 1458// Values returns the slice of values for the current page or nil if there are no values. 1459func (page PeerAsnListResultPage) Values() []PeerAsn { 1460 if page.palr.IsEmpty() { 1461 return nil 1462 } 1463 return *page.palr.Value 1464} 1465 1466// Creates a new instance of the PeerAsnListResultPage type. 1467func NewPeerAsnListResultPage(cur PeerAsnListResult, getNextPage func(context.Context, PeerAsnListResult) (PeerAsnListResult, error)) PeerAsnListResultPage { 1468 return PeerAsnListResultPage{ 1469 fn: getNextPage, 1470 palr: cur, 1471 } 1472} 1473 1474// PeerAsnProperties the properties that define a peer's ASN. 1475type PeerAsnProperties struct { 1476 // PeerAsn - The Autonomous System Number (ASN) of the peer. 1477 PeerAsn *int32 `json:"peerAsn,omitempty"` 1478 // PeerContactDetail - The contact details of the peer. 1479 PeerContactDetail *[]ContactDetail `json:"peerContactDetail,omitempty"` 1480 // PeerName - The name of the peer. 1481 PeerName *string `json:"peerName,omitempty"` 1482 // ValidationState - The validation state of the ASN associated with the peer. Possible values include: 'ValidationStateNone', 'ValidationStatePending', 'ValidationStateApproved', 'ValidationStateFailed' 1483 ValidationState ValidationState `json:"validationState,omitempty"` 1484 // ErrorMessage - READ-ONLY; The error message for the validation state 1485 ErrorMessage *string `json:"errorMessage,omitempty"` 1486} 1487 1488// MarshalJSON is the custom marshaler for PeerAsnProperties. 1489func (pap PeerAsnProperties) MarshalJSON() ([]byte, error) { 1490 objectMap := make(map[string]interface{}) 1491 if pap.PeerAsn != nil { 1492 objectMap["peerAsn"] = pap.PeerAsn 1493 } 1494 if pap.PeerContactDetail != nil { 1495 objectMap["peerContactDetail"] = pap.PeerContactDetail 1496 } 1497 if pap.PeerName != nil { 1498 objectMap["peerName"] = pap.PeerName 1499 } 1500 if pap.ValidationState != "" { 1501 objectMap["validationState"] = pap.ValidationState 1502 } 1503 return json.Marshal(objectMap) 1504} 1505 1506// Properties the properties that define connectivity to the Microsoft Cloud Edge. 1507type Properties struct { 1508 // Direct - The properties that define a direct peering. 1509 Direct *PropertiesDirect `json:"direct,omitempty"` 1510 // Exchange - The properties that define an exchange peering. 1511 Exchange *PropertiesExchange `json:"exchange,omitempty"` 1512 // PeeringLocation - The location of the peering. 1513 PeeringLocation *string `json:"peeringLocation,omitempty"` 1514 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 1515 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1516} 1517 1518// MarshalJSON is the custom marshaler for Properties. 1519func (p Properties) MarshalJSON() ([]byte, error) { 1520 objectMap := make(map[string]interface{}) 1521 if p.Direct != nil { 1522 objectMap["direct"] = p.Direct 1523 } 1524 if p.Exchange != nil { 1525 objectMap["exchange"] = p.Exchange 1526 } 1527 if p.PeeringLocation != nil { 1528 objectMap["peeringLocation"] = p.PeeringLocation 1529 } 1530 return json.Marshal(objectMap) 1531} 1532 1533// PropertiesDirect the properties that define a direct peering. 1534type PropertiesDirect struct { 1535 // Connections - The set of connections that constitute a direct peering. 1536 Connections *[]DirectConnection `json:"connections,omitempty"` 1537 // UseForPeeringService - READ-ONLY; The flag that indicates whether or not the peering is used for peering service. 1538 UseForPeeringService *bool `json:"useForPeeringService,omitempty"` 1539 // PeerAsn - The reference of the peer ASN. 1540 PeerAsn *SubResource `json:"peerAsn,omitempty"` 1541 // DirectPeeringType - The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' 1542 DirectPeeringType DirectPeeringType `json:"directPeeringType,omitempty"` 1543} 1544 1545// MarshalJSON is the custom marshaler for PropertiesDirect. 1546func (pd PropertiesDirect) MarshalJSON() ([]byte, error) { 1547 objectMap := make(map[string]interface{}) 1548 if pd.Connections != nil { 1549 objectMap["connections"] = pd.Connections 1550 } 1551 if pd.PeerAsn != nil { 1552 objectMap["peerAsn"] = pd.PeerAsn 1553 } 1554 if pd.DirectPeeringType != "" { 1555 objectMap["directPeeringType"] = pd.DirectPeeringType 1556 } 1557 return json.Marshal(objectMap) 1558} 1559 1560// PropertiesExchange the properties that define an exchange peering. 1561type PropertiesExchange struct { 1562 // Connections - The set of connections that constitute an exchange peering. 1563 Connections *[]ExchangeConnection `json:"connections,omitempty"` 1564 // PeerAsn - The reference of the peer ASN. 1565 PeerAsn *SubResource `json:"peerAsn,omitempty"` 1566} 1567 1568// ReceivedRoute the properties that define a received route. 1569type ReceivedRoute struct { 1570 // Prefix - READ-ONLY; The prefix. 1571 Prefix *string `json:"prefix,omitempty"` 1572 // NextHop - READ-ONLY; The next hop for the prefix. 1573 NextHop *string `json:"nextHop,omitempty"` 1574 // AsPath - READ-ONLY; The AS path for the prefix. 1575 AsPath *string `json:"asPath,omitempty"` 1576 // OriginAsValidationState - READ-ONLY; The origin AS change information for the prefix. 1577 OriginAsValidationState *string `json:"originAsValidationState,omitempty"` 1578 // RpkiValidationState - READ-ONLY; The RPKI validation state for the prefix and origin AS that's listed in the AS path. 1579 RpkiValidationState *string `json:"rpkiValidationState,omitempty"` 1580 // TrustAnchor - READ-ONLY; The authority which holds the Route Origin Authorization record for the prefix, if any. 1581 TrustAnchor *string `json:"trustAnchor,omitempty"` 1582 // ReceivedTimestamp - READ-ONLY; The received timestamp associated with the prefix. 1583 ReceivedTimestamp *string `json:"receivedTimestamp,omitempty"` 1584} 1585 1586// MarshalJSON is the custom marshaler for ReceivedRoute. 1587func (rr ReceivedRoute) MarshalJSON() ([]byte, error) { 1588 objectMap := make(map[string]interface{}) 1589 return json.Marshal(objectMap) 1590} 1591 1592// ReceivedRouteListResult the paginated list of received routes for the peering. 1593type ReceivedRouteListResult struct { 1594 autorest.Response `json:"-"` 1595 // Value - The list of received routes for the peering. 1596 Value *[]ReceivedRoute `json:"value,omitempty"` 1597 // NextLink - The link to fetch the next page of received routes for the peering. 1598 NextLink *string `json:"nextLink,omitempty"` 1599} 1600 1601// ReceivedRouteListResultIterator provides access to a complete listing of ReceivedRoute values. 1602type ReceivedRouteListResultIterator struct { 1603 i int 1604 page ReceivedRouteListResultPage 1605} 1606 1607// NextWithContext advances to the next value. If there was an error making 1608// the request the iterator does not advance and the error is returned. 1609func (iter *ReceivedRouteListResultIterator) NextWithContext(ctx context.Context) (err error) { 1610 if tracing.IsEnabled() { 1611 ctx = tracing.StartSpan(ctx, fqdn+"/ReceivedRouteListResultIterator.NextWithContext") 1612 defer func() { 1613 sc := -1 1614 if iter.Response().Response.Response != nil { 1615 sc = iter.Response().Response.Response.StatusCode 1616 } 1617 tracing.EndSpan(ctx, sc, err) 1618 }() 1619 } 1620 iter.i++ 1621 if iter.i < len(iter.page.Values()) { 1622 return nil 1623 } 1624 err = iter.page.NextWithContext(ctx) 1625 if err != nil { 1626 iter.i-- 1627 return err 1628 } 1629 iter.i = 0 1630 return nil 1631} 1632 1633// Next advances to the next value. If there was an error making 1634// the request the iterator does not advance and the error is returned. 1635// Deprecated: Use NextWithContext() instead. 1636func (iter *ReceivedRouteListResultIterator) Next() error { 1637 return iter.NextWithContext(context.Background()) 1638} 1639 1640// NotDone returns true if the enumeration should be started or is not yet complete. 1641func (iter ReceivedRouteListResultIterator) NotDone() bool { 1642 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1643} 1644 1645// Response returns the raw server response from the last page request. 1646func (iter ReceivedRouteListResultIterator) Response() ReceivedRouteListResult { 1647 return iter.page.Response() 1648} 1649 1650// Value returns the current value or a zero-initialized value if the 1651// iterator has advanced beyond the end of the collection. 1652func (iter ReceivedRouteListResultIterator) Value() ReceivedRoute { 1653 if !iter.page.NotDone() { 1654 return ReceivedRoute{} 1655 } 1656 return iter.page.Values()[iter.i] 1657} 1658 1659// Creates a new instance of the ReceivedRouteListResultIterator type. 1660func NewReceivedRouteListResultIterator(page ReceivedRouteListResultPage) ReceivedRouteListResultIterator { 1661 return ReceivedRouteListResultIterator{page: page} 1662} 1663 1664// IsEmpty returns true if the ListResult contains no values. 1665func (rrlr ReceivedRouteListResult) IsEmpty() bool { 1666 return rrlr.Value == nil || len(*rrlr.Value) == 0 1667} 1668 1669// hasNextLink returns true if the NextLink is not empty. 1670func (rrlr ReceivedRouteListResult) hasNextLink() bool { 1671 return rrlr.NextLink != nil && len(*rrlr.NextLink) != 0 1672} 1673 1674// receivedRouteListResultPreparer prepares a request to retrieve the next set of results. 1675// It returns nil if no more results exist. 1676func (rrlr ReceivedRouteListResult) receivedRouteListResultPreparer(ctx context.Context) (*http.Request, error) { 1677 if !rrlr.hasNextLink() { 1678 return nil, nil 1679 } 1680 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1681 autorest.AsJSON(), 1682 autorest.AsGet(), 1683 autorest.WithBaseURL(to.String(rrlr.NextLink))) 1684} 1685 1686// ReceivedRouteListResultPage contains a page of ReceivedRoute values. 1687type ReceivedRouteListResultPage struct { 1688 fn func(context.Context, ReceivedRouteListResult) (ReceivedRouteListResult, error) 1689 rrlr ReceivedRouteListResult 1690} 1691 1692// NextWithContext advances to the next page of values. If there was an error making 1693// the request the page does not advance and the error is returned. 1694func (page *ReceivedRouteListResultPage) NextWithContext(ctx context.Context) (err error) { 1695 if tracing.IsEnabled() { 1696 ctx = tracing.StartSpan(ctx, fqdn+"/ReceivedRouteListResultPage.NextWithContext") 1697 defer func() { 1698 sc := -1 1699 if page.Response().Response.Response != nil { 1700 sc = page.Response().Response.Response.StatusCode 1701 } 1702 tracing.EndSpan(ctx, sc, err) 1703 }() 1704 } 1705 for { 1706 next, err := page.fn(ctx, page.rrlr) 1707 if err != nil { 1708 return err 1709 } 1710 page.rrlr = next 1711 if !next.hasNextLink() || !next.IsEmpty() { 1712 break 1713 } 1714 } 1715 return nil 1716} 1717 1718// Next advances to the next page of values. If there was an error making 1719// the request the page does not advance and the error is returned. 1720// Deprecated: Use NextWithContext() instead. 1721func (page *ReceivedRouteListResultPage) Next() error { 1722 return page.NextWithContext(context.Background()) 1723} 1724 1725// NotDone returns true if the page enumeration should be started or is not yet complete. 1726func (page ReceivedRouteListResultPage) NotDone() bool { 1727 return !page.rrlr.IsEmpty() 1728} 1729 1730// Response returns the raw server response from the last page request. 1731func (page ReceivedRouteListResultPage) Response() ReceivedRouteListResult { 1732 return page.rrlr 1733} 1734 1735// Values returns the slice of values for the current page or nil if there are no values. 1736func (page ReceivedRouteListResultPage) Values() []ReceivedRoute { 1737 if page.rrlr.IsEmpty() { 1738 return nil 1739 } 1740 return *page.rrlr.Value 1741} 1742 1743// Creates a new instance of the ReceivedRouteListResultPage type. 1744func NewReceivedRouteListResultPage(cur ReceivedRouteListResult, getNextPage func(context.Context, ReceivedRouteListResult) (ReceivedRouteListResult, error)) ReceivedRouteListResultPage { 1745 return ReceivedRouteListResultPage{ 1746 fn: getNextPage, 1747 rrlr: cur, 1748 } 1749} 1750 1751// RegisteredAsn the customer's ASN that is registered by the peering service provider. 1752type RegisteredAsn struct { 1753 autorest.Response `json:"-"` 1754 // RegisteredAsnProperties - The properties that define a registered ASN. 1755 *RegisteredAsnProperties `json:"properties,omitempty"` 1756 // Name - READ-ONLY; The name of the resource. 1757 Name *string `json:"name,omitempty"` 1758 // ID - READ-ONLY; The ID of the resource. 1759 ID *string `json:"id,omitempty"` 1760 // Type - READ-ONLY; The type of the resource. 1761 Type *string `json:"type,omitempty"` 1762} 1763 1764// MarshalJSON is the custom marshaler for RegisteredAsn. 1765func (ra RegisteredAsn) MarshalJSON() ([]byte, error) { 1766 objectMap := make(map[string]interface{}) 1767 if ra.RegisteredAsnProperties != nil { 1768 objectMap["properties"] = ra.RegisteredAsnProperties 1769 } 1770 return json.Marshal(objectMap) 1771} 1772 1773// UnmarshalJSON is the custom unmarshaler for RegisteredAsn struct. 1774func (ra *RegisteredAsn) UnmarshalJSON(body []byte) error { 1775 var m map[string]*json.RawMessage 1776 err := json.Unmarshal(body, &m) 1777 if err != nil { 1778 return err 1779 } 1780 for k, v := range m { 1781 switch k { 1782 case "properties": 1783 if v != nil { 1784 var registeredAsnProperties RegisteredAsnProperties 1785 err = json.Unmarshal(*v, ®isteredAsnProperties) 1786 if err != nil { 1787 return err 1788 } 1789 ra.RegisteredAsnProperties = ®isteredAsnProperties 1790 } 1791 case "name": 1792 if v != nil { 1793 var name string 1794 err = json.Unmarshal(*v, &name) 1795 if err != nil { 1796 return err 1797 } 1798 ra.Name = &name 1799 } 1800 case "id": 1801 if v != nil { 1802 var ID string 1803 err = json.Unmarshal(*v, &ID) 1804 if err != nil { 1805 return err 1806 } 1807 ra.ID = &ID 1808 } 1809 case "type": 1810 if v != nil { 1811 var typeVar string 1812 err = json.Unmarshal(*v, &typeVar) 1813 if err != nil { 1814 return err 1815 } 1816 ra.Type = &typeVar 1817 } 1818 } 1819 } 1820 1821 return nil 1822} 1823 1824// RegisteredAsnListResult the paginated list of peering registered ASNs. 1825type RegisteredAsnListResult struct { 1826 autorest.Response `json:"-"` 1827 // Value - The list of peering registered ASNs. 1828 Value *[]RegisteredAsn `json:"value,omitempty"` 1829 // NextLink - The link to fetch the next page of peering registered ASNs. 1830 NextLink *string `json:"nextLink,omitempty"` 1831} 1832 1833// RegisteredAsnListResultIterator provides access to a complete listing of RegisteredAsn values. 1834type RegisteredAsnListResultIterator struct { 1835 i int 1836 page RegisteredAsnListResultPage 1837} 1838 1839// NextWithContext advances to the next value. If there was an error making 1840// the request the iterator does not advance and the error is returned. 1841func (iter *RegisteredAsnListResultIterator) NextWithContext(ctx context.Context) (err error) { 1842 if tracing.IsEnabled() { 1843 ctx = tracing.StartSpan(ctx, fqdn+"/RegisteredAsnListResultIterator.NextWithContext") 1844 defer func() { 1845 sc := -1 1846 if iter.Response().Response.Response != nil { 1847 sc = iter.Response().Response.Response.StatusCode 1848 } 1849 tracing.EndSpan(ctx, sc, err) 1850 }() 1851 } 1852 iter.i++ 1853 if iter.i < len(iter.page.Values()) { 1854 return nil 1855 } 1856 err = iter.page.NextWithContext(ctx) 1857 if err != nil { 1858 iter.i-- 1859 return err 1860 } 1861 iter.i = 0 1862 return nil 1863} 1864 1865// Next advances to the next value. If there was an error making 1866// the request the iterator does not advance and the error is returned. 1867// Deprecated: Use NextWithContext() instead. 1868func (iter *RegisteredAsnListResultIterator) Next() error { 1869 return iter.NextWithContext(context.Background()) 1870} 1871 1872// NotDone returns true if the enumeration should be started or is not yet complete. 1873func (iter RegisteredAsnListResultIterator) NotDone() bool { 1874 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1875} 1876 1877// Response returns the raw server response from the last page request. 1878func (iter RegisteredAsnListResultIterator) Response() RegisteredAsnListResult { 1879 return iter.page.Response() 1880} 1881 1882// Value returns the current value or a zero-initialized value if the 1883// iterator has advanced beyond the end of the collection. 1884func (iter RegisteredAsnListResultIterator) Value() RegisteredAsn { 1885 if !iter.page.NotDone() { 1886 return RegisteredAsn{} 1887 } 1888 return iter.page.Values()[iter.i] 1889} 1890 1891// Creates a new instance of the RegisteredAsnListResultIterator type. 1892func NewRegisteredAsnListResultIterator(page RegisteredAsnListResultPage) RegisteredAsnListResultIterator { 1893 return RegisteredAsnListResultIterator{page: page} 1894} 1895 1896// IsEmpty returns true if the ListResult contains no values. 1897func (ralr RegisteredAsnListResult) IsEmpty() bool { 1898 return ralr.Value == nil || len(*ralr.Value) == 0 1899} 1900 1901// hasNextLink returns true if the NextLink is not empty. 1902func (ralr RegisteredAsnListResult) hasNextLink() bool { 1903 return ralr.NextLink != nil && len(*ralr.NextLink) != 0 1904} 1905 1906// registeredAsnListResultPreparer prepares a request to retrieve the next set of results. 1907// It returns nil if no more results exist. 1908func (ralr RegisteredAsnListResult) registeredAsnListResultPreparer(ctx context.Context) (*http.Request, error) { 1909 if !ralr.hasNextLink() { 1910 return nil, nil 1911 } 1912 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1913 autorest.AsJSON(), 1914 autorest.AsGet(), 1915 autorest.WithBaseURL(to.String(ralr.NextLink))) 1916} 1917 1918// RegisteredAsnListResultPage contains a page of RegisteredAsn values. 1919type RegisteredAsnListResultPage struct { 1920 fn func(context.Context, RegisteredAsnListResult) (RegisteredAsnListResult, error) 1921 ralr RegisteredAsnListResult 1922} 1923 1924// NextWithContext advances to the next page of values. If there was an error making 1925// the request the page does not advance and the error is returned. 1926func (page *RegisteredAsnListResultPage) NextWithContext(ctx context.Context) (err error) { 1927 if tracing.IsEnabled() { 1928 ctx = tracing.StartSpan(ctx, fqdn+"/RegisteredAsnListResultPage.NextWithContext") 1929 defer func() { 1930 sc := -1 1931 if page.Response().Response.Response != nil { 1932 sc = page.Response().Response.Response.StatusCode 1933 } 1934 tracing.EndSpan(ctx, sc, err) 1935 }() 1936 } 1937 for { 1938 next, err := page.fn(ctx, page.ralr) 1939 if err != nil { 1940 return err 1941 } 1942 page.ralr = next 1943 if !next.hasNextLink() || !next.IsEmpty() { 1944 break 1945 } 1946 } 1947 return nil 1948} 1949 1950// Next advances to the next page of values. If there was an error making 1951// the request the page does not advance and the error is returned. 1952// Deprecated: Use NextWithContext() instead. 1953func (page *RegisteredAsnListResultPage) Next() error { 1954 return page.NextWithContext(context.Background()) 1955} 1956 1957// NotDone returns true if the page enumeration should be started or is not yet complete. 1958func (page RegisteredAsnListResultPage) NotDone() bool { 1959 return !page.ralr.IsEmpty() 1960} 1961 1962// Response returns the raw server response from the last page request. 1963func (page RegisteredAsnListResultPage) Response() RegisteredAsnListResult { 1964 return page.ralr 1965} 1966 1967// Values returns the slice of values for the current page or nil if there are no values. 1968func (page RegisteredAsnListResultPage) Values() []RegisteredAsn { 1969 if page.ralr.IsEmpty() { 1970 return nil 1971 } 1972 return *page.ralr.Value 1973} 1974 1975// Creates a new instance of the RegisteredAsnListResultPage type. 1976func NewRegisteredAsnListResultPage(cur RegisteredAsnListResult, getNextPage func(context.Context, RegisteredAsnListResult) (RegisteredAsnListResult, error)) RegisteredAsnListResultPage { 1977 return RegisteredAsnListResultPage{ 1978 fn: getNextPage, 1979 ralr: cur, 1980 } 1981} 1982 1983// RegisteredAsnProperties the properties that define a registered ASN. 1984type RegisteredAsnProperties struct { 1985 // Asn - The customer's ASN from which traffic originates. 1986 Asn *int32 `json:"asn,omitempty"` 1987 // PeeringServicePrefixKey - READ-ONLY; The peering service prefix key that is to be shared with the customer. 1988 PeeringServicePrefixKey *string `json:"peeringServicePrefixKey,omitempty"` 1989 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 1990 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1991} 1992 1993// MarshalJSON is the custom marshaler for RegisteredAsnProperties. 1994func (rap RegisteredAsnProperties) MarshalJSON() ([]byte, error) { 1995 objectMap := make(map[string]interface{}) 1996 if rap.Asn != nil { 1997 objectMap["asn"] = rap.Asn 1998 } 1999 return json.Marshal(objectMap) 2000} 2001 2002// RegisteredPrefix the customer's prefix that is registered by the peering service provider. 2003type RegisteredPrefix struct { 2004 autorest.Response `json:"-"` 2005 // RegisteredPrefixProperties - The properties that define a registered prefix. 2006 *RegisteredPrefixProperties `json:"properties,omitempty"` 2007 // Name - READ-ONLY; The name of the resource. 2008 Name *string `json:"name,omitempty"` 2009 // ID - READ-ONLY; The ID of the resource. 2010 ID *string `json:"id,omitempty"` 2011 // Type - READ-ONLY; The type of the resource. 2012 Type *string `json:"type,omitempty"` 2013} 2014 2015// MarshalJSON is the custom marshaler for RegisteredPrefix. 2016func (rp RegisteredPrefix) MarshalJSON() ([]byte, error) { 2017 objectMap := make(map[string]interface{}) 2018 if rp.RegisteredPrefixProperties != nil { 2019 objectMap["properties"] = rp.RegisteredPrefixProperties 2020 } 2021 return json.Marshal(objectMap) 2022} 2023 2024// UnmarshalJSON is the custom unmarshaler for RegisteredPrefix struct. 2025func (rp *RegisteredPrefix) UnmarshalJSON(body []byte) error { 2026 var m map[string]*json.RawMessage 2027 err := json.Unmarshal(body, &m) 2028 if err != nil { 2029 return err 2030 } 2031 for k, v := range m { 2032 switch k { 2033 case "properties": 2034 if v != nil { 2035 var registeredPrefixProperties RegisteredPrefixProperties 2036 err = json.Unmarshal(*v, ®isteredPrefixProperties) 2037 if err != nil { 2038 return err 2039 } 2040 rp.RegisteredPrefixProperties = ®isteredPrefixProperties 2041 } 2042 case "name": 2043 if v != nil { 2044 var name string 2045 err = json.Unmarshal(*v, &name) 2046 if err != nil { 2047 return err 2048 } 2049 rp.Name = &name 2050 } 2051 case "id": 2052 if v != nil { 2053 var ID string 2054 err = json.Unmarshal(*v, &ID) 2055 if err != nil { 2056 return err 2057 } 2058 rp.ID = &ID 2059 } 2060 case "type": 2061 if v != nil { 2062 var typeVar string 2063 err = json.Unmarshal(*v, &typeVar) 2064 if err != nil { 2065 return err 2066 } 2067 rp.Type = &typeVar 2068 } 2069 } 2070 } 2071 2072 return nil 2073} 2074 2075// RegisteredPrefixListResult the paginated list of peering registered prefixes. 2076type RegisteredPrefixListResult struct { 2077 autorest.Response `json:"-"` 2078 // Value - The list of peering registered prefixes. 2079 Value *[]RegisteredPrefix `json:"value,omitempty"` 2080 // NextLink - The link to fetch the next page of peering registered prefixes. 2081 NextLink *string `json:"nextLink,omitempty"` 2082} 2083 2084// RegisteredPrefixListResultIterator provides access to a complete listing of RegisteredPrefix values. 2085type RegisteredPrefixListResultIterator struct { 2086 i int 2087 page RegisteredPrefixListResultPage 2088} 2089 2090// NextWithContext advances to the next value. If there was an error making 2091// the request the iterator does not advance and the error is returned. 2092func (iter *RegisteredPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { 2093 if tracing.IsEnabled() { 2094 ctx = tracing.StartSpan(ctx, fqdn+"/RegisteredPrefixListResultIterator.NextWithContext") 2095 defer func() { 2096 sc := -1 2097 if iter.Response().Response.Response != nil { 2098 sc = iter.Response().Response.Response.StatusCode 2099 } 2100 tracing.EndSpan(ctx, sc, err) 2101 }() 2102 } 2103 iter.i++ 2104 if iter.i < len(iter.page.Values()) { 2105 return nil 2106 } 2107 err = iter.page.NextWithContext(ctx) 2108 if err != nil { 2109 iter.i-- 2110 return err 2111 } 2112 iter.i = 0 2113 return nil 2114} 2115 2116// Next advances to the next value. If there was an error making 2117// the request the iterator does not advance and the error is returned. 2118// Deprecated: Use NextWithContext() instead. 2119func (iter *RegisteredPrefixListResultIterator) Next() error { 2120 return iter.NextWithContext(context.Background()) 2121} 2122 2123// NotDone returns true if the enumeration should be started or is not yet complete. 2124func (iter RegisteredPrefixListResultIterator) NotDone() bool { 2125 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2126} 2127 2128// Response returns the raw server response from the last page request. 2129func (iter RegisteredPrefixListResultIterator) Response() RegisteredPrefixListResult { 2130 return iter.page.Response() 2131} 2132 2133// Value returns the current value or a zero-initialized value if the 2134// iterator has advanced beyond the end of the collection. 2135func (iter RegisteredPrefixListResultIterator) Value() RegisteredPrefix { 2136 if !iter.page.NotDone() { 2137 return RegisteredPrefix{} 2138 } 2139 return iter.page.Values()[iter.i] 2140} 2141 2142// Creates a new instance of the RegisteredPrefixListResultIterator type. 2143func NewRegisteredPrefixListResultIterator(page RegisteredPrefixListResultPage) RegisteredPrefixListResultIterator { 2144 return RegisteredPrefixListResultIterator{page: page} 2145} 2146 2147// IsEmpty returns true if the ListResult contains no values. 2148func (rplr RegisteredPrefixListResult) IsEmpty() bool { 2149 return rplr.Value == nil || len(*rplr.Value) == 0 2150} 2151 2152// hasNextLink returns true if the NextLink is not empty. 2153func (rplr RegisteredPrefixListResult) hasNextLink() bool { 2154 return rplr.NextLink != nil && len(*rplr.NextLink) != 0 2155} 2156 2157// registeredPrefixListResultPreparer prepares a request to retrieve the next set of results. 2158// It returns nil if no more results exist. 2159func (rplr RegisteredPrefixListResult) registeredPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { 2160 if !rplr.hasNextLink() { 2161 return nil, nil 2162 } 2163 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2164 autorest.AsJSON(), 2165 autorest.AsGet(), 2166 autorest.WithBaseURL(to.String(rplr.NextLink))) 2167} 2168 2169// RegisteredPrefixListResultPage contains a page of RegisteredPrefix values. 2170type RegisteredPrefixListResultPage struct { 2171 fn func(context.Context, RegisteredPrefixListResult) (RegisteredPrefixListResult, error) 2172 rplr RegisteredPrefixListResult 2173} 2174 2175// NextWithContext advances to the next page of values. If there was an error making 2176// the request the page does not advance and the error is returned. 2177func (page *RegisteredPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { 2178 if tracing.IsEnabled() { 2179 ctx = tracing.StartSpan(ctx, fqdn+"/RegisteredPrefixListResultPage.NextWithContext") 2180 defer func() { 2181 sc := -1 2182 if page.Response().Response.Response != nil { 2183 sc = page.Response().Response.Response.StatusCode 2184 } 2185 tracing.EndSpan(ctx, sc, err) 2186 }() 2187 } 2188 for { 2189 next, err := page.fn(ctx, page.rplr) 2190 if err != nil { 2191 return err 2192 } 2193 page.rplr = next 2194 if !next.hasNextLink() || !next.IsEmpty() { 2195 break 2196 } 2197 } 2198 return nil 2199} 2200 2201// Next advances to the next page of values. If there was an error making 2202// the request the page does not advance and the error is returned. 2203// Deprecated: Use NextWithContext() instead. 2204func (page *RegisteredPrefixListResultPage) Next() error { 2205 return page.NextWithContext(context.Background()) 2206} 2207 2208// NotDone returns true if the page enumeration should be started or is not yet complete. 2209func (page RegisteredPrefixListResultPage) NotDone() bool { 2210 return !page.rplr.IsEmpty() 2211} 2212 2213// Response returns the raw server response from the last page request. 2214func (page RegisteredPrefixListResultPage) Response() RegisteredPrefixListResult { 2215 return page.rplr 2216} 2217 2218// Values returns the slice of values for the current page or nil if there are no values. 2219func (page RegisteredPrefixListResultPage) Values() []RegisteredPrefix { 2220 if page.rplr.IsEmpty() { 2221 return nil 2222 } 2223 return *page.rplr.Value 2224} 2225 2226// Creates a new instance of the RegisteredPrefixListResultPage type. 2227func NewRegisteredPrefixListResultPage(cur RegisteredPrefixListResult, getNextPage func(context.Context, RegisteredPrefixListResult) (RegisteredPrefixListResult, error)) RegisteredPrefixListResultPage { 2228 return RegisteredPrefixListResultPage{ 2229 fn: getNextPage, 2230 rplr: cur, 2231 } 2232} 2233 2234// RegisteredPrefixProperties the properties that define a registered prefix. 2235type RegisteredPrefixProperties struct { 2236 // Prefix - The customer's prefix from which traffic originates. 2237 Prefix *string `json:"prefix,omitempty"` 2238 // PrefixValidationState - READ-ONLY; The prefix validation state. Possible values include: 'PrefixValidationStateNone', 'PrefixValidationStateInvalid', 'PrefixValidationStateVerified', 'PrefixValidationStateFailed', 'PrefixValidationStatePending', 'PrefixValidationStateWarning', 'PrefixValidationStateUnknown' 2239 PrefixValidationState PrefixValidationState `json:"prefixValidationState,omitempty"` 2240 // PeeringServicePrefixKey - READ-ONLY; The peering service prefix key that is to be shared with the customer. 2241 PeeringServicePrefixKey *string `json:"peeringServicePrefixKey,omitempty"` 2242 // ErrorMessage - READ-ONLY; The error message associated with the validation state, if any. 2243 ErrorMessage *string `json:"errorMessage,omitempty"` 2244 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 2245 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2246} 2247 2248// MarshalJSON is the custom marshaler for RegisteredPrefixProperties. 2249func (rpp RegisteredPrefixProperties) MarshalJSON() ([]byte, error) { 2250 objectMap := make(map[string]interface{}) 2251 if rpp.Prefix != nil { 2252 objectMap["prefix"] = rpp.Prefix 2253 } 2254 return json.Marshal(objectMap) 2255} 2256 2257// Resource the ARM resource class. 2258type Resource struct { 2259 // Name - READ-ONLY; The name of the resource. 2260 Name *string `json:"name,omitempty"` 2261 // ID - READ-ONLY; The ID of the resource. 2262 ID *string `json:"id,omitempty"` 2263 // Type - READ-ONLY; The type of the resource. 2264 Type *string `json:"type,omitempty"` 2265} 2266 2267// MarshalJSON is the custom marshaler for Resource. 2268func (r Resource) MarshalJSON() ([]byte, error) { 2269 objectMap := make(map[string]interface{}) 2270 return json.Marshal(objectMap) 2271} 2272 2273// ResourceTags the resource tags. 2274type ResourceTags struct { 2275 // Tags - Gets or sets the tags, a dictionary of descriptors arm object 2276 Tags map[string]*string `json:"tags"` 2277} 2278 2279// MarshalJSON is the custom marshaler for ResourceTags. 2280func (rt ResourceTags) MarshalJSON() ([]byte, error) { 2281 objectMap := make(map[string]interface{}) 2282 if rt.Tags != nil { 2283 objectMap["tags"] = rt.Tags 2284 } 2285 return json.Marshal(objectMap) 2286} 2287 2288// Service peering Service 2289type Service struct { 2290 autorest.Response `json:"-"` 2291 // Sku - The SKU that defines the type of the peering service. 2292 Sku *ServiceSku `json:"sku,omitempty"` 2293 // ServiceProperties - The properties that define a peering service. 2294 *ServiceProperties `json:"properties,omitempty"` 2295 // Location - The location of the resource. 2296 Location *string `json:"location,omitempty"` 2297 // Tags - The resource tags. 2298 Tags map[string]*string `json:"tags"` 2299 // Name - READ-ONLY; The name of the resource. 2300 Name *string `json:"name,omitempty"` 2301 // ID - READ-ONLY; The ID of the resource. 2302 ID *string `json:"id,omitempty"` 2303 // Type - READ-ONLY; The type of the resource. 2304 Type *string `json:"type,omitempty"` 2305} 2306 2307// MarshalJSON is the custom marshaler for Service. 2308func (s Service) MarshalJSON() ([]byte, error) { 2309 objectMap := make(map[string]interface{}) 2310 if s.Sku != nil { 2311 objectMap["sku"] = s.Sku 2312 } 2313 if s.ServiceProperties != nil { 2314 objectMap["properties"] = s.ServiceProperties 2315 } 2316 if s.Location != nil { 2317 objectMap["location"] = s.Location 2318 } 2319 if s.Tags != nil { 2320 objectMap["tags"] = s.Tags 2321 } 2322 return json.Marshal(objectMap) 2323} 2324 2325// UnmarshalJSON is the custom unmarshaler for Service struct. 2326func (s *Service) UnmarshalJSON(body []byte) error { 2327 var m map[string]*json.RawMessage 2328 err := json.Unmarshal(body, &m) 2329 if err != nil { 2330 return err 2331 } 2332 for k, v := range m { 2333 switch k { 2334 case "sku": 2335 if v != nil { 2336 var sku ServiceSku 2337 err = json.Unmarshal(*v, &sku) 2338 if err != nil { 2339 return err 2340 } 2341 s.Sku = &sku 2342 } 2343 case "properties": 2344 if v != nil { 2345 var serviceProperties ServiceProperties 2346 err = json.Unmarshal(*v, &serviceProperties) 2347 if err != nil { 2348 return err 2349 } 2350 s.ServiceProperties = &serviceProperties 2351 } 2352 case "location": 2353 if v != nil { 2354 var location string 2355 err = json.Unmarshal(*v, &location) 2356 if err != nil { 2357 return err 2358 } 2359 s.Location = &location 2360 } 2361 case "tags": 2362 if v != nil { 2363 var tags map[string]*string 2364 err = json.Unmarshal(*v, &tags) 2365 if err != nil { 2366 return err 2367 } 2368 s.Tags = tags 2369 } 2370 case "name": 2371 if v != nil { 2372 var name string 2373 err = json.Unmarshal(*v, &name) 2374 if err != nil { 2375 return err 2376 } 2377 s.Name = &name 2378 } 2379 case "id": 2380 if v != nil { 2381 var ID string 2382 err = json.Unmarshal(*v, &ID) 2383 if err != nil { 2384 return err 2385 } 2386 s.ID = &ID 2387 } 2388 case "type": 2389 if v != nil { 2390 var typeVar string 2391 err = json.Unmarshal(*v, &typeVar) 2392 if err != nil { 2393 return err 2394 } 2395 s.Type = &typeVar 2396 } 2397 } 2398 } 2399 2400 return nil 2401} 2402 2403// ServiceCountry the peering service country. 2404type ServiceCountry struct { 2405 // Name - READ-ONLY; The name of the resource. 2406 Name *string `json:"name,omitempty"` 2407 // ID - READ-ONLY; The ID of the resource. 2408 ID *string `json:"id,omitempty"` 2409 // Type - READ-ONLY; The type of the resource. 2410 Type *string `json:"type,omitempty"` 2411} 2412 2413// MarshalJSON is the custom marshaler for ServiceCountry. 2414func (sc ServiceCountry) MarshalJSON() ([]byte, error) { 2415 objectMap := make(map[string]interface{}) 2416 return json.Marshal(objectMap) 2417} 2418 2419// ServiceCountryListResult the paginated list of peering service countries. 2420type ServiceCountryListResult struct { 2421 autorest.Response `json:"-"` 2422 // Value - The list of peering service countries. 2423 Value *[]ServiceCountry `json:"value,omitempty"` 2424 // NextLink - The link to fetch the next page of peering service countries. 2425 NextLink *string `json:"nextLink,omitempty"` 2426} 2427 2428// ServiceCountryListResultIterator provides access to a complete listing of ServiceCountry values. 2429type ServiceCountryListResultIterator struct { 2430 i int 2431 page ServiceCountryListResultPage 2432} 2433 2434// NextWithContext advances to the next value. If there was an error making 2435// the request the iterator does not advance and the error is returned. 2436func (iter *ServiceCountryListResultIterator) NextWithContext(ctx context.Context) (err error) { 2437 if tracing.IsEnabled() { 2438 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceCountryListResultIterator.NextWithContext") 2439 defer func() { 2440 sc := -1 2441 if iter.Response().Response.Response != nil { 2442 sc = iter.Response().Response.Response.StatusCode 2443 } 2444 tracing.EndSpan(ctx, sc, err) 2445 }() 2446 } 2447 iter.i++ 2448 if iter.i < len(iter.page.Values()) { 2449 return nil 2450 } 2451 err = iter.page.NextWithContext(ctx) 2452 if err != nil { 2453 iter.i-- 2454 return err 2455 } 2456 iter.i = 0 2457 return nil 2458} 2459 2460// Next advances to the next value. If there was an error making 2461// the request the iterator does not advance and the error is returned. 2462// Deprecated: Use NextWithContext() instead. 2463func (iter *ServiceCountryListResultIterator) Next() error { 2464 return iter.NextWithContext(context.Background()) 2465} 2466 2467// NotDone returns true if the enumeration should be started or is not yet complete. 2468func (iter ServiceCountryListResultIterator) NotDone() bool { 2469 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2470} 2471 2472// Response returns the raw server response from the last page request. 2473func (iter ServiceCountryListResultIterator) Response() ServiceCountryListResult { 2474 return iter.page.Response() 2475} 2476 2477// Value returns the current value or a zero-initialized value if the 2478// iterator has advanced beyond the end of the collection. 2479func (iter ServiceCountryListResultIterator) Value() ServiceCountry { 2480 if !iter.page.NotDone() { 2481 return ServiceCountry{} 2482 } 2483 return iter.page.Values()[iter.i] 2484} 2485 2486// Creates a new instance of the ServiceCountryListResultIterator type. 2487func NewServiceCountryListResultIterator(page ServiceCountryListResultPage) ServiceCountryListResultIterator { 2488 return ServiceCountryListResultIterator{page: page} 2489} 2490 2491// IsEmpty returns true if the ListResult contains no values. 2492func (sclr ServiceCountryListResult) IsEmpty() bool { 2493 return sclr.Value == nil || len(*sclr.Value) == 0 2494} 2495 2496// hasNextLink returns true if the NextLink is not empty. 2497func (sclr ServiceCountryListResult) hasNextLink() bool { 2498 return sclr.NextLink != nil && len(*sclr.NextLink) != 0 2499} 2500 2501// serviceCountryListResultPreparer prepares a request to retrieve the next set of results. 2502// It returns nil if no more results exist. 2503func (sclr ServiceCountryListResult) serviceCountryListResultPreparer(ctx context.Context) (*http.Request, error) { 2504 if !sclr.hasNextLink() { 2505 return nil, nil 2506 } 2507 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2508 autorest.AsJSON(), 2509 autorest.AsGet(), 2510 autorest.WithBaseURL(to.String(sclr.NextLink))) 2511} 2512 2513// ServiceCountryListResultPage contains a page of ServiceCountry values. 2514type ServiceCountryListResultPage struct { 2515 fn func(context.Context, ServiceCountryListResult) (ServiceCountryListResult, error) 2516 sclr ServiceCountryListResult 2517} 2518 2519// NextWithContext advances to the next page of values. If there was an error making 2520// the request the page does not advance and the error is returned. 2521func (page *ServiceCountryListResultPage) NextWithContext(ctx context.Context) (err error) { 2522 if tracing.IsEnabled() { 2523 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceCountryListResultPage.NextWithContext") 2524 defer func() { 2525 sc := -1 2526 if page.Response().Response.Response != nil { 2527 sc = page.Response().Response.Response.StatusCode 2528 } 2529 tracing.EndSpan(ctx, sc, err) 2530 }() 2531 } 2532 for { 2533 next, err := page.fn(ctx, page.sclr) 2534 if err != nil { 2535 return err 2536 } 2537 page.sclr = next 2538 if !next.hasNextLink() || !next.IsEmpty() { 2539 break 2540 } 2541 } 2542 return nil 2543} 2544 2545// Next advances to the next page of values. If there was an error making 2546// the request the page does not advance and the error is returned. 2547// Deprecated: Use NextWithContext() instead. 2548func (page *ServiceCountryListResultPage) Next() error { 2549 return page.NextWithContext(context.Background()) 2550} 2551 2552// NotDone returns true if the page enumeration should be started or is not yet complete. 2553func (page ServiceCountryListResultPage) NotDone() bool { 2554 return !page.sclr.IsEmpty() 2555} 2556 2557// Response returns the raw server response from the last page request. 2558func (page ServiceCountryListResultPage) Response() ServiceCountryListResult { 2559 return page.sclr 2560} 2561 2562// Values returns the slice of values for the current page or nil if there are no values. 2563func (page ServiceCountryListResultPage) Values() []ServiceCountry { 2564 if page.sclr.IsEmpty() { 2565 return nil 2566 } 2567 return *page.sclr.Value 2568} 2569 2570// Creates a new instance of the ServiceCountryListResultPage type. 2571func NewServiceCountryListResultPage(cur ServiceCountryListResult, getNextPage func(context.Context, ServiceCountryListResult) (ServiceCountryListResult, error)) ServiceCountryListResultPage { 2572 return ServiceCountryListResultPage{ 2573 fn: getNextPage, 2574 sclr: cur, 2575 } 2576} 2577 2578// ServiceListResult the paginated list of peering services. 2579type ServiceListResult struct { 2580 autorest.Response `json:"-"` 2581 // Value - The list of peering services. 2582 Value *[]Service `json:"value,omitempty"` 2583 // NextLink - The link to fetch the next page of peering services. 2584 NextLink *string `json:"nextLink,omitempty"` 2585} 2586 2587// ServiceListResultIterator provides access to a complete listing of Service values. 2588type ServiceListResultIterator struct { 2589 i int 2590 page ServiceListResultPage 2591} 2592 2593// NextWithContext advances to the next value. If there was an error making 2594// the request the iterator does not advance and the error is returned. 2595func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { 2596 if tracing.IsEnabled() { 2597 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.NextWithContext") 2598 defer func() { 2599 sc := -1 2600 if iter.Response().Response.Response != nil { 2601 sc = iter.Response().Response.Response.StatusCode 2602 } 2603 tracing.EndSpan(ctx, sc, err) 2604 }() 2605 } 2606 iter.i++ 2607 if iter.i < len(iter.page.Values()) { 2608 return nil 2609 } 2610 err = iter.page.NextWithContext(ctx) 2611 if err != nil { 2612 iter.i-- 2613 return err 2614 } 2615 iter.i = 0 2616 return nil 2617} 2618 2619// Next advances to the next value. If there was an error making 2620// the request the iterator does not advance and the error is returned. 2621// Deprecated: Use NextWithContext() instead. 2622func (iter *ServiceListResultIterator) Next() error { 2623 return iter.NextWithContext(context.Background()) 2624} 2625 2626// NotDone returns true if the enumeration should be started or is not yet complete. 2627func (iter ServiceListResultIterator) NotDone() bool { 2628 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2629} 2630 2631// Response returns the raw server response from the last page request. 2632func (iter ServiceListResultIterator) Response() ServiceListResult { 2633 return iter.page.Response() 2634} 2635 2636// Value returns the current value or a zero-initialized value if the 2637// iterator has advanced beyond the end of the collection. 2638func (iter ServiceListResultIterator) Value() Service { 2639 if !iter.page.NotDone() { 2640 return Service{} 2641 } 2642 return iter.page.Values()[iter.i] 2643} 2644 2645// Creates a new instance of the ServiceListResultIterator type. 2646func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { 2647 return ServiceListResultIterator{page: page} 2648} 2649 2650// IsEmpty returns true if the ListResult contains no values. 2651func (slr ServiceListResult) IsEmpty() bool { 2652 return slr.Value == nil || len(*slr.Value) == 0 2653} 2654 2655// hasNextLink returns true if the NextLink is not empty. 2656func (slr ServiceListResult) hasNextLink() bool { 2657 return slr.NextLink != nil && len(*slr.NextLink) != 0 2658} 2659 2660// serviceListResultPreparer prepares a request to retrieve the next set of results. 2661// It returns nil if no more results exist. 2662func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) { 2663 if !slr.hasNextLink() { 2664 return nil, nil 2665 } 2666 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2667 autorest.AsJSON(), 2668 autorest.AsGet(), 2669 autorest.WithBaseURL(to.String(slr.NextLink))) 2670} 2671 2672// ServiceListResultPage contains a page of Service values. 2673type ServiceListResultPage struct { 2674 fn func(context.Context, ServiceListResult) (ServiceListResult, error) 2675 slr ServiceListResult 2676} 2677 2678// NextWithContext advances to the next page of values. If there was an error making 2679// the request the page does not advance and the error is returned. 2680func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { 2681 if tracing.IsEnabled() { 2682 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.NextWithContext") 2683 defer func() { 2684 sc := -1 2685 if page.Response().Response.Response != nil { 2686 sc = page.Response().Response.Response.StatusCode 2687 } 2688 tracing.EndSpan(ctx, sc, err) 2689 }() 2690 } 2691 for { 2692 next, err := page.fn(ctx, page.slr) 2693 if err != nil { 2694 return err 2695 } 2696 page.slr = next 2697 if !next.hasNextLink() || !next.IsEmpty() { 2698 break 2699 } 2700 } 2701 return nil 2702} 2703 2704// Next advances to the next page of values. If there was an error making 2705// the request the page does not advance and the error is returned. 2706// Deprecated: Use NextWithContext() instead. 2707func (page *ServiceListResultPage) Next() error { 2708 return page.NextWithContext(context.Background()) 2709} 2710 2711// NotDone returns true if the page enumeration should be started or is not yet complete. 2712func (page ServiceListResultPage) NotDone() bool { 2713 return !page.slr.IsEmpty() 2714} 2715 2716// Response returns the raw server response from the last page request. 2717func (page ServiceListResultPage) Response() ServiceListResult { 2718 return page.slr 2719} 2720 2721// Values returns the slice of values for the current page or nil if there are no values. 2722func (page ServiceListResultPage) Values() []Service { 2723 if page.slr.IsEmpty() { 2724 return nil 2725 } 2726 return *page.slr.Value 2727} 2728 2729// Creates a new instance of the ServiceListResultPage type. 2730func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { 2731 return ServiceListResultPage{ 2732 fn: getNextPage, 2733 slr: cur, 2734 } 2735} 2736 2737// ServiceLocation the peering service location. 2738type ServiceLocation struct { 2739 // ServiceLocationProperties - The properties that define a peering service location. 2740 *ServiceLocationProperties `json:"properties,omitempty"` 2741 // Name - READ-ONLY; The name of the resource. 2742 Name *string `json:"name,omitempty"` 2743 // ID - READ-ONLY; The ID of the resource. 2744 ID *string `json:"id,omitempty"` 2745 // Type - READ-ONLY; The type of the resource. 2746 Type *string `json:"type,omitempty"` 2747} 2748 2749// MarshalJSON is the custom marshaler for ServiceLocation. 2750func (sl ServiceLocation) MarshalJSON() ([]byte, error) { 2751 objectMap := make(map[string]interface{}) 2752 if sl.ServiceLocationProperties != nil { 2753 objectMap["properties"] = sl.ServiceLocationProperties 2754 } 2755 return json.Marshal(objectMap) 2756} 2757 2758// UnmarshalJSON is the custom unmarshaler for ServiceLocation struct. 2759func (sl *ServiceLocation) UnmarshalJSON(body []byte) error { 2760 var m map[string]*json.RawMessage 2761 err := json.Unmarshal(body, &m) 2762 if err != nil { 2763 return err 2764 } 2765 for k, v := range m { 2766 switch k { 2767 case "properties": 2768 if v != nil { 2769 var serviceLocationProperties ServiceLocationProperties 2770 err = json.Unmarshal(*v, &serviceLocationProperties) 2771 if err != nil { 2772 return err 2773 } 2774 sl.ServiceLocationProperties = &serviceLocationProperties 2775 } 2776 case "name": 2777 if v != nil { 2778 var name string 2779 err = json.Unmarshal(*v, &name) 2780 if err != nil { 2781 return err 2782 } 2783 sl.Name = &name 2784 } 2785 case "id": 2786 if v != nil { 2787 var ID string 2788 err = json.Unmarshal(*v, &ID) 2789 if err != nil { 2790 return err 2791 } 2792 sl.ID = &ID 2793 } 2794 case "type": 2795 if v != nil { 2796 var typeVar string 2797 err = json.Unmarshal(*v, &typeVar) 2798 if err != nil { 2799 return err 2800 } 2801 sl.Type = &typeVar 2802 } 2803 } 2804 } 2805 2806 return nil 2807} 2808 2809// ServiceLocationListResult the paginated list of peering service locations. 2810type ServiceLocationListResult struct { 2811 autorest.Response `json:"-"` 2812 // Value - The list of peering service locations. 2813 Value *[]ServiceLocation `json:"value,omitempty"` 2814 // NextLink - The link to fetch the next page of peering service locations. 2815 NextLink *string `json:"nextLink,omitempty"` 2816} 2817 2818// ServiceLocationListResultIterator provides access to a complete listing of ServiceLocation values. 2819type ServiceLocationListResultIterator struct { 2820 i int 2821 page ServiceLocationListResultPage 2822} 2823 2824// NextWithContext advances to the next value. If there was an error making 2825// the request the iterator does not advance and the error is returned. 2826func (iter *ServiceLocationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2827 if tracing.IsEnabled() { 2828 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceLocationListResultIterator.NextWithContext") 2829 defer func() { 2830 sc := -1 2831 if iter.Response().Response.Response != nil { 2832 sc = iter.Response().Response.Response.StatusCode 2833 } 2834 tracing.EndSpan(ctx, sc, err) 2835 }() 2836 } 2837 iter.i++ 2838 if iter.i < len(iter.page.Values()) { 2839 return nil 2840 } 2841 err = iter.page.NextWithContext(ctx) 2842 if err != nil { 2843 iter.i-- 2844 return err 2845 } 2846 iter.i = 0 2847 return nil 2848} 2849 2850// Next advances to the next value. If there was an error making 2851// the request the iterator does not advance and the error is returned. 2852// Deprecated: Use NextWithContext() instead. 2853func (iter *ServiceLocationListResultIterator) Next() error { 2854 return iter.NextWithContext(context.Background()) 2855} 2856 2857// NotDone returns true if the enumeration should be started or is not yet complete. 2858func (iter ServiceLocationListResultIterator) NotDone() bool { 2859 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2860} 2861 2862// Response returns the raw server response from the last page request. 2863func (iter ServiceLocationListResultIterator) Response() ServiceLocationListResult { 2864 return iter.page.Response() 2865} 2866 2867// Value returns the current value or a zero-initialized value if the 2868// iterator has advanced beyond the end of the collection. 2869func (iter ServiceLocationListResultIterator) Value() ServiceLocation { 2870 if !iter.page.NotDone() { 2871 return ServiceLocation{} 2872 } 2873 return iter.page.Values()[iter.i] 2874} 2875 2876// Creates a new instance of the ServiceLocationListResultIterator type. 2877func NewServiceLocationListResultIterator(page ServiceLocationListResultPage) ServiceLocationListResultIterator { 2878 return ServiceLocationListResultIterator{page: page} 2879} 2880 2881// IsEmpty returns true if the ListResult contains no values. 2882func (sllr ServiceLocationListResult) IsEmpty() bool { 2883 return sllr.Value == nil || len(*sllr.Value) == 0 2884} 2885 2886// hasNextLink returns true if the NextLink is not empty. 2887func (sllr ServiceLocationListResult) hasNextLink() bool { 2888 return sllr.NextLink != nil && len(*sllr.NextLink) != 0 2889} 2890 2891// serviceLocationListResultPreparer prepares a request to retrieve the next set of results. 2892// It returns nil if no more results exist. 2893func (sllr ServiceLocationListResult) serviceLocationListResultPreparer(ctx context.Context) (*http.Request, error) { 2894 if !sllr.hasNextLink() { 2895 return nil, nil 2896 } 2897 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2898 autorest.AsJSON(), 2899 autorest.AsGet(), 2900 autorest.WithBaseURL(to.String(sllr.NextLink))) 2901} 2902 2903// ServiceLocationListResultPage contains a page of ServiceLocation values. 2904type ServiceLocationListResultPage struct { 2905 fn func(context.Context, ServiceLocationListResult) (ServiceLocationListResult, error) 2906 sllr ServiceLocationListResult 2907} 2908 2909// NextWithContext advances to the next page of values. If there was an error making 2910// the request the page does not advance and the error is returned. 2911func (page *ServiceLocationListResultPage) NextWithContext(ctx context.Context) (err error) { 2912 if tracing.IsEnabled() { 2913 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceLocationListResultPage.NextWithContext") 2914 defer func() { 2915 sc := -1 2916 if page.Response().Response.Response != nil { 2917 sc = page.Response().Response.Response.StatusCode 2918 } 2919 tracing.EndSpan(ctx, sc, err) 2920 }() 2921 } 2922 for { 2923 next, err := page.fn(ctx, page.sllr) 2924 if err != nil { 2925 return err 2926 } 2927 page.sllr = next 2928 if !next.hasNextLink() || !next.IsEmpty() { 2929 break 2930 } 2931 } 2932 return nil 2933} 2934 2935// Next advances to the next page of values. If there was an error making 2936// the request the page does not advance and the error is returned. 2937// Deprecated: Use NextWithContext() instead. 2938func (page *ServiceLocationListResultPage) Next() error { 2939 return page.NextWithContext(context.Background()) 2940} 2941 2942// NotDone returns true if the page enumeration should be started or is not yet complete. 2943func (page ServiceLocationListResultPage) NotDone() bool { 2944 return !page.sllr.IsEmpty() 2945} 2946 2947// Response returns the raw server response from the last page request. 2948func (page ServiceLocationListResultPage) Response() ServiceLocationListResult { 2949 return page.sllr 2950} 2951 2952// Values returns the slice of values for the current page or nil if there are no values. 2953func (page ServiceLocationListResultPage) Values() []ServiceLocation { 2954 if page.sllr.IsEmpty() { 2955 return nil 2956 } 2957 return *page.sllr.Value 2958} 2959 2960// Creates a new instance of the ServiceLocationListResultPage type. 2961func NewServiceLocationListResultPage(cur ServiceLocationListResult, getNextPage func(context.Context, ServiceLocationListResult) (ServiceLocationListResult, error)) ServiceLocationListResultPage { 2962 return ServiceLocationListResultPage{ 2963 fn: getNextPage, 2964 sllr: cur, 2965 } 2966} 2967 2968// ServiceLocationProperties the properties that define connectivity to the Peering Service Location. 2969type ServiceLocationProperties struct { 2970 // Country - Country of the customer 2971 Country *string `json:"country,omitempty"` 2972 // State - State of the customer 2973 State *string `json:"state,omitempty"` 2974 // AzureRegion - Azure region for the location 2975 AzureRegion *string `json:"azureRegion,omitempty"` 2976} 2977 2978// ServicePrefix the peering service prefix class. 2979type ServicePrefix struct { 2980 autorest.Response `json:"-"` 2981 // ServicePrefixProperties - Gets or sets the peering prefix properties. 2982 *ServicePrefixProperties `json:"properties,omitempty"` 2983 // Name - READ-ONLY; The name of the resource. 2984 Name *string `json:"name,omitempty"` 2985 // ID - READ-ONLY; The ID of the resource. 2986 ID *string `json:"id,omitempty"` 2987 // Type - READ-ONLY; The type of the resource. 2988 Type *string `json:"type,omitempty"` 2989} 2990 2991// MarshalJSON is the custom marshaler for ServicePrefix. 2992func (sp ServicePrefix) MarshalJSON() ([]byte, error) { 2993 objectMap := make(map[string]interface{}) 2994 if sp.ServicePrefixProperties != nil { 2995 objectMap["properties"] = sp.ServicePrefixProperties 2996 } 2997 return json.Marshal(objectMap) 2998} 2999 3000// UnmarshalJSON is the custom unmarshaler for ServicePrefix struct. 3001func (sp *ServicePrefix) UnmarshalJSON(body []byte) error { 3002 var m map[string]*json.RawMessage 3003 err := json.Unmarshal(body, &m) 3004 if err != nil { 3005 return err 3006 } 3007 for k, v := range m { 3008 switch k { 3009 case "properties": 3010 if v != nil { 3011 var servicePrefixProperties ServicePrefixProperties 3012 err = json.Unmarshal(*v, &servicePrefixProperties) 3013 if err != nil { 3014 return err 3015 } 3016 sp.ServicePrefixProperties = &servicePrefixProperties 3017 } 3018 case "name": 3019 if v != nil { 3020 var name string 3021 err = json.Unmarshal(*v, &name) 3022 if err != nil { 3023 return err 3024 } 3025 sp.Name = &name 3026 } 3027 case "id": 3028 if v != nil { 3029 var ID string 3030 err = json.Unmarshal(*v, &ID) 3031 if err != nil { 3032 return err 3033 } 3034 sp.ID = &ID 3035 } 3036 case "type": 3037 if v != nil { 3038 var typeVar string 3039 err = json.Unmarshal(*v, &typeVar) 3040 if err != nil { 3041 return err 3042 } 3043 sp.Type = &typeVar 3044 } 3045 } 3046 } 3047 3048 return nil 3049} 3050 3051// ServicePrefixEvent the details of the event associated with a prefix. 3052type ServicePrefixEvent struct { 3053 // EventTimestamp - READ-ONLY; The timestamp of the event associated with a prefix. 3054 EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` 3055 // EventType - READ-ONLY; The type of the event associated with a prefix. 3056 EventType *string `json:"eventType,omitempty"` 3057 // EventSummary - READ-ONLY; The summary of the event associated with a prefix. 3058 EventSummary *string `json:"eventSummary,omitempty"` 3059 // EventLevel - READ-ONLY; The level of the event associated with a prefix. 3060 EventLevel *string `json:"eventLevel,omitempty"` 3061 // EventDescription - READ-ONLY; The description of the event associated with a prefix. 3062 EventDescription *string `json:"eventDescription,omitempty"` 3063} 3064 3065// MarshalJSON is the custom marshaler for ServicePrefixEvent. 3066func (spe ServicePrefixEvent) MarshalJSON() ([]byte, error) { 3067 objectMap := make(map[string]interface{}) 3068 return json.Marshal(objectMap) 3069} 3070 3071// ServicePrefixListResult the paginated list of peering service prefixes. 3072type ServicePrefixListResult struct { 3073 autorest.Response `json:"-"` 3074 // Value - The list of peering service prefixes. 3075 Value *[]ServicePrefix `json:"value,omitempty"` 3076 // NextLink - The link to fetch the next page of peering service prefixes. 3077 NextLink *string `json:"nextLink,omitempty"` 3078} 3079 3080// ServicePrefixListResultIterator provides access to a complete listing of ServicePrefix values. 3081type ServicePrefixListResultIterator struct { 3082 i int 3083 page ServicePrefixListResultPage 3084} 3085 3086// NextWithContext advances to the next value. If there was an error making 3087// the request the iterator does not advance and the error is returned. 3088func (iter *ServicePrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { 3089 if tracing.IsEnabled() { 3090 ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrefixListResultIterator.NextWithContext") 3091 defer func() { 3092 sc := -1 3093 if iter.Response().Response.Response != nil { 3094 sc = iter.Response().Response.Response.StatusCode 3095 } 3096 tracing.EndSpan(ctx, sc, err) 3097 }() 3098 } 3099 iter.i++ 3100 if iter.i < len(iter.page.Values()) { 3101 return nil 3102 } 3103 err = iter.page.NextWithContext(ctx) 3104 if err != nil { 3105 iter.i-- 3106 return err 3107 } 3108 iter.i = 0 3109 return nil 3110} 3111 3112// Next advances to the next value. If there was an error making 3113// the request the iterator does not advance and the error is returned. 3114// Deprecated: Use NextWithContext() instead. 3115func (iter *ServicePrefixListResultIterator) Next() error { 3116 return iter.NextWithContext(context.Background()) 3117} 3118 3119// NotDone returns true if the enumeration should be started or is not yet complete. 3120func (iter ServicePrefixListResultIterator) NotDone() bool { 3121 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3122} 3123 3124// Response returns the raw server response from the last page request. 3125func (iter ServicePrefixListResultIterator) Response() ServicePrefixListResult { 3126 return iter.page.Response() 3127} 3128 3129// Value returns the current value or a zero-initialized value if the 3130// iterator has advanced beyond the end of the collection. 3131func (iter ServicePrefixListResultIterator) Value() ServicePrefix { 3132 if !iter.page.NotDone() { 3133 return ServicePrefix{} 3134 } 3135 return iter.page.Values()[iter.i] 3136} 3137 3138// Creates a new instance of the ServicePrefixListResultIterator type. 3139func NewServicePrefixListResultIterator(page ServicePrefixListResultPage) ServicePrefixListResultIterator { 3140 return ServicePrefixListResultIterator{page: page} 3141} 3142 3143// IsEmpty returns true if the ListResult contains no values. 3144func (splr ServicePrefixListResult) IsEmpty() bool { 3145 return splr.Value == nil || len(*splr.Value) == 0 3146} 3147 3148// hasNextLink returns true if the NextLink is not empty. 3149func (splr ServicePrefixListResult) hasNextLink() bool { 3150 return splr.NextLink != nil && len(*splr.NextLink) != 0 3151} 3152 3153// servicePrefixListResultPreparer prepares a request to retrieve the next set of results. 3154// It returns nil if no more results exist. 3155func (splr ServicePrefixListResult) servicePrefixListResultPreparer(ctx context.Context) (*http.Request, error) { 3156 if !splr.hasNextLink() { 3157 return nil, nil 3158 } 3159 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3160 autorest.AsJSON(), 3161 autorest.AsGet(), 3162 autorest.WithBaseURL(to.String(splr.NextLink))) 3163} 3164 3165// ServicePrefixListResultPage contains a page of ServicePrefix values. 3166type ServicePrefixListResultPage struct { 3167 fn func(context.Context, ServicePrefixListResult) (ServicePrefixListResult, error) 3168 splr ServicePrefixListResult 3169} 3170 3171// NextWithContext advances to the next page of values. If there was an error making 3172// the request the page does not advance and the error is returned. 3173func (page *ServicePrefixListResultPage) NextWithContext(ctx context.Context) (err error) { 3174 if tracing.IsEnabled() { 3175 ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrefixListResultPage.NextWithContext") 3176 defer func() { 3177 sc := -1 3178 if page.Response().Response.Response != nil { 3179 sc = page.Response().Response.Response.StatusCode 3180 } 3181 tracing.EndSpan(ctx, sc, err) 3182 }() 3183 } 3184 for { 3185 next, err := page.fn(ctx, page.splr) 3186 if err != nil { 3187 return err 3188 } 3189 page.splr = next 3190 if !next.hasNextLink() || !next.IsEmpty() { 3191 break 3192 } 3193 } 3194 return nil 3195} 3196 3197// Next advances to the next page of values. If there was an error making 3198// the request the page does not advance and the error is returned. 3199// Deprecated: Use NextWithContext() instead. 3200func (page *ServicePrefixListResultPage) Next() error { 3201 return page.NextWithContext(context.Background()) 3202} 3203 3204// NotDone returns true if the page enumeration should be started or is not yet complete. 3205func (page ServicePrefixListResultPage) NotDone() bool { 3206 return !page.splr.IsEmpty() 3207} 3208 3209// Response returns the raw server response from the last page request. 3210func (page ServicePrefixListResultPage) Response() ServicePrefixListResult { 3211 return page.splr 3212} 3213 3214// Values returns the slice of values for the current page or nil if there are no values. 3215func (page ServicePrefixListResultPage) Values() []ServicePrefix { 3216 if page.splr.IsEmpty() { 3217 return nil 3218 } 3219 return *page.splr.Value 3220} 3221 3222// Creates a new instance of the ServicePrefixListResultPage type. 3223func NewServicePrefixListResultPage(cur ServicePrefixListResult, getNextPage func(context.Context, ServicePrefixListResult) (ServicePrefixListResult, error)) ServicePrefixListResultPage { 3224 return ServicePrefixListResultPage{ 3225 fn: getNextPage, 3226 splr: cur, 3227 } 3228} 3229 3230// ServicePrefixProperties the peering service prefix properties class. 3231type ServicePrefixProperties struct { 3232 // Prefix - The prefix from which your traffic originates. 3233 Prefix *string `json:"prefix,omitempty"` 3234 // PrefixValidationState - READ-ONLY; The prefix validation state. Possible values include: 'PrefixValidationStateNone', 'PrefixValidationStateInvalid', 'PrefixValidationStateVerified', 'PrefixValidationStateFailed', 'PrefixValidationStatePending', 'PrefixValidationStateWarning', 'PrefixValidationStateUnknown' 3235 PrefixValidationState PrefixValidationState `json:"prefixValidationState,omitempty"` 3236 // LearnedType - READ-ONLY; The prefix learned type. Possible values include: 'LearnedTypeNone', 'LearnedTypeViaServiceProvider', 'LearnedTypeViaSession' 3237 LearnedType LearnedType `json:"learnedType,omitempty"` 3238 // ErrorMessage - READ-ONLY; The error message for validation state 3239 ErrorMessage *string `json:"errorMessage,omitempty"` 3240 // Events - READ-ONLY; The list of events for peering service prefix 3241 Events *[]ServicePrefixEvent `json:"events,omitempty"` 3242 // PeeringServicePrefixKey - The peering service prefix key 3243 PeeringServicePrefixKey *string `json:"peeringServicePrefixKey,omitempty"` 3244 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 3245 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3246} 3247 3248// MarshalJSON is the custom marshaler for ServicePrefixProperties. 3249func (spp ServicePrefixProperties) MarshalJSON() ([]byte, error) { 3250 objectMap := make(map[string]interface{}) 3251 if spp.Prefix != nil { 3252 objectMap["prefix"] = spp.Prefix 3253 } 3254 if spp.PeeringServicePrefixKey != nil { 3255 objectMap["peeringServicePrefixKey"] = spp.PeeringServicePrefixKey 3256 } 3257 return json.Marshal(objectMap) 3258} 3259 3260// ServiceProperties the properties that define connectivity to the Peering Service. 3261type ServiceProperties struct { 3262 // PeeringServiceLocation - The PeeringServiceLocation of the Customer. 3263 PeeringServiceLocation *string `json:"peeringServiceLocation,omitempty"` 3264 // PeeringServiceProvider - The MAPS Provider Name. 3265 PeeringServiceProvider *string `json:"peeringServiceProvider,omitempty"` 3266 // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' 3267 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3268} 3269 3270// MarshalJSON is the custom marshaler for ServiceProperties. 3271func (sp ServiceProperties) MarshalJSON() ([]byte, error) { 3272 objectMap := make(map[string]interface{}) 3273 if sp.PeeringServiceLocation != nil { 3274 objectMap["peeringServiceLocation"] = sp.PeeringServiceLocation 3275 } 3276 if sp.PeeringServiceProvider != nil { 3277 objectMap["peeringServiceProvider"] = sp.PeeringServiceProvider 3278 } 3279 return json.Marshal(objectMap) 3280} 3281 3282// ServiceProvider peeringService provider 3283type ServiceProvider struct { 3284 // ServiceProviderProperties - The properties that define a peering service provider. 3285 *ServiceProviderProperties `json:"properties,omitempty"` 3286 // Name - READ-ONLY; The name of the resource. 3287 Name *string `json:"name,omitempty"` 3288 // ID - READ-ONLY; The ID of the resource. 3289 ID *string `json:"id,omitempty"` 3290 // Type - READ-ONLY; The type of the resource. 3291 Type *string `json:"type,omitempty"` 3292} 3293 3294// MarshalJSON is the custom marshaler for ServiceProvider. 3295func (sp ServiceProvider) MarshalJSON() ([]byte, error) { 3296 objectMap := make(map[string]interface{}) 3297 if sp.ServiceProviderProperties != nil { 3298 objectMap["properties"] = sp.ServiceProviderProperties 3299 } 3300 return json.Marshal(objectMap) 3301} 3302 3303// UnmarshalJSON is the custom unmarshaler for ServiceProvider struct. 3304func (sp *ServiceProvider) UnmarshalJSON(body []byte) error { 3305 var m map[string]*json.RawMessage 3306 err := json.Unmarshal(body, &m) 3307 if err != nil { 3308 return err 3309 } 3310 for k, v := range m { 3311 switch k { 3312 case "properties": 3313 if v != nil { 3314 var serviceProviderProperties ServiceProviderProperties 3315 err = json.Unmarshal(*v, &serviceProviderProperties) 3316 if err != nil { 3317 return err 3318 } 3319 sp.ServiceProviderProperties = &serviceProviderProperties 3320 } 3321 case "name": 3322 if v != nil { 3323 var name string 3324 err = json.Unmarshal(*v, &name) 3325 if err != nil { 3326 return err 3327 } 3328 sp.Name = &name 3329 } 3330 case "id": 3331 if v != nil { 3332 var ID string 3333 err = json.Unmarshal(*v, &ID) 3334 if err != nil { 3335 return err 3336 } 3337 sp.ID = &ID 3338 } 3339 case "type": 3340 if v != nil { 3341 var typeVar string 3342 err = json.Unmarshal(*v, &typeVar) 3343 if err != nil { 3344 return err 3345 } 3346 sp.Type = &typeVar 3347 } 3348 } 3349 } 3350 3351 return nil 3352} 3353 3354// ServiceProviderListResult the paginated list of peering service providers. 3355type ServiceProviderListResult struct { 3356 autorest.Response `json:"-"` 3357 // Value - The list of peering service providers. 3358 Value *[]ServiceProvider `json:"value,omitempty"` 3359 // NextLink - The link to fetch the next page of peering service providers. 3360 NextLink *string `json:"nextLink,omitempty"` 3361} 3362 3363// ServiceProviderListResultIterator provides access to a complete listing of ServiceProvider values. 3364type ServiceProviderListResultIterator struct { 3365 i int 3366 page ServiceProviderListResultPage 3367} 3368 3369// NextWithContext advances to the next value. If there was an error making 3370// the request the iterator does not advance and the error is returned. 3371func (iter *ServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { 3372 if tracing.IsEnabled() { 3373 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceProviderListResultIterator.NextWithContext") 3374 defer func() { 3375 sc := -1 3376 if iter.Response().Response.Response != nil { 3377 sc = iter.Response().Response.Response.StatusCode 3378 } 3379 tracing.EndSpan(ctx, sc, err) 3380 }() 3381 } 3382 iter.i++ 3383 if iter.i < len(iter.page.Values()) { 3384 return nil 3385 } 3386 err = iter.page.NextWithContext(ctx) 3387 if err != nil { 3388 iter.i-- 3389 return err 3390 } 3391 iter.i = 0 3392 return nil 3393} 3394 3395// Next advances to the next value. If there was an error making 3396// the request the iterator does not advance and the error is returned. 3397// Deprecated: Use NextWithContext() instead. 3398func (iter *ServiceProviderListResultIterator) Next() error { 3399 return iter.NextWithContext(context.Background()) 3400} 3401 3402// NotDone returns true if the enumeration should be started or is not yet complete. 3403func (iter ServiceProviderListResultIterator) NotDone() bool { 3404 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3405} 3406 3407// Response returns the raw server response from the last page request. 3408func (iter ServiceProviderListResultIterator) Response() ServiceProviderListResult { 3409 return iter.page.Response() 3410} 3411 3412// Value returns the current value or a zero-initialized value if the 3413// iterator has advanced beyond the end of the collection. 3414func (iter ServiceProviderListResultIterator) Value() ServiceProvider { 3415 if !iter.page.NotDone() { 3416 return ServiceProvider{} 3417 } 3418 return iter.page.Values()[iter.i] 3419} 3420 3421// Creates a new instance of the ServiceProviderListResultIterator type. 3422func NewServiceProviderListResultIterator(page ServiceProviderListResultPage) ServiceProviderListResultIterator { 3423 return ServiceProviderListResultIterator{page: page} 3424} 3425 3426// IsEmpty returns true if the ListResult contains no values. 3427func (splr ServiceProviderListResult) IsEmpty() bool { 3428 return splr.Value == nil || len(*splr.Value) == 0 3429} 3430 3431// hasNextLink returns true if the NextLink is not empty. 3432func (splr ServiceProviderListResult) hasNextLink() bool { 3433 return splr.NextLink != nil && len(*splr.NextLink) != 0 3434} 3435 3436// serviceProviderListResultPreparer prepares a request to retrieve the next set of results. 3437// It returns nil if no more results exist. 3438func (splr ServiceProviderListResult) serviceProviderListResultPreparer(ctx context.Context) (*http.Request, error) { 3439 if !splr.hasNextLink() { 3440 return nil, nil 3441 } 3442 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3443 autorest.AsJSON(), 3444 autorest.AsGet(), 3445 autorest.WithBaseURL(to.String(splr.NextLink))) 3446} 3447 3448// ServiceProviderListResultPage contains a page of ServiceProvider values. 3449type ServiceProviderListResultPage struct { 3450 fn func(context.Context, ServiceProviderListResult) (ServiceProviderListResult, error) 3451 splr ServiceProviderListResult 3452} 3453 3454// NextWithContext advances to the next page of values. If there was an error making 3455// the request the page does not advance and the error is returned. 3456func (page *ServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) { 3457 if tracing.IsEnabled() { 3458 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceProviderListResultPage.NextWithContext") 3459 defer func() { 3460 sc := -1 3461 if page.Response().Response.Response != nil { 3462 sc = page.Response().Response.Response.StatusCode 3463 } 3464 tracing.EndSpan(ctx, sc, err) 3465 }() 3466 } 3467 for { 3468 next, err := page.fn(ctx, page.splr) 3469 if err != nil { 3470 return err 3471 } 3472 page.splr = next 3473 if !next.hasNextLink() || !next.IsEmpty() { 3474 break 3475 } 3476 } 3477 return nil 3478} 3479 3480// Next advances to the next page of values. If there was an error making 3481// the request the page does not advance and the error is returned. 3482// Deprecated: Use NextWithContext() instead. 3483func (page *ServiceProviderListResultPage) Next() error { 3484 return page.NextWithContext(context.Background()) 3485} 3486 3487// NotDone returns true if the page enumeration should be started or is not yet complete. 3488func (page ServiceProviderListResultPage) NotDone() bool { 3489 return !page.splr.IsEmpty() 3490} 3491 3492// Response returns the raw server response from the last page request. 3493func (page ServiceProviderListResultPage) Response() ServiceProviderListResult { 3494 return page.splr 3495} 3496 3497// Values returns the slice of values for the current page or nil if there are no values. 3498func (page ServiceProviderListResultPage) Values() []ServiceProvider { 3499 if page.splr.IsEmpty() { 3500 return nil 3501 } 3502 return *page.splr.Value 3503} 3504 3505// Creates a new instance of the ServiceProviderListResultPage type. 3506func NewServiceProviderListResultPage(cur ServiceProviderListResult, getNextPage func(context.Context, ServiceProviderListResult) (ServiceProviderListResult, error)) ServiceProviderListResultPage { 3507 return ServiceProviderListResultPage{ 3508 fn: getNextPage, 3509 splr: cur, 3510 } 3511} 3512 3513// ServiceProviderProperties the properties that define connectivity to the Peering Service Provider. 3514type ServiceProviderProperties struct { 3515 // ServiceProviderName - The name of the service provider. 3516 ServiceProviderName *string `json:"serviceProviderName,omitempty"` 3517} 3518 3519// ServiceSku the SKU that defines the type of the peering service. 3520type ServiceSku struct { 3521 // Name - The name of the peering service SKU. 3522 Name *string `json:"name,omitempty"` 3523} 3524 3525// Sku the SKU that defines the tier and kind of the peering. 3526type Sku struct { 3527 // Name - The name of the peering SKU. 3528 Name *string `json:"name,omitempty"` 3529 // Tier - The tier of the peering SKU. Possible values include: 'Basic', 'Premium' 3530 Tier Tier `json:"tier,omitempty"` 3531 // Family - The family of the peering SKU. Possible values include: 'Direct', 'Exchange' 3532 Family Family `json:"family,omitempty"` 3533 // Size - The size of the peering SKU. Possible values include: 'Free', 'Metered', 'Unlimited' 3534 Size Size `json:"size,omitempty"` 3535} 3536 3537// String ... 3538type String struct { 3539 autorest.Response `json:"-"` 3540 // Value - Possible values include: 'Available', 'Unavailable' 3541 Value *string `json:"value,omitempty"` 3542} 3543 3544// SubResource the sub resource. 3545type SubResource struct { 3546 // ID - The identifier of the referenced resource. 3547 ID *string `json:"id,omitempty"` 3548} 3549