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