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