1package managedapplications
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/azure"
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/resources/mgmt/2017-09-01/managedapplications"
32
33// Application information about managed application.
34type Application struct {
35	autorest.Response `json:"-"`
36	// ApplicationProperties - The managed application properties.
37	*ApplicationProperties `json:"properties,omitempty"`
38	// Plan - The plan information.
39	Plan *Plan `json:"plan,omitempty"`
40	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
41	Kind *string `json:"kind,omitempty"`
42	// ManagedBy - ID of the resource that manages this resource.
43	ManagedBy *string `json:"managedBy,omitempty"`
44	// Sku - The SKU of the resource.
45	Sku *Sku `json:"sku,omitempty"`
46	// Identity - The identity of the resource.
47	Identity *Identity `json:"identity,omitempty"`
48	// ID - READ-ONLY; Resource ID
49	ID *string `json:"id,omitempty"`
50	// Name - READ-ONLY; Resource name
51	Name *string `json:"name,omitempty"`
52	// Type - READ-ONLY; Resource type
53	Type *string `json:"type,omitempty"`
54	// Location - Resource location
55	Location *string `json:"location,omitempty"`
56	// Tags - Resource tags
57	Tags map[string]*string `json:"tags"`
58}
59
60// MarshalJSON is the custom marshaler for Application.
61func (a Application) MarshalJSON() ([]byte, error) {
62	objectMap := make(map[string]interface{})
63	if a.ApplicationProperties != nil {
64		objectMap["properties"] = a.ApplicationProperties
65	}
66	if a.Plan != nil {
67		objectMap["plan"] = a.Plan
68	}
69	if a.Kind != nil {
70		objectMap["kind"] = a.Kind
71	}
72	if a.ManagedBy != nil {
73		objectMap["managedBy"] = a.ManagedBy
74	}
75	if a.Sku != nil {
76		objectMap["sku"] = a.Sku
77	}
78	if a.Identity != nil {
79		objectMap["identity"] = a.Identity
80	}
81	if a.Location != nil {
82		objectMap["location"] = a.Location
83	}
84	if a.Tags != nil {
85		objectMap["tags"] = a.Tags
86	}
87	return json.Marshal(objectMap)
88}
89
90// UnmarshalJSON is the custom unmarshaler for Application struct.
91func (a *Application) UnmarshalJSON(body []byte) error {
92	var m map[string]*json.RawMessage
93	err := json.Unmarshal(body, &m)
94	if err != nil {
95		return err
96	}
97	for k, v := range m {
98		switch k {
99		case "properties":
100			if v != nil {
101				var applicationProperties ApplicationProperties
102				err = json.Unmarshal(*v, &applicationProperties)
103				if err != nil {
104					return err
105				}
106				a.ApplicationProperties = &applicationProperties
107			}
108		case "plan":
109			if v != nil {
110				var plan Plan
111				err = json.Unmarshal(*v, &plan)
112				if err != nil {
113					return err
114				}
115				a.Plan = &plan
116			}
117		case "kind":
118			if v != nil {
119				var kind string
120				err = json.Unmarshal(*v, &kind)
121				if err != nil {
122					return err
123				}
124				a.Kind = &kind
125			}
126		case "managedBy":
127			if v != nil {
128				var managedBy string
129				err = json.Unmarshal(*v, &managedBy)
130				if err != nil {
131					return err
132				}
133				a.ManagedBy = &managedBy
134			}
135		case "sku":
136			if v != nil {
137				var sku Sku
138				err = json.Unmarshal(*v, &sku)
139				if err != nil {
140					return err
141				}
142				a.Sku = &sku
143			}
144		case "identity":
145			if v != nil {
146				var identity Identity
147				err = json.Unmarshal(*v, &identity)
148				if err != nil {
149					return err
150				}
151				a.Identity = &identity
152			}
153		case "id":
154			if v != nil {
155				var ID string
156				err = json.Unmarshal(*v, &ID)
157				if err != nil {
158					return err
159				}
160				a.ID = &ID
161			}
162		case "name":
163			if v != nil {
164				var name string
165				err = json.Unmarshal(*v, &name)
166				if err != nil {
167					return err
168				}
169				a.Name = &name
170			}
171		case "type":
172			if v != nil {
173				var typeVar string
174				err = json.Unmarshal(*v, &typeVar)
175				if err != nil {
176					return err
177				}
178				a.Type = &typeVar
179			}
180		case "location":
181			if v != nil {
182				var location string
183				err = json.Unmarshal(*v, &location)
184				if err != nil {
185					return err
186				}
187				a.Location = &location
188			}
189		case "tags":
190			if v != nil {
191				var tags map[string]*string
192				err = json.Unmarshal(*v, &tags)
193				if err != nil {
194					return err
195				}
196				a.Tags = tags
197			}
198		}
199	}
200
201	return nil
202}
203
204// ApplicationArtifact managed application artifact.
205type ApplicationArtifact struct {
206	// Name - The managed application artifact name.
207	Name *string `json:"name,omitempty"`
208	// URI - The managed application artifact blob uri.
209	URI *string `json:"uri,omitempty"`
210	// Type - The managed application artifact type. Possible values include: 'Template', 'Custom'
211	Type ApplicationArtifactType `json:"type,omitempty"`
212}
213
214// ApplicationDefinition information about managed application definition.
215type ApplicationDefinition struct {
216	autorest.Response `json:"-"`
217	// ApplicationDefinitionProperties - The managed application definition properties.
218	*ApplicationDefinitionProperties `json:"properties,omitempty"`
219	// ManagedBy - ID of the resource that manages this resource.
220	ManagedBy *string `json:"managedBy,omitempty"`
221	// Sku - The SKU of the resource.
222	Sku *Sku `json:"sku,omitempty"`
223	// Identity - The identity of the resource.
224	Identity *Identity `json:"identity,omitempty"`
225	// ID - READ-ONLY; Resource ID
226	ID *string `json:"id,omitempty"`
227	// Name - READ-ONLY; Resource name
228	Name *string `json:"name,omitempty"`
229	// Type - READ-ONLY; Resource type
230	Type *string `json:"type,omitempty"`
231	// Location - Resource location
232	Location *string `json:"location,omitempty"`
233	// Tags - Resource tags
234	Tags map[string]*string `json:"tags"`
235}
236
237// MarshalJSON is the custom marshaler for ApplicationDefinition.
238func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) {
239	objectMap := make(map[string]interface{})
240	if ad.ApplicationDefinitionProperties != nil {
241		objectMap["properties"] = ad.ApplicationDefinitionProperties
242	}
243	if ad.ManagedBy != nil {
244		objectMap["managedBy"] = ad.ManagedBy
245	}
246	if ad.Sku != nil {
247		objectMap["sku"] = ad.Sku
248	}
249	if ad.Identity != nil {
250		objectMap["identity"] = ad.Identity
251	}
252	if ad.Location != nil {
253		objectMap["location"] = ad.Location
254	}
255	if ad.Tags != nil {
256		objectMap["tags"] = ad.Tags
257	}
258	return json.Marshal(objectMap)
259}
260
261// UnmarshalJSON is the custom unmarshaler for ApplicationDefinition struct.
262func (ad *ApplicationDefinition) UnmarshalJSON(body []byte) error {
263	var m map[string]*json.RawMessage
264	err := json.Unmarshal(body, &m)
265	if err != nil {
266		return err
267	}
268	for k, v := range m {
269		switch k {
270		case "properties":
271			if v != nil {
272				var applicationDefinitionProperties ApplicationDefinitionProperties
273				err = json.Unmarshal(*v, &applicationDefinitionProperties)
274				if err != nil {
275					return err
276				}
277				ad.ApplicationDefinitionProperties = &applicationDefinitionProperties
278			}
279		case "managedBy":
280			if v != nil {
281				var managedBy string
282				err = json.Unmarshal(*v, &managedBy)
283				if err != nil {
284					return err
285				}
286				ad.ManagedBy = &managedBy
287			}
288		case "sku":
289			if v != nil {
290				var sku Sku
291				err = json.Unmarshal(*v, &sku)
292				if err != nil {
293					return err
294				}
295				ad.Sku = &sku
296			}
297		case "identity":
298			if v != nil {
299				var identity Identity
300				err = json.Unmarshal(*v, &identity)
301				if err != nil {
302					return err
303				}
304				ad.Identity = &identity
305			}
306		case "id":
307			if v != nil {
308				var ID string
309				err = json.Unmarshal(*v, &ID)
310				if err != nil {
311					return err
312				}
313				ad.ID = &ID
314			}
315		case "name":
316			if v != nil {
317				var name string
318				err = json.Unmarshal(*v, &name)
319				if err != nil {
320					return err
321				}
322				ad.Name = &name
323			}
324		case "type":
325			if v != nil {
326				var typeVar string
327				err = json.Unmarshal(*v, &typeVar)
328				if err != nil {
329					return err
330				}
331				ad.Type = &typeVar
332			}
333		case "location":
334			if v != nil {
335				var location string
336				err = json.Unmarshal(*v, &location)
337				if err != nil {
338					return err
339				}
340				ad.Location = &location
341			}
342		case "tags":
343			if v != nil {
344				var tags map[string]*string
345				err = json.Unmarshal(*v, &tags)
346				if err != nil {
347					return err
348				}
349				ad.Tags = tags
350			}
351		}
352	}
353
354	return nil
355}
356
357// ApplicationDefinitionListResult list of managed application definitions.
358type ApplicationDefinitionListResult struct {
359	autorest.Response `json:"-"`
360	// Value - The array of managed application definitions.
361	Value *[]ApplicationDefinition `json:"value,omitempty"`
362	// NextLink - The URL to use for getting the next set of results.
363	NextLink *string `json:"nextLink,omitempty"`
364}
365
366// ApplicationDefinitionListResultIterator provides access to a complete listing of ApplicationDefinition
367// values.
368type ApplicationDefinitionListResultIterator struct {
369	i    int
370	page ApplicationDefinitionListResultPage
371}
372
373// NextWithContext advances to the next value.  If there was an error making
374// the request the iterator does not advance and the error is returned.
375func (iter *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
376	if tracing.IsEnabled() {
377		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.NextWithContext")
378		defer func() {
379			sc := -1
380			if iter.Response().Response.Response != nil {
381				sc = iter.Response().Response.Response.StatusCode
382			}
383			tracing.EndSpan(ctx, sc, err)
384		}()
385	}
386	iter.i++
387	if iter.i < len(iter.page.Values()) {
388		return nil
389	}
390	err = iter.page.NextWithContext(ctx)
391	if err != nil {
392		iter.i--
393		return err
394	}
395	iter.i = 0
396	return nil
397}
398
399// Next advances to the next value.  If there was an error making
400// the request the iterator does not advance and the error is returned.
401// Deprecated: Use NextWithContext() instead.
402func (iter *ApplicationDefinitionListResultIterator) Next() error {
403	return iter.NextWithContext(context.Background())
404}
405
406// NotDone returns true if the enumeration should be started or is not yet complete.
407func (iter ApplicationDefinitionListResultIterator) NotDone() bool {
408	return iter.page.NotDone() && iter.i < len(iter.page.Values())
409}
410
411// Response returns the raw server response from the last page request.
412func (iter ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult {
413	return iter.page.Response()
414}
415
416// Value returns the current value or a zero-initialized value if the
417// iterator has advanced beyond the end of the collection.
418func (iter ApplicationDefinitionListResultIterator) Value() ApplicationDefinition {
419	if !iter.page.NotDone() {
420		return ApplicationDefinition{}
421	}
422	return iter.page.Values()[iter.i]
423}
424
425// Creates a new instance of the ApplicationDefinitionListResultIterator type.
426func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator {
427	return ApplicationDefinitionListResultIterator{page: page}
428}
429
430// IsEmpty returns true if the ListResult contains no values.
431func (adlr ApplicationDefinitionListResult) IsEmpty() bool {
432	return adlr.Value == nil || len(*adlr.Value) == 0
433}
434
435// hasNextLink returns true if the NextLink is not empty.
436func (adlr ApplicationDefinitionListResult) hasNextLink() bool {
437	return adlr.NextLink != nil && len(*adlr.NextLink) != 0
438}
439
440// applicationDefinitionListResultPreparer prepares a request to retrieve the next set of results.
441// It returns nil if no more results exist.
442func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
443	if !adlr.hasNextLink() {
444		return nil, nil
445	}
446	return autorest.Prepare((&http.Request{}).WithContext(ctx),
447		autorest.AsJSON(),
448		autorest.AsGet(),
449		autorest.WithBaseURL(to.String(adlr.NextLink)))
450}
451
452// ApplicationDefinitionListResultPage contains a page of ApplicationDefinition values.
453type ApplicationDefinitionListResultPage struct {
454	fn   func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)
455	adlr ApplicationDefinitionListResult
456}
457
458// NextWithContext advances to the next page of values.  If there was an error making
459// the request the page does not advance and the error is returned.
460func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
461	if tracing.IsEnabled() {
462		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.NextWithContext")
463		defer func() {
464			sc := -1
465			if page.Response().Response.Response != nil {
466				sc = page.Response().Response.Response.StatusCode
467			}
468			tracing.EndSpan(ctx, sc, err)
469		}()
470	}
471	for {
472		next, err := page.fn(ctx, page.adlr)
473		if err != nil {
474			return err
475		}
476		page.adlr = next
477		if !next.hasNextLink() || !next.IsEmpty() {
478			break
479		}
480	}
481	return nil
482}
483
484// Next advances to the next page of values.  If there was an error making
485// the request the page does not advance and the error is returned.
486// Deprecated: Use NextWithContext() instead.
487func (page *ApplicationDefinitionListResultPage) Next() error {
488	return page.NextWithContext(context.Background())
489}
490
491// NotDone returns true if the page enumeration should be started or is not yet complete.
492func (page ApplicationDefinitionListResultPage) NotDone() bool {
493	return !page.adlr.IsEmpty()
494}
495
496// Response returns the raw server response from the last page request.
497func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult {
498	return page.adlr
499}
500
501// Values returns the slice of values for the current page or nil if there are no values.
502func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition {
503	if page.adlr.IsEmpty() {
504		return nil
505	}
506	return *page.adlr.Value
507}
508
509// Creates a new instance of the ApplicationDefinitionListResultPage type.
510func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage {
511	return ApplicationDefinitionListResultPage{
512		fn:   getNextPage,
513		adlr: cur,
514	}
515}
516
517// ApplicationDefinitionProperties the managed application definition properties.
518type ApplicationDefinitionProperties struct {
519	// LockLevel - The managed application lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None'
520	LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
521	// DisplayName - The managed application definition display name.
522	DisplayName *string `json:"displayName,omitempty"`
523	// IsEnabled - A value indicating whether the package is enabled or not.
524	IsEnabled *string `json:"isEnabled,omitempty"`
525	// Authorizations - The managed application provider authorizations.
526	Authorizations *[]ApplicationProviderAuthorization `json:"authorizations,omitempty"`
527	// Artifacts - The collection of managed application artifacts. The portal will use the files specified as artifacts to construct the user experience of creating a managed application from a managed application definition.
528	Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
529	// Description - The managed application definition description.
530	Description *string `json:"description,omitempty"`
531	// PackageFileURI - The managed application definition package file Uri. Use this element
532	PackageFileURI *string `json:"packageFileUri,omitempty"`
533	// MainTemplate - The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string.
534	MainTemplate interface{} `json:"mainTemplate,omitempty"`
535	// CreateUIDefinition - The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.
536	CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
537}
538
539// ApplicationDefinitionsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results
540// of a long-running operation.
541type ApplicationDefinitionsCreateOrUpdateByIDFuture struct {
542	azure.FutureAPI
543	// Result returns the result of the asynchronous operation.
544	// If the operation has not completed it will return an error.
545	Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error)
546}
547
548// ApplicationDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
549// long-running operation.
550type ApplicationDefinitionsCreateOrUpdateFuture struct {
551	azure.FutureAPI
552	// Result returns the result of the asynchronous operation.
553	// If the operation has not completed it will return an error.
554	Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error)
555}
556
557// ApplicationDefinitionsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a
558// long-running operation.
559type ApplicationDefinitionsDeleteByIDFuture struct {
560	azure.FutureAPI
561	// Result returns the result of the asynchronous operation.
562	// If the operation has not completed it will return an error.
563	Result func(ApplicationDefinitionsClient) (autorest.Response, error)
564}
565
566// ApplicationDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of a
567// long-running operation.
568type ApplicationDefinitionsDeleteFuture struct {
569	azure.FutureAPI
570	// Result returns the result of the asynchronous operation.
571	// If the operation has not completed it will return an error.
572	Result func(ApplicationDefinitionsClient) (autorest.Response, error)
573}
574
575// ApplicationListResult list of managed applications.
576type ApplicationListResult struct {
577	autorest.Response `json:"-"`
578	// Value - The array of managed applications.
579	Value *[]Application `json:"value,omitempty"`
580	// NextLink - The URL to use for getting the next set of results.
581	NextLink *string `json:"nextLink,omitempty"`
582}
583
584// ApplicationListResultIterator provides access to a complete listing of Application values.
585type ApplicationListResultIterator struct {
586	i    int
587	page ApplicationListResultPage
588}
589
590// NextWithContext advances to the next value.  If there was an error making
591// the request the iterator does not advance and the error is returned.
592func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
593	if tracing.IsEnabled() {
594		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
595		defer func() {
596			sc := -1
597			if iter.Response().Response.Response != nil {
598				sc = iter.Response().Response.Response.StatusCode
599			}
600			tracing.EndSpan(ctx, sc, err)
601		}()
602	}
603	iter.i++
604	if iter.i < len(iter.page.Values()) {
605		return nil
606	}
607	err = iter.page.NextWithContext(ctx)
608	if err != nil {
609		iter.i--
610		return err
611	}
612	iter.i = 0
613	return nil
614}
615
616// Next advances to the next value.  If there was an error making
617// the request the iterator does not advance and the error is returned.
618// Deprecated: Use NextWithContext() instead.
619func (iter *ApplicationListResultIterator) Next() error {
620	return iter.NextWithContext(context.Background())
621}
622
623// NotDone returns true if the enumeration should be started or is not yet complete.
624func (iter ApplicationListResultIterator) NotDone() bool {
625	return iter.page.NotDone() && iter.i < len(iter.page.Values())
626}
627
628// Response returns the raw server response from the last page request.
629func (iter ApplicationListResultIterator) Response() ApplicationListResult {
630	return iter.page.Response()
631}
632
633// Value returns the current value or a zero-initialized value if the
634// iterator has advanced beyond the end of the collection.
635func (iter ApplicationListResultIterator) Value() Application {
636	if !iter.page.NotDone() {
637		return Application{}
638	}
639	return iter.page.Values()[iter.i]
640}
641
642// Creates a new instance of the ApplicationListResultIterator type.
643func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
644	return ApplicationListResultIterator{page: page}
645}
646
647// IsEmpty returns true if the ListResult contains no values.
648func (alr ApplicationListResult) IsEmpty() bool {
649	return alr.Value == nil || len(*alr.Value) == 0
650}
651
652// hasNextLink returns true if the NextLink is not empty.
653func (alr ApplicationListResult) hasNextLink() bool {
654	return alr.NextLink != nil && len(*alr.NextLink) != 0
655}
656
657// applicationListResultPreparer prepares a request to retrieve the next set of results.
658// It returns nil if no more results exist.
659func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
660	if !alr.hasNextLink() {
661		return nil, nil
662	}
663	return autorest.Prepare((&http.Request{}).WithContext(ctx),
664		autorest.AsJSON(),
665		autorest.AsGet(),
666		autorest.WithBaseURL(to.String(alr.NextLink)))
667}
668
669// ApplicationListResultPage contains a page of Application values.
670type ApplicationListResultPage struct {
671	fn  func(context.Context, ApplicationListResult) (ApplicationListResult, error)
672	alr ApplicationListResult
673}
674
675// NextWithContext advances to the next page of values.  If there was an error making
676// the request the page does not advance and the error is returned.
677func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
678	if tracing.IsEnabled() {
679		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
680		defer func() {
681			sc := -1
682			if page.Response().Response.Response != nil {
683				sc = page.Response().Response.Response.StatusCode
684			}
685			tracing.EndSpan(ctx, sc, err)
686		}()
687	}
688	for {
689		next, err := page.fn(ctx, page.alr)
690		if err != nil {
691			return err
692		}
693		page.alr = next
694		if !next.hasNextLink() || !next.IsEmpty() {
695			break
696		}
697	}
698	return nil
699}
700
701// Next advances to the next page of values.  If there was an error making
702// the request the page does not advance and the error is returned.
703// Deprecated: Use NextWithContext() instead.
704func (page *ApplicationListResultPage) Next() error {
705	return page.NextWithContext(context.Background())
706}
707
708// NotDone returns true if the page enumeration should be started or is not yet complete.
709func (page ApplicationListResultPage) NotDone() bool {
710	return !page.alr.IsEmpty()
711}
712
713// Response returns the raw server response from the last page request.
714func (page ApplicationListResultPage) Response() ApplicationListResult {
715	return page.alr
716}
717
718// Values returns the slice of values for the current page or nil if there are no values.
719func (page ApplicationListResultPage) Values() []Application {
720	if page.alr.IsEmpty() {
721		return nil
722	}
723	return *page.alr.Value
724}
725
726// Creates a new instance of the ApplicationListResultPage type.
727func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
728	return ApplicationListResultPage{
729		fn:  getNextPage,
730		alr: cur,
731	}
732}
733
734// ApplicationPatchable information about managed application.
735type ApplicationPatchable struct {
736	// ApplicationPropertiesPatchable - The managed application properties.
737	*ApplicationPropertiesPatchable `json:"properties,omitempty"`
738	// Plan - The plan information.
739	Plan *PlanPatchable `json:"plan,omitempty"`
740	// Kind - The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
741	Kind *string `json:"kind,omitempty"`
742	// ManagedBy - ID of the resource that manages this resource.
743	ManagedBy *string `json:"managedBy,omitempty"`
744	// Sku - The SKU of the resource.
745	Sku *Sku `json:"sku,omitempty"`
746	// Identity - The identity of the resource.
747	Identity *Identity `json:"identity,omitempty"`
748	// ID - READ-ONLY; Resource ID
749	ID *string `json:"id,omitempty"`
750	// Name - READ-ONLY; Resource name
751	Name *string `json:"name,omitempty"`
752	// Type - READ-ONLY; Resource type
753	Type *string `json:"type,omitempty"`
754	// Location - Resource location
755	Location *string `json:"location,omitempty"`
756	// Tags - Resource tags
757	Tags map[string]*string `json:"tags"`
758}
759
760// MarshalJSON is the custom marshaler for ApplicationPatchable.
761func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
762	objectMap := make(map[string]interface{})
763	if ap.ApplicationPropertiesPatchable != nil {
764		objectMap["properties"] = ap.ApplicationPropertiesPatchable
765	}
766	if ap.Plan != nil {
767		objectMap["plan"] = ap.Plan
768	}
769	if ap.Kind != nil {
770		objectMap["kind"] = ap.Kind
771	}
772	if ap.ManagedBy != nil {
773		objectMap["managedBy"] = ap.ManagedBy
774	}
775	if ap.Sku != nil {
776		objectMap["sku"] = ap.Sku
777	}
778	if ap.Identity != nil {
779		objectMap["identity"] = ap.Identity
780	}
781	if ap.Location != nil {
782		objectMap["location"] = ap.Location
783	}
784	if ap.Tags != nil {
785		objectMap["tags"] = ap.Tags
786	}
787	return json.Marshal(objectMap)
788}
789
790// UnmarshalJSON is the custom unmarshaler for ApplicationPatchable struct.
791func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
792	var m map[string]*json.RawMessage
793	err := json.Unmarshal(body, &m)
794	if err != nil {
795		return err
796	}
797	for k, v := range m {
798		switch k {
799		case "properties":
800			if v != nil {
801				var applicationPropertiesPatchable ApplicationPropertiesPatchable
802				err = json.Unmarshal(*v, &applicationPropertiesPatchable)
803				if err != nil {
804					return err
805				}
806				ap.ApplicationPropertiesPatchable = &applicationPropertiesPatchable
807			}
808		case "plan":
809			if v != nil {
810				var plan PlanPatchable
811				err = json.Unmarshal(*v, &plan)
812				if err != nil {
813					return err
814				}
815				ap.Plan = &plan
816			}
817		case "kind":
818			if v != nil {
819				var kind string
820				err = json.Unmarshal(*v, &kind)
821				if err != nil {
822					return err
823				}
824				ap.Kind = &kind
825			}
826		case "managedBy":
827			if v != nil {
828				var managedBy string
829				err = json.Unmarshal(*v, &managedBy)
830				if err != nil {
831					return err
832				}
833				ap.ManagedBy = &managedBy
834			}
835		case "sku":
836			if v != nil {
837				var sku Sku
838				err = json.Unmarshal(*v, &sku)
839				if err != nil {
840					return err
841				}
842				ap.Sku = &sku
843			}
844		case "identity":
845			if v != nil {
846				var identity Identity
847				err = json.Unmarshal(*v, &identity)
848				if err != nil {
849					return err
850				}
851				ap.Identity = &identity
852			}
853		case "id":
854			if v != nil {
855				var ID string
856				err = json.Unmarshal(*v, &ID)
857				if err != nil {
858					return err
859				}
860				ap.ID = &ID
861			}
862		case "name":
863			if v != nil {
864				var name string
865				err = json.Unmarshal(*v, &name)
866				if err != nil {
867					return err
868				}
869				ap.Name = &name
870			}
871		case "type":
872			if v != nil {
873				var typeVar string
874				err = json.Unmarshal(*v, &typeVar)
875				if err != nil {
876					return err
877				}
878				ap.Type = &typeVar
879			}
880		case "location":
881			if v != nil {
882				var location string
883				err = json.Unmarshal(*v, &location)
884				if err != nil {
885					return err
886				}
887				ap.Location = &location
888			}
889		case "tags":
890			if v != nil {
891				var tags map[string]*string
892				err = json.Unmarshal(*v, &tags)
893				if err != nil {
894					return err
895				}
896				ap.Tags = tags
897			}
898		}
899	}
900
901	return nil
902}
903
904// ApplicationProperties the managed application properties.
905type ApplicationProperties struct {
906	// ManagedResourceGroupID - The managed resource group Id.
907	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
908	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
909	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
910	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
911	Parameters interface{} `json:"parameters,omitempty"`
912	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
913	Outputs interface{} `json:"outputs,omitempty"`
914	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
915	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
916	// UIDefinitionURI - The blob URI where the UI definition file is located.
917	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
918}
919
920// MarshalJSON is the custom marshaler for ApplicationProperties.
921func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
922	objectMap := make(map[string]interface{})
923	if ap.ManagedResourceGroupID != nil {
924		objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
925	}
926	if ap.ApplicationDefinitionID != nil {
927		objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
928	}
929	if ap.Parameters != nil {
930		objectMap["parameters"] = ap.Parameters
931	}
932	if ap.UIDefinitionURI != nil {
933		objectMap["uiDefinitionUri"] = ap.UIDefinitionURI
934	}
935	return json.Marshal(objectMap)
936}
937
938// ApplicationPropertiesPatchable the managed application properties.
939type ApplicationPropertiesPatchable struct {
940	// ManagedResourceGroupID - The managed resource group Id.
941	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
942	// ApplicationDefinitionID - The fully qualified path of managed application definition Id.
943	ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
944	// Parameters - Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string.
945	Parameters interface{} `json:"parameters,omitempty"`
946	// Outputs - READ-ONLY; Name and value pairs that define the managed application outputs.
947	Outputs interface{} `json:"outputs,omitempty"`
948	// ProvisioningState - READ-ONLY; The managed application provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
949	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
950	// UIDefinitionURI - The blob URI where the UI definition file is located.
951	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
952}
953
954// MarshalJSON is the custom marshaler for ApplicationPropertiesPatchable.
955func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
956	objectMap := make(map[string]interface{})
957	if app.ManagedResourceGroupID != nil {
958		objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
959	}
960	if app.ApplicationDefinitionID != nil {
961		objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
962	}
963	if app.Parameters != nil {
964		objectMap["parameters"] = app.Parameters
965	}
966	if app.UIDefinitionURI != nil {
967		objectMap["uiDefinitionUri"] = app.UIDefinitionURI
968	}
969	return json.Marshal(objectMap)
970}
971
972// ApplicationProviderAuthorization the managed application provider authorization.
973type ApplicationProviderAuthorization struct {
974	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources.
975	PrincipalID *string `json:"principalId,omitempty"`
976	// RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the managed application's container resource group. This role definition cannot have permission to delete the resource group.
977	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
978}
979
980// ApplicationsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
981// long-running operation.
982type ApplicationsCreateOrUpdateByIDFuture struct {
983	azure.FutureAPI
984	// Result returns the result of the asynchronous operation.
985	// If the operation has not completed it will return an error.
986	Result func(ApplicationsClient) (Application, error)
987}
988
989// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
990// long-running operation.
991type ApplicationsCreateOrUpdateFuture struct {
992	azure.FutureAPI
993	// Result returns the result of the asynchronous operation.
994	// If the operation has not completed it will return an error.
995	Result func(ApplicationsClient) (Application, error)
996}
997
998// ApplicationsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
999// operation.
1000type ApplicationsDeleteByIDFuture struct {
1001	azure.FutureAPI
1002	// Result returns the result of the asynchronous operation.
1003	// If the operation has not completed it will return an error.
1004	Result func(ApplicationsClient) (autorest.Response, error)
1005}
1006
1007// ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1008// operation.
1009type ApplicationsDeleteFuture struct {
1010	azure.FutureAPI
1011	// Result returns the result of the asynchronous operation.
1012	// If the operation has not completed it will return an error.
1013	Result func(ApplicationsClient) (autorest.Response, error)
1014}
1015
1016// ErrorResponse error response indicates managed application is not able to process the incoming request.
1017// The reason is provided in the error message.
1018type ErrorResponse struct {
1019	// HTTPStatus - Http status code.
1020	HTTPStatus *string `json:"httpStatus,omitempty"`
1021	// ErrorCode - Error code.
1022	ErrorCode *string `json:"errorCode,omitempty"`
1023	// ErrorMessage - Error message indicating why the operation failed.
1024	ErrorMessage *string `json:"errorMessage,omitempty"`
1025}
1026
1027// GenericResource resource information.
1028type GenericResource struct {
1029	// ManagedBy - ID of the resource that manages this resource.
1030	ManagedBy *string `json:"managedBy,omitempty"`
1031	// Sku - The SKU of the resource.
1032	Sku *Sku `json:"sku,omitempty"`
1033	// Identity - The identity of the resource.
1034	Identity *Identity `json:"identity,omitempty"`
1035	// ID - READ-ONLY; Resource ID
1036	ID *string `json:"id,omitempty"`
1037	// Name - READ-ONLY; Resource name
1038	Name *string `json:"name,omitempty"`
1039	// Type - READ-ONLY; Resource type
1040	Type *string `json:"type,omitempty"`
1041	// Location - Resource location
1042	Location *string `json:"location,omitempty"`
1043	// Tags - Resource tags
1044	Tags map[string]*string `json:"tags"`
1045}
1046
1047// MarshalJSON is the custom marshaler for GenericResource.
1048func (gr GenericResource) MarshalJSON() ([]byte, error) {
1049	objectMap := make(map[string]interface{})
1050	if gr.ManagedBy != nil {
1051		objectMap["managedBy"] = gr.ManagedBy
1052	}
1053	if gr.Sku != nil {
1054		objectMap["sku"] = gr.Sku
1055	}
1056	if gr.Identity != nil {
1057		objectMap["identity"] = gr.Identity
1058	}
1059	if gr.Location != nil {
1060		objectMap["location"] = gr.Location
1061	}
1062	if gr.Tags != nil {
1063		objectMap["tags"] = gr.Tags
1064	}
1065	return json.Marshal(objectMap)
1066}
1067
1068// Identity identity for the resource.
1069type Identity struct {
1070	// PrincipalID - READ-ONLY; The principal ID of resource identity.
1071	PrincipalID *string `json:"principalId,omitempty"`
1072	// TenantID - READ-ONLY; The tenant ID of resource.
1073	TenantID *string `json:"tenantId,omitempty"`
1074	// Type - The identity type. Possible values include: 'SystemAssigned'
1075	Type ResourceIdentityType `json:"type,omitempty"`
1076}
1077
1078// MarshalJSON is the custom marshaler for Identity.
1079func (i Identity) MarshalJSON() ([]byte, error) {
1080	objectMap := make(map[string]interface{})
1081	if i.Type != "" {
1082		objectMap["type"] = i.Type
1083	}
1084	return json.Marshal(objectMap)
1085}
1086
1087// Plan plan for the managed application.
1088type Plan struct {
1089	// Name - The plan name.
1090	Name *string `json:"name,omitempty"`
1091	// Publisher - The publisher ID.
1092	Publisher *string `json:"publisher,omitempty"`
1093	// Product - The product code.
1094	Product *string `json:"product,omitempty"`
1095	// PromotionCode - The promotion code.
1096	PromotionCode *string `json:"promotionCode,omitempty"`
1097	// Version - The plan's version.
1098	Version *string `json:"version,omitempty"`
1099}
1100
1101// PlanPatchable plan for the managed application.
1102type PlanPatchable struct {
1103	// Name - The plan name.
1104	Name *string `json:"name,omitempty"`
1105	// Publisher - The publisher ID.
1106	Publisher *string `json:"publisher,omitempty"`
1107	// Product - The product code.
1108	Product *string `json:"product,omitempty"`
1109	// PromotionCode - The promotion code.
1110	PromotionCode *string `json:"promotionCode,omitempty"`
1111	// Version - The plan's version.
1112	Version *string `json:"version,omitempty"`
1113}
1114
1115// Resource resource information.
1116type Resource struct {
1117	// ID - READ-ONLY; Resource ID
1118	ID *string `json:"id,omitempty"`
1119	// Name - READ-ONLY; Resource name
1120	Name *string `json:"name,omitempty"`
1121	// Type - READ-ONLY; Resource type
1122	Type *string `json:"type,omitempty"`
1123	// Location - Resource location
1124	Location *string `json:"location,omitempty"`
1125	// Tags - Resource tags
1126	Tags map[string]*string `json:"tags"`
1127}
1128
1129// MarshalJSON is the custom marshaler for Resource.
1130func (r Resource) MarshalJSON() ([]byte, error) {
1131	objectMap := make(map[string]interface{})
1132	if r.Location != nil {
1133		objectMap["location"] = r.Location
1134	}
1135	if r.Tags != nil {
1136		objectMap["tags"] = r.Tags
1137	}
1138	return json.Marshal(objectMap)
1139}
1140
1141// Sku SKU for the resource.
1142type Sku struct {
1143	// Name - The SKU name.
1144	Name *string `json:"name,omitempty"`
1145	// Tier - The SKU tier.
1146	Tier *string `json:"tier,omitempty"`
1147	// Size - The SKU size.
1148	Size *string `json:"size,omitempty"`
1149	// Family - The SKU family.
1150	Family *string `json:"family,omitempty"`
1151	// Model - The SKU model.
1152	Model *string `json:"model,omitempty"`
1153	// Capacity - The SKU capacity.
1154	Capacity *int32 `json:"capacity,omitempty"`
1155}
1156