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