1package authorization
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	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/to"
24	"net/http"
25)
26
27// ClassicAdministrator classic Administrators
28type ClassicAdministrator struct {
29	// ID - The ID of the administrator.
30	ID *string `json:"id,omitempty"`
31	// Name - The name of the administrator.
32	Name *string `json:"name,omitempty"`
33	// Type - The type of the administrator.
34	Type *string `json:"type,omitempty"`
35	// ClassicAdministratorProperties - Properties for the classic administrator.
36	*ClassicAdministratorProperties `json:"properties,omitempty"`
37}
38
39// MarshalJSON is the custom marshaler for ClassicAdministrator.
40func (ca ClassicAdministrator) MarshalJSON() ([]byte, error) {
41	objectMap := make(map[string]interface{})
42	if ca.ID != nil {
43		objectMap["id"] = ca.ID
44	}
45	if ca.Name != nil {
46		objectMap["name"] = ca.Name
47	}
48	if ca.Type != nil {
49		objectMap["type"] = ca.Type
50	}
51	if ca.ClassicAdministratorProperties != nil {
52		objectMap["properties"] = ca.ClassicAdministratorProperties
53	}
54	return json.Marshal(objectMap)
55}
56
57// UnmarshalJSON is the custom unmarshaler for ClassicAdministrator struct.
58func (ca *ClassicAdministrator) UnmarshalJSON(body []byte) error {
59	var m map[string]*json.RawMessage
60	err := json.Unmarshal(body, &m)
61	if err != nil {
62		return err
63	}
64	for k, v := range m {
65		switch k {
66		case "id":
67			if v != nil {
68				var ID string
69				err = json.Unmarshal(*v, &ID)
70				if err != nil {
71					return err
72				}
73				ca.ID = &ID
74			}
75		case "name":
76			if v != nil {
77				var name string
78				err = json.Unmarshal(*v, &name)
79				if err != nil {
80					return err
81				}
82				ca.Name = &name
83			}
84		case "type":
85			if v != nil {
86				var typeVar string
87				err = json.Unmarshal(*v, &typeVar)
88				if err != nil {
89					return err
90				}
91				ca.Type = &typeVar
92			}
93		case "properties":
94			if v != nil {
95				var classicAdministratorProperties ClassicAdministratorProperties
96				err = json.Unmarshal(*v, &classicAdministratorProperties)
97				if err != nil {
98					return err
99				}
100				ca.ClassicAdministratorProperties = &classicAdministratorProperties
101			}
102		}
103	}
104
105	return nil
106}
107
108// ClassicAdministratorListResult classicAdministrator list result information.
109type ClassicAdministratorListResult struct {
110	autorest.Response `json:"-"`
111	// Value - An array of administrators.
112	Value *[]ClassicAdministrator `json:"value,omitempty"`
113	// NextLink - The URL to use for getting the next set of results.
114	NextLink *string `json:"nextLink,omitempty"`
115}
116
117// ClassicAdministratorListResultIterator provides access to a complete listing of ClassicAdministrator values.
118type ClassicAdministratorListResultIterator struct {
119	i    int
120	page ClassicAdministratorListResultPage
121}
122
123// Next advances to the next value.  If there was an error making
124// the request the iterator does not advance and the error is returned.
125func (iter *ClassicAdministratorListResultIterator) Next() error {
126	iter.i++
127	if iter.i < len(iter.page.Values()) {
128		return nil
129	}
130	err := iter.page.Next()
131	if err != nil {
132		iter.i--
133		return err
134	}
135	iter.i = 0
136	return nil
137}
138
139// NotDone returns true if the enumeration should be started or is not yet complete.
140func (iter ClassicAdministratorListResultIterator) NotDone() bool {
141	return iter.page.NotDone() && iter.i < len(iter.page.Values())
142}
143
144// Response returns the raw server response from the last page request.
145func (iter ClassicAdministratorListResultIterator) Response() ClassicAdministratorListResult {
146	return iter.page.Response()
147}
148
149// Value returns the current value or a zero-initialized value if the
150// iterator has advanced beyond the end of the collection.
151func (iter ClassicAdministratorListResultIterator) Value() ClassicAdministrator {
152	if !iter.page.NotDone() {
153		return ClassicAdministrator{}
154	}
155	return iter.page.Values()[iter.i]
156}
157
158// IsEmpty returns true if the ListResult contains no values.
159func (calr ClassicAdministratorListResult) IsEmpty() bool {
160	return calr.Value == nil || len(*calr.Value) == 0
161}
162
163// classicAdministratorListResultPreparer prepares a request to retrieve the next set of results.
164// It returns nil if no more results exist.
165func (calr ClassicAdministratorListResult) classicAdministratorListResultPreparer() (*http.Request, error) {
166	if calr.NextLink == nil || len(to.String(calr.NextLink)) < 1 {
167		return nil, nil
168	}
169	return autorest.Prepare(&http.Request{},
170		autorest.AsJSON(),
171		autorest.AsGet(),
172		autorest.WithBaseURL(to.String(calr.NextLink)))
173}
174
175// ClassicAdministratorListResultPage contains a page of ClassicAdministrator values.
176type ClassicAdministratorListResultPage struct {
177	fn   func(ClassicAdministratorListResult) (ClassicAdministratorListResult, error)
178	calr ClassicAdministratorListResult
179}
180
181// Next advances to the next page of values.  If there was an error making
182// the request the page does not advance and the error is returned.
183func (page *ClassicAdministratorListResultPage) Next() error {
184	next, err := page.fn(page.calr)
185	if err != nil {
186		return err
187	}
188	page.calr = next
189	return nil
190}
191
192// NotDone returns true if the page enumeration should be started or is not yet complete.
193func (page ClassicAdministratorListResultPage) NotDone() bool {
194	return !page.calr.IsEmpty()
195}
196
197// Response returns the raw server response from the last page request.
198func (page ClassicAdministratorListResultPage) Response() ClassicAdministratorListResult {
199	return page.calr
200}
201
202// Values returns the slice of values for the current page or nil if there are no values.
203func (page ClassicAdministratorListResultPage) Values() []ClassicAdministrator {
204	if page.calr.IsEmpty() {
205		return nil
206	}
207	return *page.calr.Value
208}
209
210// ClassicAdministratorProperties classic Administrator properties.
211type ClassicAdministratorProperties struct {
212	// EmailAddress - The email address of the administrator.
213	EmailAddress *string `json:"emailAddress,omitempty"`
214	// Role - The role of the administrator.
215	Role *string `json:"role,omitempty"`
216}
217
218// Permission role definition permissions.
219type Permission struct {
220	// Actions - Allowed actions.
221	Actions *[]string `json:"actions,omitempty"`
222	// NotActions - Denied actions.
223	NotActions *[]string `json:"notActions,omitempty"`
224	// DataActions - Allowed Data actions.
225	DataActions *[]string `json:"dataActions,omitempty"`
226	// NotDataActions - Denied Data actions.
227	NotDataActions *[]string `json:"notDataActions,omitempty"`
228}
229
230// PermissionGetResult permissions information.
231type PermissionGetResult struct {
232	autorest.Response `json:"-"`
233	// Value - An array of permissions.
234	Value *[]Permission `json:"value,omitempty"`
235	// NextLink - The URL to use for getting the next set of results.
236	NextLink *string `json:"nextLink,omitempty"`
237}
238
239// PermissionGetResultIterator provides access to a complete listing of Permission values.
240type PermissionGetResultIterator struct {
241	i    int
242	page PermissionGetResultPage
243}
244
245// Next advances to the next value.  If there was an error making
246// the request the iterator does not advance and the error is returned.
247func (iter *PermissionGetResultIterator) Next() error {
248	iter.i++
249	if iter.i < len(iter.page.Values()) {
250		return nil
251	}
252	err := iter.page.Next()
253	if err != nil {
254		iter.i--
255		return err
256	}
257	iter.i = 0
258	return nil
259}
260
261// NotDone returns true if the enumeration should be started or is not yet complete.
262func (iter PermissionGetResultIterator) NotDone() bool {
263	return iter.page.NotDone() && iter.i < len(iter.page.Values())
264}
265
266// Response returns the raw server response from the last page request.
267func (iter PermissionGetResultIterator) Response() PermissionGetResult {
268	return iter.page.Response()
269}
270
271// Value returns the current value or a zero-initialized value if the
272// iterator has advanced beyond the end of the collection.
273func (iter PermissionGetResultIterator) Value() Permission {
274	if !iter.page.NotDone() {
275		return Permission{}
276	}
277	return iter.page.Values()[iter.i]
278}
279
280// IsEmpty returns true if the ListResult contains no values.
281func (pgr PermissionGetResult) IsEmpty() bool {
282	return pgr.Value == nil || len(*pgr.Value) == 0
283}
284
285// permissionGetResultPreparer prepares a request to retrieve the next set of results.
286// It returns nil if no more results exist.
287func (pgr PermissionGetResult) permissionGetResultPreparer() (*http.Request, error) {
288	if pgr.NextLink == nil || len(to.String(pgr.NextLink)) < 1 {
289		return nil, nil
290	}
291	return autorest.Prepare(&http.Request{},
292		autorest.AsJSON(),
293		autorest.AsGet(),
294		autorest.WithBaseURL(to.String(pgr.NextLink)))
295}
296
297// PermissionGetResultPage contains a page of Permission values.
298type PermissionGetResultPage struct {
299	fn  func(PermissionGetResult) (PermissionGetResult, error)
300	pgr PermissionGetResult
301}
302
303// Next advances to the next page of values.  If there was an error making
304// the request the page does not advance and the error is returned.
305func (page *PermissionGetResultPage) Next() error {
306	next, err := page.fn(page.pgr)
307	if err != nil {
308		return err
309	}
310	page.pgr = next
311	return nil
312}
313
314// NotDone returns true if the page enumeration should be started or is not yet complete.
315func (page PermissionGetResultPage) NotDone() bool {
316	return !page.pgr.IsEmpty()
317}
318
319// Response returns the raw server response from the last page request.
320func (page PermissionGetResultPage) Response() PermissionGetResult {
321	return page.pgr
322}
323
324// Values returns the slice of values for the current page or nil if there are no values.
325func (page PermissionGetResultPage) Values() []Permission {
326	if page.pgr.IsEmpty() {
327		return nil
328	}
329	return *page.pgr.Value
330}
331
332// ProviderOperation operation
333type ProviderOperation struct {
334	// Name - The operation name.
335	Name *string `json:"name,omitempty"`
336	// DisplayName - The operation display name.
337	DisplayName *string `json:"displayName,omitempty"`
338	// Description - The operation description.
339	Description *string `json:"description,omitempty"`
340	// Origin - The operation origin.
341	Origin *string `json:"origin,omitempty"`
342	// Properties - The operation properties.
343	Properties interface{} `json:"properties,omitempty"`
344	// IsDataAction - The dataAction flag to specify the operation type.
345	IsDataAction *bool `json:"isDataAction,omitempty"`
346}
347
348// ProviderOperationsMetadata provider Operations metadata
349type ProviderOperationsMetadata struct {
350	autorest.Response `json:"-"`
351	// ID - The provider id.
352	ID *string `json:"id,omitempty"`
353	// Name - The provider name.
354	Name *string `json:"name,omitempty"`
355	// Type - The provider type.
356	Type *string `json:"type,omitempty"`
357	// DisplayName - The provider display name.
358	DisplayName *string `json:"displayName,omitempty"`
359	// ResourceTypes - The provider resource types
360	ResourceTypes *[]ResourceType `json:"resourceTypes,omitempty"`
361	// Operations - The provider operations.
362	Operations *[]ProviderOperation `json:"operations,omitempty"`
363}
364
365// ProviderOperationsMetadataListResult provider operations metadata list
366type ProviderOperationsMetadataListResult struct {
367	autorest.Response `json:"-"`
368	// Value - The list of providers.
369	Value *[]ProviderOperationsMetadata `json:"value,omitempty"`
370	// NextLink - The URL to use for getting the next set of results.
371	NextLink *string `json:"nextLink,omitempty"`
372}
373
374// ProviderOperationsMetadataListResultIterator provides access to a complete listing of ProviderOperationsMetadata
375// values.
376type ProviderOperationsMetadataListResultIterator struct {
377	i    int
378	page ProviderOperationsMetadataListResultPage
379}
380
381// Next advances to the next value.  If there was an error making
382// the request the iterator does not advance and the error is returned.
383func (iter *ProviderOperationsMetadataListResultIterator) Next() error {
384	iter.i++
385	if iter.i < len(iter.page.Values()) {
386		return nil
387	}
388	err := iter.page.Next()
389	if err != nil {
390		iter.i--
391		return err
392	}
393	iter.i = 0
394	return nil
395}
396
397// NotDone returns true if the enumeration should be started or is not yet complete.
398func (iter ProviderOperationsMetadataListResultIterator) NotDone() bool {
399	return iter.page.NotDone() && iter.i < len(iter.page.Values())
400}
401
402// Response returns the raw server response from the last page request.
403func (iter ProviderOperationsMetadataListResultIterator) Response() ProviderOperationsMetadataListResult {
404	return iter.page.Response()
405}
406
407// Value returns the current value or a zero-initialized value if the
408// iterator has advanced beyond the end of the collection.
409func (iter ProviderOperationsMetadataListResultIterator) Value() ProviderOperationsMetadata {
410	if !iter.page.NotDone() {
411		return ProviderOperationsMetadata{}
412	}
413	return iter.page.Values()[iter.i]
414}
415
416// IsEmpty returns true if the ListResult contains no values.
417func (pomlr ProviderOperationsMetadataListResult) IsEmpty() bool {
418	return pomlr.Value == nil || len(*pomlr.Value) == 0
419}
420
421// providerOperationsMetadataListResultPreparer prepares a request to retrieve the next set of results.
422// It returns nil if no more results exist.
423func (pomlr ProviderOperationsMetadataListResult) providerOperationsMetadataListResultPreparer() (*http.Request, error) {
424	if pomlr.NextLink == nil || len(to.String(pomlr.NextLink)) < 1 {
425		return nil, nil
426	}
427	return autorest.Prepare(&http.Request{},
428		autorest.AsJSON(),
429		autorest.AsGet(),
430		autorest.WithBaseURL(to.String(pomlr.NextLink)))
431}
432
433// ProviderOperationsMetadataListResultPage contains a page of ProviderOperationsMetadata values.
434type ProviderOperationsMetadataListResultPage struct {
435	fn    func(ProviderOperationsMetadataListResult) (ProviderOperationsMetadataListResult, error)
436	pomlr ProviderOperationsMetadataListResult
437}
438
439// Next advances to the next page of values.  If there was an error making
440// the request the page does not advance and the error is returned.
441func (page *ProviderOperationsMetadataListResultPage) Next() error {
442	next, err := page.fn(page.pomlr)
443	if err != nil {
444		return err
445	}
446	page.pomlr = next
447	return nil
448}
449
450// NotDone returns true if the page enumeration should be started or is not yet complete.
451func (page ProviderOperationsMetadataListResultPage) NotDone() bool {
452	return !page.pomlr.IsEmpty()
453}
454
455// Response returns the raw server response from the last page request.
456func (page ProviderOperationsMetadataListResultPage) Response() ProviderOperationsMetadataListResult {
457	return page.pomlr
458}
459
460// Values returns the slice of values for the current page or nil if there are no values.
461func (page ProviderOperationsMetadataListResultPage) Values() []ProviderOperationsMetadata {
462	if page.pomlr.IsEmpty() {
463		return nil
464	}
465	return *page.pomlr.Value
466}
467
468// ResourceType resource Type
469type ResourceType struct {
470	// Name - The resource type name.
471	Name *string `json:"name,omitempty"`
472	// DisplayName - The resource type display name.
473	DisplayName *string `json:"displayName,omitempty"`
474	// Operations - The resource type operations.
475	Operations *[]ProviderOperation `json:"operations,omitempty"`
476}
477
478// RoleAssignment role Assignments
479type RoleAssignment struct {
480	autorest.Response `json:"-"`
481	// ID - The role assignment ID.
482	ID *string `json:"id,omitempty"`
483	// Name - The role assignment name.
484	Name *string `json:"name,omitempty"`
485	// Type - The role assignment type.
486	Type *string `json:"type,omitempty"`
487	// RoleAssignmentPropertiesWithScope - Role assignment properties.
488	*RoleAssignmentPropertiesWithScope `json:"properties,omitempty"`
489}
490
491// MarshalJSON is the custom marshaler for RoleAssignment.
492func (ra RoleAssignment) MarshalJSON() ([]byte, error) {
493	objectMap := make(map[string]interface{})
494	if ra.ID != nil {
495		objectMap["id"] = ra.ID
496	}
497	if ra.Name != nil {
498		objectMap["name"] = ra.Name
499	}
500	if ra.Type != nil {
501		objectMap["type"] = ra.Type
502	}
503	if ra.RoleAssignmentPropertiesWithScope != nil {
504		objectMap["properties"] = ra.RoleAssignmentPropertiesWithScope
505	}
506	return json.Marshal(objectMap)
507}
508
509// UnmarshalJSON is the custom unmarshaler for RoleAssignment struct.
510func (ra *RoleAssignment) UnmarshalJSON(body []byte) error {
511	var m map[string]*json.RawMessage
512	err := json.Unmarshal(body, &m)
513	if err != nil {
514		return err
515	}
516	for k, v := range m {
517		switch k {
518		case "id":
519			if v != nil {
520				var ID string
521				err = json.Unmarshal(*v, &ID)
522				if err != nil {
523					return err
524				}
525				ra.ID = &ID
526			}
527		case "name":
528			if v != nil {
529				var name string
530				err = json.Unmarshal(*v, &name)
531				if err != nil {
532					return err
533				}
534				ra.Name = &name
535			}
536		case "type":
537			if v != nil {
538				var typeVar string
539				err = json.Unmarshal(*v, &typeVar)
540				if err != nil {
541					return err
542				}
543				ra.Type = &typeVar
544			}
545		case "properties":
546			if v != nil {
547				var roleAssignmentPropertiesWithScope RoleAssignmentPropertiesWithScope
548				err = json.Unmarshal(*v, &roleAssignmentPropertiesWithScope)
549				if err != nil {
550					return err
551				}
552				ra.RoleAssignmentPropertiesWithScope = &roleAssignmentPropertiesWithScope
553			}
554		}
555	}
556
557	return nil
558}
559
560// RoleAssignmentCreateParameters role assignment create parameters.
561type RoleAssignmentCreateParameters struct {
562	// RoleAssignmentProperties - Role assignment properties.
563	*RoleAssignmentProperties `json:"properties,omitempty"`
564}
565
566// MarshalJSON is the custom marshaler for RoleAssignmentCreateParameters.
567func (racp RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) {
568	objectMap := make(map[string]interface{})
569	if racp.RoleAssignmentProperties != nil {
570		objectMap["properties"] = racp.RoleAssignmentProperties
571	}
572	return json.Marshal(objectMap)
573}
574
575// UnmarshalJSON is the custom unmarshaler for RoleAssignmentCreateParameters struct.
576func (racp *RoleAssignmentCreateParameters) UnmarshalJSON(body []byte) error {
577	var m map[string]*json.RawMessage
578	err := json.Unmarshal(body, &m)
579	if err != nil {
580		return err
581	}
582	for k, v := range m {
583		switch k {
584		case "properties":
585			if v != nil {
586				var roleAssignmentProperties RoleAssignmentProperties
587				err = json.Unmarshal(*v, &roleAssignmentProperties)
588				if err != nil {
589					return err
590				}
591				racp.RoleAssignmentProperties = &roleAssignmentProperties
592			}
593		}
594	}
595
596	return nil
597}
598
599// RoleAssignmentFilter role Assignments filter
600type RoleAssignmentFilter struct {
601	// PrincipalID - Returns role assignment of the specific principal.
602	PrincipalID *string `json:"principalId,omitempty"`
603	// CanDelegate - The Delegation flag for the roleassignment
604	CanDelegate *bool `json:"canDelegate,omitempty"`
605}
606
607// RoleAssignmentListResult role assignment list operation result.
608type RoleAssignmentListResult struct {
609	autorest.Response `json:"-"`
610	// Value - Role assignment list.
611	Value *[]RoleAssignment `json:"value,omitempty"`
612	// NextLink - The URL to use for getting the next set of results.
613	NextLink *string `json:"nextLink,omitempty"`
614}
615
616// RoleAssignmentListResultIterator provides access to a complete listing of RoleAssignment values.
617type RoleAssignmentListResultIterator struct {
618	i    int
619	page RoleAssignmentListResultPage
620}
621
622// Next advances to the next value.  If there was an error making
623// the request the iterator does not advance and the error is returned.
624func (iter *RoleAssignmentListResultIterator) Next() error {
625	iter.i++
626	if iter.i < len(iter.page.Values()) {
627		return nil
628	}
629	err := iter.page.Next()
630	if err != nil {
631		iter.i--
632		return err
633	}
634	iter.i = 0
635	return nil
636}
637
638// NotDone returns true if the enumeration should be started or is not yet complete.
639func (iter RoleAssignmentListResultIterator) NotDone() bool {
640	return iter.page.NotDone() && iter.i < len(iter.page.Values())
641}
642
643// Response returns the raw server response from the last page request.
644func (iter RoleAssignmentListResultIterator) Response() RoleAssignmentListResult {
645	return iter.page.Response()
646}
647
648// Value returns the current value or a zero-initialized value if the
649// iterator has advanced beyond the end of the collection.
650func (iter RoleAssignmentListResultIterator) Value() RoleAssignment {
651	if !iter.page.NotDone() {
652		return RoleAssignment{}
653	}
654	return iter.page.Values()[iter.i]
655}
656
657// IsEmpty returns true if the ListResult contains no values.
658func (ralr RoleAssignmentListResult) IsEmpty() bool {
659	return ralr.Value == nil || len(*ralr.Value) == 0
660}
661
662// roleAssignmentListResultPreparer prepares a request to retrieve the next set of results.
663// It returns nil if no more results exist.
664func (ralr RoleAssignmentListResult) roleAssignmentListResultPreparer() (*http.Request, error) {
665	if ralr.NextLink == nil || len(to.String(ralr.NextLink)) < 1 {
666		return nil, nil
667	}
668	return autorest.Prepare(&http.Request{},
669		autorest.AsJSON(),
670		autorest.AsGet(),
671		autorest.WithBaseURL(to.String(ralr.NextLink)))
672}
673
674// RoleAssignmentListResultPage contains a page of RoleAssignment values.
675type RoleAssignmentListResultPage struct {
676	fn   func(RoleAssignmentListResult) (RoleAssignmentListResult, error)
677	ralr RoleAssignmentListResult
678}
679
680// Next advances to the next page of values.  If there was an error making
681// the request the page does not advance and the error is returned.
682func (page *RoleAssignmentListResultPage) Next() error {
683	next, err := page.fn(page.ralr)
684	if err != nil {
685		return err
686	}
687	page.ralr = next
688	return nil
689}
690
691// NotDone returns true if the page enumeration should be started or is not yet complete.
692func (page RoleAssignmentListResultPage) NotDone() bool {
693	return !page.ralr.IsEmpty()
694}
695
696// Response returns the raw server response from the last page request.
697func (page RoleAssignmentListResultPage) Response() RoleAssignmentListResult {
698	return page.ralr
699}
700
701// Values returns the slice of values for the current page or nil if there are no values.
702func (page RoleAssignmentListResultPage) Values() []RoleAssignment {
703	if page.ralr.IsEmpty() {
704		return nil
705	}
706	return *page.ralr.Value
707}
708
709// RoleAssignmentProperties role assignment properties.
710type RoleAssignmentProperties struct {
711	// RoleDefinitionID - The role definition ID used in the role assignment.
712	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
713	// PrincipalID - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group.
714	PrincipalID *string `json:"principalId,omitempty"`
715	// CanDelegate - The delgation flag used for creating a role assignment
716	CanDelegate *bool `json:"canDelegate,omitempty"`
717}
718
719// RoleAssignmentPropertiesWithScope role assignment properties with scope.
720type RoleAssignmentPropertiesWithScope struct {
721	// Scope - The role assignment scope.
722	Scope *string `json:"scope,omitempty"`
723	// RoleDefinitionID - The role definition ID.
724	RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
725	// PrincipalID - The principal ID.
726	PrincipalID *string `json:"principalId,omitempty"`
727	// CanDelegate - The Delegation flag for the roleassignment
728	CanDelegate *bool `json:"canDelegate,omitempty"`
729}
730
731// RoleDefinition role definition.
732type RoleDefinition struct {
733	autorest.Response `json:"-"`
734	// ID - The role definition ID.
735	ID *string `json:"id,omitempty"`
736	// Name - The role definition name.
737	Name *string `json:"name,omitempty"`
738	// Type - The role definition type.
739	Type *string `json:"type,omitempty"`
740	// RoleDefinitionProperties - Role definition properties.
741	*RoleDefinitionProperties `json:"properties,omitempty"`
742}
743
744// MarshalJSON is the custom marshaler for RoleDefinition.
745func (rd RoleDefinition) MarshalJSON() ([]byte, error) {
746	objectMap := make(map[string]interface{})
747	if rd.ID != nil {
748		objectMap["id"] = rd.ID
749	}
750	if rd.Name != nil {
751		objectMap["name"] = rd.Name
752	}
753	if rd.Type != nil {
754		objectMap["type"] = rd.Type
755	}
756	if rd.RoleDefinitionProperties != nil {
757		objectMap["properties"] = rd.RoleDefinitionProperties
758	}
759	return json.Marshal(objectMap)
760}
761
762// UnmarshalJSON is the custom unmarshaler for RoleDefinition struct.
763func (rd *RoleDefinition) UnmarshalJSON(body []byte) error {
764	var m map[string]*json.RawMessage
765	err := json.Unmarshal(body, &m)
766	if err != nil {
767		return err
768	}
769	for k, v := range m {
770		switch k {
771		case "id":
772			if v != nil {
773				var ID string
774				err = json.Unmarshal(*v, &ID)
775				if err != nil {
776					return err
777				}
778				rd.ID = &ID
779			}
780		case "name":
781			if v != nil {
782				var name string
783				err = json.Unmarshal(*v, &name)
784				if err != nil {
785					return err
786				}
787				rd.Name = &name
788			}
789		case "type":
790			if v != nil {
791				var typeVar string
792				err = json.Unmarshal(*v, &typeVar)
793				if err != nil {
794					return err
795				}
796				rd.Type = &typeVar
797			}
798		case "properties":
799			if v != nil {
800				var roleDefinitionProperties RoleDefinitionProperties
801				err = json.Unmarshal(*v, &roleDefinitionProperties)
802				if err != nil {
803					return err
804				}
805				rd.RoleDefinitionProperties = &roleDefinitionProperties
806			}
807		}
808	}
809
810	return nil
811}
812
813// RoleDefinitionFilter role Definitions filter
814type RoleDefinitionFilter struct {
815	// RoleName - Returns role definition with the specific name.
816	RoleName *string `json:"roleName,omitempty"`
817	// Type - Returns role definition with the specific type.
818	Type *string `json:"type,omitempty"`
819}
820
821// RoleDefinitionListResult role definition list operation result.
822type RoleDefinitionListResult struct {
823	autorest.Response `json:"-"`
824	// Value - Role definition list.
825	Value *[]RoleDefinition `json:"value,omitempty"`
826	// NextLink - The URL to use for getting the next set of results.
827	NextLink *string `json:"nextLink,omitempty"`
828}
829
830// RoleDefinitionListResultIterator provides access to a complete listing of RoleDefinition values.
831type RoleDefinitionListResultIterator struct {
832	i    int
833	page RoleDefinitionListResultPage
834}
835
836// Next advances to the next value.  If there was an error making
837// the request the iterator does not advance and the error is returned.
838func (iter *RoleDefinitionListResultIterator) Next() error {
839	iter.i++
840	if iter.i < len(iter.page.Values()) {
841		return nil
842	}
843	err := iter.page.Next()
844	if err != nil {
845		iter.i--
846		return err
847	}
848	iter.i = 0
849	return nil
850}
851
852// NotDone returns true if the enumeration should be started or is not yet complete.
853func (iter RoleDefinitionListResultIterator) NotDone() bool {
854	return iter.page.NotDone() && iter.i < len(iter.page.Values())
855}
856
857// Response returns the raw server response from the last page request.
858func (iter RoleDefinitionListResultIterator) Response() RoleDefinitionListResult {
859	return iter.page.Response()
860}
861
862// Value returns the current value or a zero-initialized value if the
863// iterator has advanced beyond the end of the collection.
864func (iter RoleDefinitionListResultIterator) Value() RoleDefinition {
865	if !iter.page.NotDone() {
866		return RoleDefinition{}
867	}
868	return iter.page.Values()[iter.i]
869}
870
871// IsEmpty returns true if the ListResult contains no values.
872func (rdlr RoleDefinitionListResult) IsEmpty() bool {
873	return rdlr.Value == nil || len(*rdlr.Value) == 0
874}
875
876// roleDefinitionListResultPreparer prepares a request to retrieve the next set of results.
877// It returns nil if no more results exist.
878func (rdlr RoleDefinitionListResult) roleDefinitionListResultPreparer() (*http.Request, error) {
879	if rdlr.NextLink == nil || len(to.String(rdlr.NextLink)) < 1 {
880		return nil, nil
881	}
882	return autorest.Prepare(&http.Request{},
883		autorest.AsJSON(),
884		autorest.AsGet(),
885		autorest.WithBaseURL(to.String(rdlr.NextLink)))
886}
887
888// RoleDefinitionListResultPage contains a page of RoleDefinition values.
889type RoleDefinitionListResultPage struct {
890	fn   func(RoleDefinitionListResult) (RoleDefinitionListResult, error)
891	rdlr RoleDefinitionListResult
892}
893
894// Next advances to the next page of values.  If there was an error making
895// the request the page does not advance and the error is returned.
896func (page *RoleDefinitionListResultPage) Next() error {
897	next, err := page.fn(page.rdlr)
898	if err != nil {
899		return err
900	}
901	page.rdlr = next
902	return nil
903}
904
905// NotDone returns true if the page enumeration should be started or is not yet complete.
906func (page RoleDefinitionListResultPage) NotDone() bool {
907	return !page.rdlr.IsEmpty()
908}
909
910// Response returns the raw server response from the last page request.
911func (page RoleDefinitionListResultPage) Response() RoleDefinitionListResult {
912	return page.rdlr
913}
914
915// Values returns the slice of values for the current page or nil if there are no values.
916func (page RoleDefinitionListResultPage) Values() []RoleDefinition {
917	if page.rdlr.IsEmpty() {
918		return nil
919	}
920	return *page.rdlr.Value
921}
922
923// RoleDefinitionProperties role definition properties.
924type RoleDefinitionProperties struct {
925	// RoleName - The role name.
926	RoleName *string `json:"roleName,omitempty"`
927	// Description - The role definition description.
928	Description *string `json:"description,omitempty"`
929	// RoleType - The role type.
930	RoleType *string `json:"type,omitempty"`
931	// Permissions - Role definition permissions.
932	Permissions *[]Permission `json:"permissions,omitempty"`
933	// AssignableScopes - Role definition assignable scopes.
934	AssignableScopes *[]string `json:"assignableScopes,omitempty"`
935}
936