1package managednetwork
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/to"
15	"github.com/Azure/go-autorest/tracing"
16	"net/http"
17)
18
19// The package's fully qualified name.
20const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/managednetwork/mgmt/2019-06-01-preview/managednetwork"
21
22// ConnectivityCollection the collection of Connectivity related groups and policies within the Managed
23// Network
24type ConnectivityCollection struct {
25	// Groups - READ-ONLY; The collection of connectivity related Managed Network Groups within the Managed Network
26	Groups *[]Group `json:"groups,omitempty"`
27	// Peerings - READ-ONLY; The collection of Managed Network Peering Policies within the Managed Network
28	Peerings *[]PeeringPolicy `json:"peerings,omitempty"`
29}
30
31// MarshalJSON is the custom marshaler for ConnectivityCollection.
32func (cc ConnectivityCollection) MarshalJSON() ([]byte, error) {
33	objectMap := make(map[string]interface{})
34	return json.Marshal(objectMap)
35}
36
37// ErrorResponse the error response that indicates why an operation has failed.
38type ErrorResponse struct {
39	// Code - READ-ONLY; The error code.
40	Code *string `json:"code,omitempty"`
41	// Message - READ-ONLY; The error message.
42	Message *string `json:"message,omitempty"`
43}
44
45// MarshalJSON is the custom marshaler for ErrorResponse.
46func (er ErrorResponse) MarshalJSON() ([]byte, error) {
47	objectMap := make(map[string]interface{})
48	return json.Marshal(objectMap)
49}
50
51// Group the Managed Network Group resource
52type Group struct {
53	autorest.Response `json:"-"`
54	// GroupProperties - Gets or sets the properties of a network group
55	*GroupProperties `json:"properties,omitempty"`
56	// Kind - Responsibility role under which this Managed Network Group will be created. Possible values include: 'Connectivity'
57	Kind Kind `json:"kind,omitempty"`
58	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
59	ID *string `json:"id,omitempty"`
60	// Name - READ-ONLY; The name of the resource
61	Name *string `json:"name,omitempty"`
62	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
63	Type *string `json:"type,omitempty"`
64	// Location - The geo-location where the resource lives
65	Location *string `json:"location,omitempty"`
66}
67
68// MarshalJSON is the custom marshaler for Group.
69func (g Group) MarshalJSON() ([]byte, error) {
70	objectMap := make(map[string]interface{})
71	if g.GroupProperties != nil {
72		objectMap["properties"] = g.GroupProperties
73	}
74	if g.Kind != "" {
75		objectMap["kind"] = g.Kind
76	}
77	if g.Location != nil {
78		objectMap["location"] = g.Location
79	}
80	return json.Marshal(objectMap)
81}
82
83// UnmarshalJSON is the custom unmarshaler for Group struct.
84func (g *Group) UnmarshalJSON(body []byte) error {
85	var m map[string]*json.RawMessage
86	err := json.Unmarshal(body, &m)
87	if err != nil {
88		return err
89	}
90	for k, v := range m {
91		switch k {
92		case "properties":
93			if v != nil {
94				var groupProperties GroupProperties
95				err = json.Unmarshal(*v, &groupProperties)
96				if err != nil {
97					return err
98				}
99				g.GroupProperties = &groupProperties
100			}
101		case "kind":
102			if v != nil {
103				var kind Kind
104				err = json.Unmarshal(*v, &kind)
105				if err != nil {
106					return err
107				}
108				g.Kind = kind
109			}
110		case "id":
111			if v != nil {
112				var ID string
113				err = json.Unmarshal(*v, &ID)
114				if err != nil {
115					return err
116				}
117				g.ID = &ID
118			}
119		case "name":
120			if v != nil {
121				var name string
122				err = json.Unmarshal(*v, &name)
123				if err != nil {
124					return err
125				}
126				g.Name = &name
127			}
128		case "type":
129			if v != nil {
130				var typeVar string
131				err = json.Unmarshal(*v, &typeVar)
132				if err != nil {
133					return err
134				}
135				g.Type = &typeVar
136			}
137		case "location":
138			if v != nil {
139				var location string
140				err = json.Unmarshal(*v, &location)
141				if err != nil {
142					return err
143				}
144				g.Location = &location
145			}
146		}
147	}
148
149	return nil
150}
151
152// GroupListResult result of the request to list Managed Network Groups. It contains a list of groups and a
153// URL link to get the next set of results.
154type GroupListResult struct {
155	autorest.Response `json:"-"`
156	// Value - Gets a page of ManagedNetworkGroup
157	Value *[]Group `json:"value,omitempty"`
158	// NextLink - Gets the URL to get the next set of results.
159	NextLink *string `json:"nextLink,omitempty"`
160}
161
162// GroupListResultIterator provides access to a complete listing of Group values.
163type GroupListResultIterator struct {
164	i    int
165	page GroupListResultPage
166}
167
168// NextWithContext advances to the next value.  If there was an error making
169// the request the iterator does not advance and the error is returned.
170func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) {
171	if tracing.IsEnabled() {
172		ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext")
173		defer func() {
174			sc := -1
175			if iter.Response().Response.Response != nil {
176				sc = iter.Response().Response.Response.StatusCode
177			}
178			tracing.EndSpan(ctx, sc, err)
179		}()
180	}
181	iter.i++
182	if iter.i < len(iter.page.Values()) {
183		return nil
184	}
185	err = iter.page.NextWithContext(ctx)
186	if err != nil {
187		iter.i--
188		return err
189	}
190	iter.i = 0
191	return nil
192}
193
194// Next advances to the next value.  If there was an error making
195// the request the iterator does not advance and the error is returned.
196// Deprecated: Use NextWithContext() instead.
197func (iter *GroupListResultIterator) Next() error {
198	return iter.NextWithContext(context.Background())
199}
200
201// NotDone returns true if the enumeration should be started or is not yet complete.
202func (iter GroupListResultIterator) NotDone() bool {
203	return iter.page.NotDone() && iter.i < len(iter.page.Values())
204}
205
206// Response returns the raw server response from the last page request.
207func (iter GroupListResultIterator) Response() GroupListResult {
208	return iter.page.Response()
209}
210
211// Value returns the current value or a zero-initialized value if the
212// iterator has advanced beyond the end of the collection.
213func (iter GroupListResultIterator) Value() Group {
214	if !iter.page.NotDone() {
215		return Group{}
216	}
217	return iter.page.Values()[iter.i]
218}
219
220// Creates a new instance of the GroupListResultIterator type.
221func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator {
222	return GroupListResultIterator{page: page}
223}
224
225// IsEmpty returns true if the ListResult contains no values.
226func (glr GroupListResult) IsEmpty() bool {
227	return glr.Value == nil || len(*glr.Value) == 0
228}
229
230// hasNextLink returns true if the NextLink is not empty.
231func (glr GroupListResult) hasNextLink() bool {
232	return glr.NextLink != nil && len(*glr.NextLink) != 0
233}
234
235// groupListResultPreparer prepares a request to retrieve the next set of results.
236// It returns nil if no more results exist.
237func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) {
238	if !glr.hasNextLink() {
239		return nil, nil
240	}
241	return autorest.Prepare((&http.Request{}).WithContext(ctx),
242		autorest.AsJSON(),
243		autorest.AsGet(),
244		autorest.WithBaseURL(to.String(glr.NextLink)))
245}
246
247// GroupListResultPage contains a page of Group values.
248type GroupListResultPage struct {
249	fn  func(context.Context, GroupListResult) (GroupListResult, error)
250	glr GroupListResult
251}
252
253// NextWithContext advances to the next page of values.  If there was an error making
254// the request the page does not advance and the error is returned.
255func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) {
256	if tracing.IsEnabled() {
257		ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext")
258		defer func() {
259			sc := -1
260			if page.Response().Response.Response != nil {
261				sc = page.Response().Response.Response.StatusCode
262			}
263			tracing.EndSpan(ctx, sc, err)
264		}()
265	}
266	for {
267		next, err := page.fn(ctx, page.glr)
268		if err != nil {
269			return err
270		}
271		page.glr = next
272		if !next.hasNextLink() || !next.IsEmpty() {
273			break
274		}
275	}
276	return nil
277}
278
279// Next advances to the next page of values.  If there was an error making
280// the request the page does not advance and the error is returned.
281// Deprecated: Use NextWithContext() instead.
282func (page *GroupListResultPage) Next() error {
283	return page.NextWithContext(context.Background())
284}
285
286// NotDone returns true if the page enumeration should be started or is not yet complete.
287func (page GroupListResultPage) NotDone() bool {
288	return !page.glr.IsEmpty()
289}
290
291// Response returns the raw server response from the last page request.
292func (page GroupListResultPage) Response() GroupListResult {
293	return page.glr
294}
295
296// Values returns the slice of values for the current page or nil if there are no values.
297func (page GroupListResultPage) Values() []Group {
298	if page.glr.IsEmpty() {
299		return nil
300	}
301	return *page.glr.Value
302}
303
304// Creates a new instance of the GroupListResultPage type.
305func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage {
306	return GroupListResultPage{
307		fn:  getNextPage,
308		glr: cur,
309	}
310}
311
312// GroupProperties properties of a Managed Network Group
313type GroupProperties struct {
314	// ManagementGroups - The collection of management groups covered by the Managed Network
315	ManagementGroups *[]ResourceID `json:"managementGroups,omitempty"`
316	// Subscriptions - The collection of subscriptions covered by the Managed Network
317	Subscriptions *[]ResourceID `json:"subscriptions,omitempty"`
318	// VirtualNetworks - The collection of virtual nets covered by the Managed Network
319	VirtualNetworks *[]ResourceID `json:"virtualNetworks,omitempty"`
320	// Subnets - The collection of  subnets covered by the Managed Network
321	Subnets *[]ResourceID `json:"subnets,omitempty"`
322	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
323	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
324	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
325	Etag *string `json:"etag,omitempty"`
326}
327
328// MarshalJSON is the custom marshaler for GroupProperties.
329func (gp GroupProperties) MarshalJSON() ([]byte, error) {
330	objectMap := make(map[string]interface{})
331	if gp.ManagementGroups != nil {
332		objectMap["managementGroups"] = gp.ManagementGroups
333	}
334	if gp.Subscriptions != nil {
335		objectMap["subscriptions"] = gp.Subscriptions
336	}
337	if gp.VirtualNetworks != nil {
338		objectMap["virtualNetworks"] = gp.VirtualNetworks
339	}
340	if gp.Subnets != nil {
341		objectMap["subnets"] = gp.Subnets
342	}
343	return json.Marshal(objectMap)
344}
345
346// GroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
347// operation.
348type GroupsCreateOrUpdateFuture struct {
349	azure.FutureAPI
350	// Result returns the result of the asynchronous operation.
351	// If the operation has not completed it will return an error.
352	Result func(GroupsClient) (Group, error)
353}
354
355// UnmarshalJSON is the custom unmarshaller for CreateFuture.
356func (future *GroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
357	var azFuture azure.Future
358	if err := json.Unmarshal(body, &azFuture); err != nil {
359		return err
360	}
361	future.FutureAPI = &azFuture
362	future.Result = future.result
363	return nil
364}
365
366// result is the default implementation for GroupsCreateOrUpdateFuture.Result.
367func (future *GroupsCreateOrUpdateFuture) result(client GroupsClient) (g Group, err error) {
368	var done bool
369	done, err = future.DoneWithContext(context.Background(), client)
370	if err != nil {
371		err = autorest.NewErrorWithError(err, "managednetwork.GroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
372		return
373	}
374	if !done {
375		g.Response.Response = future.Response()
376		err = azure.NewAsyncOpIncompleteError("managednetwork.GroupsCreateOrUpdateFuture")
377		return
378	}
379	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
380	if g.Response.Response, err = future.GetResult(sender); err == nil && g.Response.Response.StatusCode != http.StatusNoContent {
381		g, err = client.CreateOrUpdateResponder(g.Response.Response)
382		if err != nil {
383			err = autorest.NewErrorWithError(err, "managednetwork.GroupsCreateOrUpdateFuture", "Result", g.Response.Response, "Failure responding to request")
384		}
385	}
386	return
387}
388
389// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
390type GroupsDeleteFuture struct {
391	azure.FutureAPI
392	// Result returns the result of the asynchronous operation.
393	// If the operation has not completed it will return an error.
394	Result func(GroupsClient) (autorest.Response, error)
395}
396
397// UnmarshalJSON is the custom unmarshaller for CreateFuture.
398func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error {
399	var azFuture azure.Future
400	if err := json.Unmarshal(body, &azFuture); err != nil {
401		return err
402	}
403	future.FutureAPI = &azFuture
404	future.Result = future.result
405	return nil
406}
407
408// result is the default implementation for GroupsDeleteFuture.Result.
409func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) {
410	var done bool
411	done, err = future.DoneWithContext(context.Background(), client)
412	if err != nil {
413		err = autorest.NewErrorWithError(err, "managednetwork.GroupsDeleteFuture", "Result", future.Response(), "Polling failure")
414		return
415	}
416	if !done {
417		ar.Response = future.Response()
418		err = azure.NewAsyncOpIncompleteError("managednetwork.GroupsDeleteFuture")
419		return
420	}
421	ar.Response = future.Response()
422	return
423}
424
425// HubAndSpokePeeringPolicyProperties properties of a Hub and Spoke Peering Policy
426type HubAndSpokePeeringPolicyProperties struct {
427	// Type - Gets or sets the connectivity type of a network structure policy. Possible values include: 'HubAndSpokeTopology', 'MeshTopology'
428	Type Type `json:"type,omitempty"`
429	// Hub - Gets or sets the hub virtual network ID
430	Hub *ResourceID `json:"hub,omitempty"`
431	// Spokes - Gets or sets the spokes group IDs
432	Spokes *[]ResourceID `json:"spokes,omitempty"`
433	// Mesh - Gets or sets the mesh group IDs
434	Mesh *[]ResourceID `json:"mesh,omitempty"`
435	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
436	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
437	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
438	Etag *string `json:"etag,omitempty"`
439}
440
441// MarshalJSON is the custom marshaler for HubAndSpokePeeringPolicyProperties.
442func (hasppp HubAndSpokePeeringPolicyProperties) MarshalJSON() ([]byte, error) {
443	objectMap := make(map[string]interface{})
444	if hasppp.Type != "" {
445		objectMap["type"] = hasppp.Type
446	}
447	if hasppp.Hub != nil {
448		objectMap["hub"] = hasppp.Hub
449	}
450	if hasppp.Spokes != nil {
451		objectMap["spokes"] = hasppp.Spokes
452	}
453	if hasppp.Mesh != nil {
454		objectMap["mesh"] = hasppp.Mesh
455	}
456	return json.Marshal(objectMap)
457}
458
459// ListResult result of the request to list Managed Network. It contains a list of Managed Networks and a
460// URL link to get the next set of results.
461type ListResult struct {
462	autorest.Response `json:"-"`
463	// Value - Gets a page of ManagedNetworks
464	Value *[]ManagedNetwork `json:"value,omitempty"`
465	// NextLink - Gets the URL to get the next page of results.
466	NextLink *string `json:"nextLink,omitempty"`
467}
468
469// ListResultIterator provides access to a complete listing of ManagedNetwork values.
470type ListResultIterator struct {
471	i    int
472	page ListResultPage
473}
474
475// NextWithContext advances to the next value.  If there was an error making
476// the request the iterator does not advance and the error is returned.
477func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
478	if tracing.IsEnabled() {
479		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext")
480		defer func() {
481			sc := -1
482			if iter.Response().Response.Response != nil {
483				sc = iter.Response().Response.Response.StatusCode
484			}
485			tracing.EndSpan(ctx, sc, err)
486		}()
487	}
488	iter.i++
489	if iter.i < len(iter.page.Values()) {
490		return nil
491	}
492	err = iter.page.NextWithContext(ctx)
493	if err != nil {
494		iter.i--
495		return err
496	}
497	iter.i = 0
498	return nil
499}
500
501// Next advances to the next value.  If there was an error making
502// the request the iterator does not advance and the error is returned.
503// Deprecated: Use NextWithContext() instead.
504func (iter *ListResultIterator) Next() error {
505	return iter.NextWithContext(context.Background())
506}
507
508// NotDone returns true if the enumeration should be started or is not yet complete.
509func (iter ListResultIterator) NotDone() bool {
510	return iter.page.NotDone() && iter.i < len(iter.page.Values())
511}
512
513// Response returns the raw server response from the last page request.
514func (iter ListResultIterator) Response() ListResult {
515	return iter.page.Response()
516}
517
518// Value returns the current value or a zero-initialized value if the
519// iterator has advanced beyond the end of the collection.
520func (iter ListResultIterator) Value() ManagedNetwork {
521	if !iter.page.NotDone() {
522		return ManagedNetwork{}
523	}
524	return iter.page.Values()[iter.i]
525}
526
527// Creates a new instance of the ListResultIterator type.
528func NewListResultIterator(page ListResultPage) ListResultIterator {
529	return ListResultIterator{page: page}
530}
531
532// IsEmpty returns true if the ListResult contains no values.
533func (lr ListResult) IsEmpty() bool {
534	return lr.Value == nil || len(*lr.Value) == 0
535}
536
537// hasNextLink returns true if the NextLink is not empty.
538func (lr ListResult) hasNextLink() bool {
539	return lr.NextLink != nil && len(*lr.NextLink) != 0
540}
541
542// listResultPreparer prepares a request to retrieve the next set of results.
543// It returns nil if no more results exist.
544func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
545	if !lr.hasNextLink() {
546		return nil, nil
547	}
548	return autorest.Prepare((&http.Request{}).WithContext(ctx),
549		autorest.AsJSON(),
550		autorest.AsGet(),
551		autorest.WithBaseURL(to.String(lr.NextLink)))
552}
553
554// ListResultPage contains a page of ManagedNetwork values.
555type ListResultPage struct {
556	fn func(context.Context, ListResult) (ListResult, error)
557	lr ListResult
558}
559
560// NextWithContext advances to the next page of values.  If there was an error making
561// the request the page does not advance and the error is returned.
562func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
563	if tracing.IsEnabled() {
564		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
565		defer func() {
566			sc := -1
567			if page.Response().Response.Response != nil {
568				sc = page.Response().Response.Response.StatusCode
569			}
570			tracing.EndSpan(ctx, sc, err)
571		}()
572	}
573	for {
574		next, err := page.fn(ctx, page.lr)
575		if err != nil {
576			return err
577		}
578		page.lr = next
579		if !next.hasNextLink() || !next.IsEmpty() {
580			break
581		}
582	}
583	return nil
584}
585
586// Next advances to the next page of values.  If there was an error making
587// the request the page does not advance and the error is returned.
588// Deprecated: Use NextWithContext() instead.
589func (page *ListResultPage) Next() error {
590	return page.NextWithContext(context.Background())
591}
592
593// NotDone returns true if the page enumeration should be started or is not yet complete.
594func (page ListResultPage) NotDone() bool {
595	return !page.lr.IsEmpty()
596}
597
598// Response returns the raw server response from the last page request.
599func (page ListResultPage) Response() ListResult {
600	return page.lr
601}
602
603// Values returns the slice of values for the current page or nil if there are no values.
604func (page ListResultPage) Values() []ManagedNetwork {
605	if page.lr.IsEmpty() {
606		return nil
607	}
608	return *page.lr.Value
609}
610
611// Creates a new instance of the ListResultPage type.
612func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
613	return ListResultPage{
614		fn: getNextPage,
615		lr: cur,
616	}
617}
618
619// ManagedNetwork the Managed Network resource
620type ManagedNetwork struct {
621	autorest.Response `json:"-"`
622	// Properties - The MNC properties
623	*Properties `json:"properties,omitempty"`
624	// Tags - Resource tags
625	Tags map[string]*string `json:"tags"`
626	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
627	ID *string `json:"id,omitempty"`
628	// Name - READ-ONLY; The name of the resource
629	Name *string `json:"name,omitempty"`
630	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
631	Type *string `json:"type,omitempty"`
632	// Location - The geo-location where the resource lives
633	Location *string `json:"location,omitempty"`
634}
635
636// MarshalJSON is the custom marshaler for ManagedNetwork.
637func (mn ManagedNetwork) MarshalJSON() ([]byte, error) {
638	objectMap := make(map[string]interface{})
639	if mn.Properties != nil {
640		objectMap["properties"] = mn.Properties
641	}
642	if mn.Tags != nil {
643		objectMap["tags"] = mn.Tags
644	}
645	if mn.Location != nil {
646		objectMap["location"] = mn.Location
647	}
648	return json.Marshal(objectMap)
649}
650
651// UnmarshalJSON is the custom unmarshaler for ManagedNetwork struct.
652func (mn *ManagedNetwork) UnmarshalJSON(body []byte) error {
653	var m map[string]*json.RawMessage
654	err := json.Unmarshal(body, &m)
655	if err != nil {
656		return err
657	}
658	for k, v := range m {
659		switch k {
660		case "properties":
661			if v != nil {
662				var properties Properties
663				err = json.Unmarshal(*v, &properties)
664				if err != nil {
665					return err
666				}
667				mn.Properties = &properties
668			}
669		case "tags":
670			if v != nil {
671				var tags map[string]*string
672				err = json.Unmarshal(*v, &tags)
673				if err != nil {
674					return err
675				}
676				mn.Tags = tags
677			}
678		case "id":
679			if v != nil {
680				var ID string
681				err = json.Unmarshal(*v, &ID)
682				if err != nil {
683					return err
684				}
685				mn.ID = &ID
686			}
687		case "name":
688			if v != nil {
689				var name string
690				err = json.Unmarshal(*v, &name)
691				if err != nil {
692					return err
693				}
694				mn.Name = &name
695			}
696		case "type":
697			if v != nil {
698				var typeVar string
699				err = json.Unmarshal(*v, &typeVar)
700				if err != nil {
701					return err
702				}
703				mn.Type = &typeVar
704			}
705		case "location":
706			if v != nil {
707				var location string
708				err = json.Unmarshal(*v, &location)
709				if err != nil {
710					return err
711				}
712				mn.Location = &location
713			}
714		}
715	}
716
717	return nil
718}
719
720// ManagedNetworksDeleteFutureType an abstraction for monitoring and retrieving the results of a
721// long-running operation.
722type ManagedNetworksDeleteFutureType struct {
723	azure.FutureAPI
724	// Result returns the result of the asynchronous operation.
725	// If the operation has not completed it will return an error.
726	Result func(ManagedNetworksClient) (autorest.Response, error)
727}
728
729// UnmarshalJSON is the custom unmarshaller for CreateFuture.
730func (future *ManagedNetworksDeleteFutureType) UnmarshalJSON(body []byte) error {
731	var azFuture azure.Future
732	if err := json.Unmarshal(body, &azFuture); err != nil {
733		return err
734	}
735	future.FutureAPI = &azFuture
736	future.Result = future.result
737	return nil
738}
739
740// result is the default implementation for ManagedNetworksDeleteFutureType.Result.
741func (future *ManagedNetworksDeleteFutureType) result(client ManagedNetworksClient) (ar autorest.Response, err error) {
742	var done bool
743	done, err = future.DoneWithContext(context.Background(), client)
744	if err != nil {
745		err = autorest.NewErrorWithError(err, "managednetwork.ManagedNetworksDeleteFutureType", "Result", future.Response(), "Polling failure")
746		return
747	}
748	if !done {
749		ar.Response = future.Response()
750		err = azure.NewAsyncOpIncompleteError("managednetwork.ManagedNetworksDeleteFutureType")
751		return
752	}
753	ar.Response = future.Response()
754	return
755}
756
757// ManagedNetworksUpdateFutureType an abstraction for monitoring and retrieving the results of a
758// long-running operation.
759type ManagedNetworksUpdateFutureType struct {
760	azure.FutureAPI
761	// Result returns the result of the asynchronous operation.
762	// If the operation has not completed it will return an error.
763	Result func(ManagedNetworksClient) (ManagedNetwork, error)
764}
765
766// UnmarshalJSON is the custom unmarshaller for CreateFuture.
767func (future *ManagedNetworksUpdateFutureType) UnmarshalJSON(body []byte) error {
768	var azFuture azure.Future
769	if err := json.Unmarshal(body, &azFuture); err != nil {
770		return err
771	}
772	future.FutureAPI = &azFuture
773	future.Result = future.result
774	return nil
775}
776
777// result is the default implementation for ManagedNetworksUpdateFutureType.Result.
778func (future *ManagedNetworksUpdateFutureType) result(client ManagedNetworksClient) (mn ManagedNetwork, err error) {
779	var done bool
780	done, err = future.DoneWithContext(context.Background(), client)
781	if err != nil {
782		err = autorest.NewErrorWithError(err, "managednetwork.ManagedNetworksUpdateFutureType", "Result", future.Response(), "Polling failure")
783		return
784	}
785	if !done {
786		mn.Response.Response = future.Response()
787		err = azure.NewAsyncOpIncompleteError("managednetwork.ManagedNetworksUpdateFutureType")
788		return
789	}
790	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
791	if mn.Response.Response, err = future.GetResult(sender); err == nil && mn.Response.Response.StatusCode != http.StatusNoContent {
792		mn, err = client.UpdateResponder(mn.Response.Response)
793		if err != nil {
794			err = autorest.NewErrorWithError(err, "managednetwork.ManagedNetworksUpdateFutureType", "Result", mn.Response.Response, "Failure responding to request")
795		}
796	}
797	return
798}
799
800// MeshPeeringPolicyProperties properties of a Mesh Peering Policy
801type MeshPeeringPolicyProperties struct {
802	// Type - Gets or sets the connectivity type of a network structure policy. Possible values include: 'HubAndSpokeTopology', 'MeshTopology'
803	Type Type `json:"type,omitempty"`
804	// Hub - Gets or sets the hub virtual network ID
805	Hub *ResourceID `json:"hub,omitempty"`
806	// Spokes - Gets or sets the spokes group IDs
807	Spokes *[]ResourceID `json:"spokes,omitempty"`
808	// Mesh - Gets or sets the mesh group IDs
809	Mesh *[]ResourceID `json:"mesh,omitempty"`
810	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
811	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
812	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
813	Etag *string `json:"etag,omitempty"`
814}
815
816// MarshalJSON is the custom marshaler for MeshPeeringPolicyProperties.
817func (mppp MeshPeeringPolicyProperties) MarshalJSON() ([]byte, error) {
818	objectMap := make(map[string]interface{})
819	if mppp.Type != "" {
820		objectMap["type"] = mppp.Type
821	}
822	if mppp.Hub != nil {
823		objectMap["hub"] = mppp.Hub
824	}
825	if mppp.Spokes != nil {
826		objectMap["spokes"] = mppp.Spokes
827	}
828	if mppp.Mesh != nil {
829		objectMap["mesh"] = mppp.Mesh
830	}
831	return json.Marshal(objectMap)
832}
833
834// Operation REST API operation
835type Operation struct {
836	// Name - Operation name: {provider}/{resource}/{operation}
837	Name *string `json:"name,omitempty"`
838	// Display - The object that represents the operation.
839	Display *OperationDisplay `json:"display,omitempty"`
840}
841
842// OperationDisplay the object that represents the operation.
843type OperationDisplay struct {
844	// Provider - Service provider: Microsoft.ManagedNetwork
845	Provider *string `json:"provider,omitempty"`
846	// Resource - Resource on which the operation is performed: Profile, endpoint, etc.
847	Resource *string `json:"resource,omitempty"`
848	// Operation - Operation type: Read, write, delete, etc.
849	Operation *string `json:"operation,omitempty"`
850}
851
852// OperationListResult result of the request to list Managed Network operations. It contains a list of
853// operations and a URL link to get the next set of results.
854type OperationListResult struct {
855	autorest.Response `json:"-"`
856	// Value - List of Resource Provider operations supported by the Managed Network resource provider.
857	Value *[]Operation `json:"value,omitempty"`
858	// NextLink - URL to get the next set of operation list results if there are any.
859	NextLink *string `json:"nextLink,omitempty"`
860}
861
862// OperationListResultIterator provides access to a complete listing of Operation values.
863type OperationListResultIterator struct {
864	i    int
865	page OperationListResultPage
866}
867
868// NextWithContext advances to the next value.  If there was an error making
869// the request the iterator does not advance and the error is returned.
870func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
871	if tracing.IsEnabled() {
872		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
873		defer func() {
874			sc := -1
875			if iter.Response().Response.Response != nil {
876				sc = iter.Response().Response.Response.StatusCode
877			}
878			tracing.EndSpan(ctx, sc, err)
879		}()
880	}
881	iter.i++
882	if iter.i < len(iter.page.Values()) {
883		return nil
884	}
885	err = iter.page.NextWithContext(ctx)
886	if err != nil {
887		iter.i--
888		return err
889	}
890	iter.i = 0
891	return nil
892}
893
894// Next advances to the next value.  If there was an error making
895// the request the iterator does not advance and the error is returned.
896// Deprecated: Use NextWithContext() instead.
897func (iter *OperationListResultIterator) Next() error {
898	return iter.NextWithContext(context.Background())
899}
900
901// NotDone returns true if the enumeration should be started or is not yet complete.
902func (iter OperationListResultIterator) NotDone() bool {
903	return iter.page.NotDone() && iter.i < len(iter.page.Values())
904}
905
906// Response returns the raw server response from the last page request.
907func (iter OperationListResultIterator) Response() OperationListResult {
908	return iter.page.Response()
909}
910
911// Value returns the current value or a zero-initialized value if the
912// iterator has advanced beyond the end of the collection.
913func (iter OperationListResultIterator) Value() Operation {
914	if !iter.page.NotDone() {
915		return Operation{}
916	}
917	return iter.page.Values()[iter.i]
918}
919
920// Creates a new instance of the OperationListResultIterator type.
921func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
922	return OperationListResultIterator{page: page}
923}
924
925// IsEmpty returns true if the ListResult contains no values.
926func (olr OperationListResult) IsEmpty() bool {
927	return olr.Value == nil || len(*olr.Value) == 0
928}
929
930// hasNextLink returns true if the NextLink is not empty.
931func (olr OperationListResult) hasNextLink() bool {
932	return olr.NextLink != nil && len(*olr.NextLink) != 0
933}
934
935// operationListResultPreparer prepares a request to retrieve the next set of results.
936// It returns nil if no more results exist.
937func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
938	if !olr.hasNextLink() {
939		return nil, nil
940	}
941	return autorest.Prepare((&http.Request{}).WithContext(ctx),
942		autorest.AsJSON(),
943		autorest.AsGet(),
944		autorest.WithBaseURL(to.String(olr.NextLink)))
945}
946
947// OperationListResultPage contains a page of Operation values.
948type OperationListResultPage struct {
949	fn  func(context.Context, OperationListResult) (OperationListResult, error)
950	olr OperationListResult
951}
952
953// NextWithContext advances to the next page of values.  If there was an error making
954// the request the page does not advance and the error is returned.
955func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
956	if tracing.IsEnabled() {
957		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
958		defer func() {
959			sc := -1
960			if page.Response().Response.Response != nil {
961				sc = page.Response().Response.Response.StatusCode
962			}
963			tracing.EndSpan(ctx, sc, err)
964		}()
965	}
966	for {
967		next, err := page.fn(ctx, page.olr)
968		if err != nil {
969			return err
970		}
971		page.olr = next
972		if !next.hasNextLink() || !next.IsEmpty() {
973			break
974		}
975	}
976	return nil
977}
978
979// Next advances to the next page of values.  If there was an error making
980// the request the page does not advance and the error is returned.
981// Deprecated: Use NextWithContext() instead.
982func (page *OperationListResultPage) Next() error {
983	return page.NextWithContext(context.Background())
984}
985
986// NotDone returns true if the page enumeration should be started or is not yet complete.
987func (page OperationListResultPage) NotDone() bool {
988	return !page.olr.IsEmpty()
989}
990
991// Response returns the raw server response from the last page request.
992func (page OperationListResultPage) Response() OperationListResult {
993	return page.olr
994}
995
996// Values returns the slice of values for the current page or nil if there are no values.
997func (page OperationListResultPage) Values() []Operation {
998	if page.olr.IsEmpty() {
999		return nil
1000	}
1001	return *page.olr.Value
1002}
1003
1004// Creates a new instance of the OperationListResultPage type.
1005func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1006	return OperationListResultPage{
1007		fn:  getNextPage,
1008		olr: cur,
1009	}
1010}
1011
1012// PeeringPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
1013// long-running operation.
1014type PeeringPoliciesCreateOrUpdateFuture struct {
1015	azure.FutureAPI
1016	// Result returns the result of the asynchronous operation.
1017	// If the operation has not completed it will return an error.
1018	Result func(PeeringPoliciesClient) (PeeringPolicy, error)
1019}
1020
1021// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1022func (future *PeeringPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1023	var azFuture azure.Future
1024	if err := json.Unmarshal(body, &azFuture); err != nil {
1025		return err
1026	}
1027	future.FutureAPI = &azFuture
1028	future.Result = future.result
1029	return nil
1030}
1031
1032// result is the default implementation for PeeringPoliciesCreateOrUpdateFuture.Result.
1033func (future *PeeringPoliciesCreateOrUpdateFuture) result(client PeeringPoliciesClient) (pp PeeringPolicy, err error) {
1034	var done bool
1035	done, err = future.DoneWithContext(context.Background(), client)
1036	if err != nil {
1037		err = autorest.NewErrorWithError(err, "managednetwork.PeeringPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1038		return
1039	}
1040	if !done {
1041		pp.Response.Response = future.Response()
1042		err = azure.NewAsyncOpIncompleteError("managednetwork.PeeringPoliciesCreateOrUpdateFuture")
1043		return
1044	}
1045	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1046	if pp.Response.Response, err = future.GetResult(sender); err == nil && pp.Response.Response.StatusCode != http.StatusNoContent {
1047		pp, err = client.CreateOrUpdateResponder(pp.Response.Response)
1048		if err != nil {
1049			err = autorest.NewErrorWithError(err, "managednetwork.PeeringPoliciesCreateOrUpdateFuture", "Result", pp.Response.Response, "Failure responding to request")
1050		}
1051	}
1052	return
1053}
1054
1055// PeeringPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1056// operation.
1057type PeeringPoliciesDeleteFuture struct {
1058	azure.FutureAPI
1059	// Result returns the result of the asynchronous operation.
1060	// If the operation has not completed it will return an error.
1061	Result func(PeeringPoliciesClient) (autorest.Response, error)
1062}
1063
1064// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1065func (future *PeeringPoliciesDeleteFuture) UnmarshalJSON(body []byte) error {
1066	var azFuture azure.Future
1067	if err := json.Unmarshal(body, &azFuture); err != nil {
1068		return err
1069	}
1070	future.FutureAPI = &azFuture
1071	future.Result = future.result
1072	return nil
1073}
1074
1075// result is the default implementation for PeeringPoliciesDeleteFuture.Result.
1076func (future *PeeringPoliciesDeleteFuture) result(client PeeringPoliciesClient) (ar autorest.Response, err error) {
1077	var done bool
1078	done, err = future.DoneWithContext(context.Background(), client)
1079	if err != nil {
1080		err = autorest.NewErrorWithError(err, "managednetwork.PeeringPoliciesDeleteFuture", "Result", future.Response(), "Polling failure")
1081		return
1082	}
1083	if !done {
1084		ar.Response = future.Response()
1085		err = azure.NewAsyncOpIncompleteError("managednetwork.PeeringPoliciesDeleteFuture")
1086		return
1087	}
1088	ar.Response = future.Response()
1089	return
1090}
1091
1092// PeeringPolicy the Managed Network Peering Policy resource
1093type PeeringPolicy struct {
1094	autorest.Response `json:"-"`
1095	// Properties - Gets or sets the properties of a Managed Network Policy
1096	Properties *PeeringPolicyProperties `json:"properties,omitempty"`
1097	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1098	ID *string `json:"id,omitempty"`
1099	// Name - READ-ONLY; The name of the resource
1100	Name *string `json:"name,omitempty"`
1101	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1102	Type *string `json:"type,omitempty"`
1103	// Location - The geo-location where the resource lives
1104	Location *string `json:"location,omitempty"`
1105}
1106
1107// MarshalJSON is the custom marshaler for PeeringPolicy.
1108func (pp PeeringPolicy) MarshalJSON() ([]byte, error) {
1109	objectMap := make(map[string]interface{})
1110	if pp.Properties != nil {
1111		objectMap["properties"] = pp.Properties
1112	}
1113	if pp.Location != nil {
1114		objectMap["location"] = pp.Location
1115	}
1116	return json.Marshal(objectMap)
1117}
1118
1119// PeeringPolicyListResult result of the request to list Managed Network Peering Policies. It contains a
1120// list of policies and a URL link to get the next set of results.
1121type PeeringPolicyListResult struct {
1122	autorest.Response `json:"-"`
1123	// Value - Gets a page of Peering Policies
1124	Value *[]PeeringPolicy `json:"value,omitempty"`
1125	// NextLink - Gets the URL to get the next page of results.
1126	NextLink *string `json:"nextLink,omitempty"`
1127}
1128
1129// PeeringPolicyListResultIterator provides access to a complete listing of PeeringPolicy values.
1130type PeeringPolicyListResultIterator struct {
1131	i    int
1132	page PeeringPolicyListResultPage
1133}
1134
1135// NextWithContext advances to the next value.  If there was an error making
1136// the request the iterator does not advance and the error is returned.
1137func (iter *PeeringPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) {
1138	if tracing.IsEnabled() {
1139		ctx = tracing.StartSpan(ctx, fqdn+"/PeeringPolicyListResultIterator.NextWithContext")
1140		defer func() {
1141			sc := -1
1142			if iter.Response().Response.Response != nil {
1143				sc = iter.Response().Response.Response.StatusCode
1144			}
1145			tracing.EndSpan(ctx, sc, err)
1146		}()
1147	}
1148	iter.i++
1149	if iter.i < len(iter.page.Values()) {
1150		return nil
1151	}
1152	err = iter.page.NextWithContext(ctx)
1153	if err != nil {
1154		iter.i--
1155		return err
1156	}
1157	iter.i = 0
1158	return nil
1159}
1160
1161// Next advances to the next value.  If there was an error making
1162// the request the iterator does not advance and the error is returned.
1163// Deprecated: Use NextWithContext() instead.
1164func (iter *PeeringPolicyListResultIterator) Next() error {
1165	return iter.NextWithContext(context.Background())
1166}
1167
1168// NotDone returns true if the enumeration should be started or is not yet complete.
1169func (iter PeeringPolicyListResultIterator) NotDone() bool {
1170	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1171}
1172
1173// Response returns the raw server response from the last page request.
1174func (iter PeeringPolicyListResultIterator) Response() PeeringPolicyListResult {
1175	return iter.page.Response()
1176}
1177
1178// Value returns the current value or a zero-initialized value if the
1179// iterator has advanced beyond the end of the collection.
1180func (iter PeeringPolicyListResultIterator) Value() PeeringPolicy {
1181	if !iter.page.NotDone() {
1182		return PeeringPolicy{}
1183	}
1184	return iter.page.Values()[iter.i]
1185}
1186
1187// Creates a new instance of the PeeringPolicyListResultIterator type.
1188func NewPeeringPolicyListResultIterator(page PeeringPolicyListResultPage) PeeringPolicyListResultIterator {
1189	return PeeringPolicyListResultIterator{page: page}
1190}
1191
1192// IsEmpty returns true if the ListResult contains no values.
1193func (pplr PeeringPolicyListResult) IsEmpty() bool {
1194	return pplr.Value == nil || len(*pplr.Value) == 0
1195}
1196
1197// hasNextLink returns true if the NextLink is not empty.
1198func (pplr PeeringPolicyListResult) hasNextLink() bool {
1199	return pplr.NextLink != nil && len(*pplr.NextLink) != 0
1200}
1201
1202// peeringPolicyListResultPreparer prepares a request to retrieve the next set of results.
1203// It returns nil if no more results exist.
1204func (pplr PeeringPolicyListResult) peeringPolicyListResultPreparer(ctx context.Context) (*http.Request, error) {
1205	if !pplr.hasNextLink() {
1206		return nil, nil
1207	}
1208	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1209		autorest.AsJSON(),
1210		autorest.AsGet(),
1211		autorest.WithBaseURL(to.String(pplr.NextLink)))
1212}
1213
1214// PeeringPolicyListResultPage contains a page of PeeringPolicy values.
1215type PeeringPolicyListResultPage struct {
1216	fn   func(context.Context, PeeringPolicyListResult) (PeeringPolicyListResult, error)
1217	pplr PeeringPolicyListResult
1218}
1219
1220// NextWithContext advances to the next page of values.  If there was an error making
1221// the request the page does not advance and the error is returned.
1222func (page *PeeringPolicyListResultPage) NextWithContext(ctx context.Context) (err error) {
1223	if tracing.IsEnabled() {
1224		ctx = tracing.StartSpan(ctx, fqdn+"/PeeringPolicyListResultPage.NextWithContext")
1225		defer func() {
1226			sc := -1
1227			if page.Response().Response.Response != nil {
1228				sc = page.Response().Response.Response.StatusCode
1229			}
1230			tracing.EndSpan(ctx, sc, err)
1231		}()
1232	}
1233	for {
1234		next, err := page.fn(ctx, page.pplr)
1235		if err != nil {
1236			return err
1237		}
1238		page.pplr = next
1239		if !next.hasNextLink() || !next.IsEmpty() {
1240			break
1241		}
1242	}
1243	return nil
1244}
1245
1246// Next advances to the next page of values.  If there was an error making
1247// the request the page does not advance and the error is returned.
1248// Deprecated: Use NextWithContext() instead.
1249func (page *PeeringPolicyListResultPage) Next() error {
1250	return page.NextWithContext(context.Background())
1251}
1252
1253// NotDone returns true if the page enumeration should be started or is not yet complete.
1254func (page PeeringPolicyListResultPage) NotDone() bool {
1255	return !page.pplr.IsEmpty()
1256}
1257
1258// Response returns the raw server response from the last page request.
1259func (page PeeringPolicyListResultPage) Response() PeeringPolicyListResult {
1260	return page.pplr
1261}
1262
1263// Values returns the slice of values for the current page or nil if there are no values.
1264func (page PeeringPolicyListResultPage) Values() []PeeringPolicy {
1265	if page.pplr.IsEmpty() {
1266		return nil
1267	}
1268	return *page.pplr.Value
1269}
1270
1271// Creates a new instance of the PeeringPolicyListResultPage type.
1272func NewPeeringPolicyListResultPage(cur PeeringPolicyListResult, getNextPage func(context.Context, PeeringPolicyListResult) (PeeringPolicyListResult, error)) PeeringPolicyListResultPage {
1273	return PeeringPolicyListResultPage{
1274		fn:   getNextPage,
1275		pplr: cur,
1276	}
1277}
1278
1279// PeeringPolicyProperties properties of a Managed Network Peering Policy
1280type PeeringPolicyProperties struct {
1281	// Type - Gets or sets the connectivity type of a network structure policy. Possible values include: 'HubAndSpokeTopology', 'MeshTopology'
1282	Type Type `json:"type,omitempty"`
1283	// Hub - Gets or sets the hub virtual network ID
1284	Hub *ResourceID `json:"hub,omitempty"`
1285	// Spokes - Gets or sets the spokes group IDs
1286	Spokes *[]ResourceID `json:"spokes,omitempty"`
1287	// Mesh - Gets or sets the mesh group IDs
1288	Mesh *[]ResourceID `json:"mesh,omitempty"`
1289	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
1290	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1291	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
1292	Etag *string `json:"etag,omitempty"`
1293}
1294
1295// MarshalJSON is the custom marshaler for PeeringPolicyProperties.
1296func (ppp PeeringPolicyProperties) MarshalJSON() ([]byte, error) {
1297	objectMap := make(map[string]interface{})
1298	if ppp.Type != "" {
1299		objectMap["type"] = ppp.Type
1300	}
1301	if ppp.Hub != nil {
1302		objectMap["hub"] = ppp.Hub
1303	}
1304	if ppp.Spokes != nil {
1305		objectMap["spokes"] = ppp.Spokes
1306	}
1307	if ppp.Mesh != nil {
1308		objectMap["mesh"] = ppp.Mesh
1309	}
1310	return json.Marshal(objectMap)
1311}
1312
1313// Properties properties of Managed Network
1314type Properties struct {
1315	// Scope - The collection of management groups, subscriptions, virtual networks, and subnets by the Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed Network
1316	Scope *Scope `json:"scope,omitempty"`
1317	// Connectivity - READ-ONLY; The collection of groups and policies concerned with connectivity
1318	Connectivity *ConnectivityCollection `json:"connectivity,omitempty"`
1319	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
1320	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1321	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
1322	Etag *string `json:"etag,omitempty"`
1323}
1324
1325// MarshalJSON is the custom marshaler for Properties.
1326func (p Properties) MarshalJSON() ([]byte, error) {
1327	objectMap := make(map[string]interface{})
1328	if p.Scope != nil {
1329		objectMap["scope"] = p.Scope
1330	}
1331	return json.Marshal(objectMap)
1332}
1333
1334// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
1335// required location and tags
1336type ProxyResource struct {
1337	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1338	ID *string `json:"id,omitempty"`
1339	// Name - READ-ONLY; The name of the resource
1340	Name *string `json:"name,omitempty"`
1341	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1342	Type *string `json:"type,omitempty"`
1343	// Location - The geo-location where the resource lives
1344	Location *string `json:"location,omitempty"`
1345}
1346
1347// MarshalJSON is the custom marshaler for ProxyResource.
1348func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1349	objectMap := make(map[string]interface{})
1350	if pr.Location != nil {
1351		objectMap["location"] = pr.Location
1352	}
1353	return json.Marshal(objectMap)
1354}
1355
1356// Resource the general resource model definition
1357type Resource struct {
1358	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1359	ID *string `json:"id,omitempty"`
1360	// Name - READ-ONLY; The name of the resource
1361	Name *string `json:"name,omitempty"`
1362	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1363	Type *string `json:"type,omitempty"`
1364	// Location - The geo-location where the resource lives
1365	Location *string `json:"location,omitempty"`
1366}
1367
1368// MarshalJSON is the custom marshaler for Resource.
1369func (r Resource) MarshalJSON() ([]byte, error) {
1370	objectMap := make(map[string]interface{})
1371	if r.Location != nil {
1372		objectMap["location"] = r.Location
1373	}
1374	return json.Marshal(objectMap)
1375}
1376
1377// ResourceID generic pointer to a resource
1378type ResourceID struct {
1379	// ID - Resource Id
1380	ID *string `json:"id,omitempty"`
1381}
1382
1383// ResourceProperties base for resource properties.
1384type ResourceProperties struct {
1385	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
1386	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1387	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
1388	Etag *string `json:"etag,omitempty"`
1389}
1390
1391// MarshalJSON is the custom marshaler for ResourceProperties.
1392func (rp ResourceProperties) MarshalJSON() ([]byte, error) {
1393	objectMap := make(map[string]interface{})
1394	return json.Marshal(objectMap)
1395}
1396
1397// Scope scope of a Managed Network
1398type Scope struct {
1399	// ManagementGroups - The collection of management groups covered by the Managed Network
1400	ManagementGroups *[]ResourceID `json:"managementGroups,omitempty"`
1401	// Subscriptions - The collection of subscriptions covered by the Managed Network
1402	Subscriptions *[]ResourceID `json:"subscriptions,omitempty"`
1403	// VirtualNetworks - The collection of virtual nets covered by the Managed Network
1404	VirtualNetworks *[]ResourceID `json:"virtualNetworks,omitempty"`
1405	// Subnets - The collection of  subnets covered by the Managed Network
1406	Subnets *[]ResourceID `json:"subnets,omitempty"`
1407}
1408
1409// ScopeAssignment the Managed Network resource
1410type ScopeAssignment struct {
1411	autorest.Response `json:"-"`
1412	// ScopeAssignmentProperties - The Scope Assignment properties
1413	*ScopeAssignmentProperties `json:"properties,omitempty"`
1414	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1415	ID *string `json:"id,omitempty"`
1416	// Name - READ-ONLY; The name of the resource
1417	Name *string `json:"name,omitempty"`
1418	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1419	Type *string `json:"type,omitempty"`
1420	// Location - The geo-location where the resource lives
1421	Location *string `json:"location,omitempty"`
1422}
1423
1424// MarshalJSON is the custom marshaler for ScopeAssignment.
1425func (sa ScopeAssignment) MarshalJSON() ([]byte, error) {
1426	objectMap := make(map[string]interface{})
1427	if sa.ScopeAssignmentProperties != nil {
1428		objectMap["properties"] = sa.ScopeAssignmentProperties
1429	}
1430	if sa.Location != nil {
1431		objectMap["location"] = sa.Location
1432	}
1433	return json.Marshal(objectMap)
1434}
1435
1436// UnmarshalJSON is the custom unmarshaler for ScopeAssignment struct.
1437func (sa *ScopeAssignment) UnmarshalJSON(body []byte) error {
1438	var m map[string]*json.RawMessage
1439	err := json.Unmarshal(body, &m)
1440	if err != nil {
1441		return err
1442	}
1443	for k, v := range m {
1444		switch k {
1445		case "properties":
1446			if v != nil {
1447				var scopeAssignmentProperties ScopeAssignmentProperties
1448				err = json.Unmarshal(*v, &scopeAssignmentProperties)
1449				if err != nil {
1450					return err
1451				}
1452				sa.ScopeAssignmentProperties = &scopeAssignmentProperties
1453			}
1454		case "id":
1455			if v != nil {
1456				var ID string
1457				err = json.Unmarshal(*v, &ID)
1458				if err != nil {
1459					return err
1460				}
1461				sa.ID = &ID
1462			}
1463		case "name":
1464			if v != nil {
1465				var name string
1466				err = json.Unmarshal(*v, &name)
1467				if err != nil {
1468					return err
1469				}
1470				sa.Name = &name
1471			}
1472		case "type":
1473			if v != nil {
1474				var typeVar string
1475				err = json.Unmarshal(*v, &typeVar)
1476				if err != nil {
1477					return err
1478				}
1479				sa.Type = &typeVar
1480			}
1481		case "location":
1482			if v != nil {
1483				var location string
1484				err = json.Unmarshal(*v, &location)
1485				if err != nil {
1486					return err
1487				}
1488				sa.Location = &location
1489			}
1490		}
1491	}
1492
1493	return nil
1494}
1495
1496// ScopeAssignmentListResult result of the request to list ScopeAssignment. It contains a list of groups
1497// and a URL link to get the next set of results.
1498type ScopeAssignmentListResult struct {
1499	autorest.Response `json:"-"`
1500	// Value - Gets a page of ScopeAssignment
1501	Value *[]ScopeAssignment `json:"value,omitempty"`
1502	// NextLink - Gets the URL to get the next set of results.
1503	NextLink *string `json:"nextLink,omitempty"`
1504}
1505
1506// ScopeAssignmentListResultIterator provides access to a complete listing of ScopeAssignment values.
1507type ScopeAssignmentListResultIterator struct {
1508	i    int
1509	page ScopeAssignmentListResultPage
1510}
1511
1512// NextWithContext advances to the next value.  If there was an error making
1513// the request the iterator does not advance and the error is returned.
1514func (iter *ScopeAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) {
1515	if tracing.IsEnabled() {
1516		ctx = tracing.StartSpan(ctx, fqdn+"/ScopeAssignmentListResultIterator.NextWithContext")
1517		defer func() {
1518			sc := -1
1519			if iter.Response().Response.Response != nil {
1520				sc = iter.Response().Response.Response.StatusCode
1521			}
1522			tracing.EndSpan(ctx, sc, err)
1523		}()
1524	}
1525	iter.i++
1526	if iter.i < len(iter.page.Values()) {
1527		return nil
1528	}
1529	err = iter.page.NextWithContext(ctx)
1530	if err != nil {
1531		iter.i--
1532		return err
1533	}
1534	iter.i = 0
1535	return nil
1536}
1537
1538// Next advances to the next value.  If there was an error making
1539// the request the iterator does not advance and the error is returned.
1540// Deprecated: Use NextWithContext() instead.
1541func (iter *ScopeAssignmentListResultIterator) Next() error {
1542	return iter.NextWithContext(context.Background())
1543}
1544
1545// NotDone returns true if the enumeration should be started or is not yet complete.
1546func (iter ScopeAssignmentListResultIterator) NotDone() bool {
1547	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1548}
1549
1550// Response returns the raw server response from the last page request.
1551func (iter ScopeAssignmentListResultIterator) Response() ScopeAssignmentListResult {
1552	return iter.page.Response()
1553}
1554
1555// Value returns the current value or a zero-initialized value if the
1556// iterator has advanced beyond the end of the collection.
1557func (iter ScopeAssignmentListResultIterator) Value() ScopeAssignment {
1558	if !iter.page.NotDone() {
1559		return ScopeAssignment{}
1560	}
1561	return iter.page.Values()[iter.i]
1562}
1563
1564// Creates a new instance of the ScopeAssignmentListResultIterator type.
1565func NewScopeAssignmentListResultIterator(page ScopeAssignmentListResultPage) ScopeAssignmentListResultIterator {
1566	return ScopeAssignmentListResultIterator{page: page}
1567}
1568
1569// IsEmpty returns true if the ListResult contains no values.
1570func (salr ScopeAssignmentListResult) IsEmpty() bool {
1571	return salr.Value == nil || len(*salr.Value) == 0
1572}
1573
1574// hasNextLink returns true if the NextLink is not empty.
1575func (salr ScopeAssignmentListResult) hasNextLink() bool {
1576	return salr.NextLink != nil && len(*salr.NextLink) != 0
1577}
1578
1579// scopeAssignmentListResultPreparer prepares a request to retrieve the next set of results.
1580// It returns nil if no more results exist.
1581func (salr ScopeAssignmentListResult) scopeAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) {
1582	if !salr.hasNextLink() {
1583		return nil, nil
1584	}
1585	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1586		autorest.AsJSON(),
1587		autorest.AsGet(),
1588		autorest.WithBaseURL(to.String(salr.NextLink)))
1589}
1590
1591// ScopeAssignmentListResultPage contains a page of ScopeAssignment values.
1592type ScopeAssignmentListResultPage struct {
1593	fn   func(context.Context, ScopeAssignmentListResult) (ScopeAssignmentListResult, error)
1594	salr ScopeAssignmentListResult
1595}
1596
1597// NextWithContext advances to the next page of values.  If there was an error making
1598// the request the page does not advance and the error is returned.
1599func (page *ScopeAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) {
1600	if tracing.IsEnabled() {
1601		ctx = tracing.StartSpan(ctx, fqdn+"/ScopeAssignmentListResultPage.NextWithContext")
1602		defer func() {
1603			sc := -1
1604			if page.Response().Response.Response != nil {
1605				sc = page.Response().Response.Response.StatusCode
1606			}
1607			tracing.EndSpan(ctx, sc, err)
1608		}()
1609	}
1610	for {
1611		next, err := page.fn(ctx, page.salr)
1612		if err != nil {
1613			return err
1614		}
1615		page.salr = next
1616		if !next.hasNextLink() || !next.IsEmpty() {
1617			break
1618		}
1619	}
1620	return nil
1621}
1622
1623// Next advances to the next page of values.  If there was an error making
1624// the request the page does not advance and the error is returned.
1625// Deprecated: Use NextWithContext() instead.
1626func (page *ScopeAssignmentListResultPage) Next() error {
1627	return page.NextWithContext(context.Background())
1628}
1629
1630// NotDone returns true if the page enumeration should be started or is not yet complete.
1631func (page ScopeAssignmentListResultPage) NotDone() bool {
1632	return !page.salr.IsEmpty()
1633}
1634
1635// Response returns the raw server response from the last page request.
1636func (page ScopeAssignmentListResultPage) Response() ScopeAssignmentListResult {
1637	return page.salr
1638}
1639
1640// Values returns the slice of values for the current page or nil if there are no values.
1641func (page ScopeAssignmentListResultPage) Values() []ScopeAssignment {
1642	if page.salr.IsEmpty() {
1643		return nil
1644	}
1645	return *page.salr.Value
1646}
1647
1648// Creates a new instance of the ScopeAssignmentListResultPage type.
1649func NewScopeAssignmentListResultPage(cur ScopeAssignmentListResult, getNextPage func(context.Context, ScopeAssignmentListResult) (ScopeAssignmentListResult, error)) ScopeAssignmentListResultPage {
1650	return ScopeAssignmentListResultPage{
1651		fn:   getNextPage,
1652		salr: cur,
1653	}
1654}
1655
1656// ScopeAssignmentProperties properties of Managed Network
1657type ScopeAssignmentProperties struct {
1658	// AssignedManagedNetwork - The managed network ID with scope will be assigned to.
1659	AssignedManagedNetwork *string `json:"assignedManagedNetwork,omitempty"`
1660	// ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded'
1661	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1662	// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated.
1663	Etag *string `json:"etag,omitempty"`
1664}
1665
1666// MarshalJSON is the custom marshaler for ScopeAssignmentProperties.
1667func (sap ScopeAssignmentProperties) MarshalJSON() ([]byte, error) {
1668	objectMap := make(map[string]interface{})
1669	if sap.AssignedManagedNetwork != nil {
1670		objectMap["assignedManagedNetwork"] = sap.AssignedManagedNetwork
1671	}
1672	return json.Marshal(objectMap)
1673}
1674
1675// TrackedResource the resource model definition for a ARM tracked top level resource
1676type TrackedResource struct {
1677	// Tags - Resource tags
1678	Tags map[string]*string `json:"tags"`
1679	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1680	ID *string `json:"id,omitempty"`
1681	// Name - READ-ONLY; The name of the resource
1682	Name *string `json:"name,omitempty"`
1683	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1684	Type *string `json:"type,omitempty"`
1685	// Location - The geo-location where the resource lives
1686	Location *string `json:"location,omitempty"`
1687}
1688
1689// MarshalJSON is the custom marshaler for TrackedResource.
1690func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1691	objectMap := make(map[string]interface{})
1692	if tr.Tags != nil {
1693		objectMap["tags"] = tr.Tags
1694	}
1695	if tr.Location != nil {
1696		objectMap["location"] = tr.Location
1697	}
1698	return json.Marshal(objectMap)
1699}
1700
1701// Update update Tags of Managed Network
1702type Update struct {
1703	// Tags - Resource tags
1704	Tags map[string]*string `json:"tags"`
1705}
1706
1707// MarshalJSON is the custom marshaler for Update.
1708func (u Update) MarshalJSON() ([]byte, error) {
1709	objectMap := make(map[string]interface{})
1710	if u.Tags != nil {
1711		objectMap["tags"] = u.Tags
1712	}
1713	return json.Marshal(objectMap)
1714}
1715