1 package features
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/date"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-07-01/features"
21
22
23 type AuthorizationProfile struct {
24
25 RequestedTime *date.Time `json:"requestedTime,omitempty"`
26
27 Requester *string `json:"requester,omitempty"`
28
29 RequesterObjectID *string `json:"requesterObjectId,omitempty"`
30
31 ApprovedTime *date.Time `json:"approvedTime,omitempty"`
32
33 Approver *string `json:"approver,omitempty"`
34 }
35
36
37 func (ap AuthorizationProfile) MarshalJSON() ([]byte, error) {
38 objectMap := make(map[string]interface{})
39 return json.Marshal(objectMap)
40 }
41
42
43 type ErrorDefinition struct {
44
45 Code *string `json:"code,omitempty"`
46
47 Message *string `json:"message,omitempty"`
48
49 Details *[]ErrorDefinition `json:"details,omitempty"`
50 }
51
52
53 func (ed ErrorDefinition) MarshalJSON() ([]byte, error) {
54 objectMap := make(map[string]interface{})
55 if ed.Details != nil {
56 objectMap["details"] = ed.Details
57 }
58 return json.Marshal(objectMap)
59 }
60
61
62 type ErrorResponse struct {
63
64 Error *ErrorDefinition `json:"error,omitempty"`
65 }
66
67
68 type Operation struct {
69
70 Name *string `json:"name,omitempty"`
71
72 Display *OperationDisplay `json:"display,omitempty"`
73 }
74
75
76 type OperationDisplay struct {
77
78 Provider *string `json:"provider,omitempty"`
79
80 Resource *string `json:"resource,omitempty"`
81
82 Operation *string `json:"operation,omitempty"`
83 }
84
85
86
87 type OperationListResult struct {
88 autorest.Response `json:"-"`
89
90 Value *[]Operation `json:"value,omitempty"`
91
92 NextLink *string `json:"nextLink,omitempty"`
93 }
94
95
96 type OperationListResultIterator struct {
97 i int
98 page OperationListResultPage
99 }
100
101
102
103 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
104 if tracing.IsEnabled() {
105 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
106 defer func() {
107 sc := -1
108 if iter.Response().Response.Response != nil {
109 sc = iter.Response().Response.Response.StatusCode
110 }
111 tracing.EndSpan(ctx, sc, err)
112 }()
113 }
114 iter.i++
115 if iter.i < len(iter.page.Values()) {
116 return nil
117 }
118 err = iter.page.NextWithContext(ctx)
119 if err != nil {
120 iter.i--
121 return err
122 }
123 iter.i = 0
124 return nil
125 }
126
127
128
129
130 func (iter *OperationListResultIterator) Next() error {
131 return iter.NextWithContext(context.Background())
132 }
133
134
135 func (iter OperationListResultIterator) NotDone() bool {
136 return iter.page.NotDone() && iter.i < len(iter.page.Values())
137 }
138
139
140 func (iter OperationListResultIterator) Response() OperationListResult {
141 return iter.page.Response()
142 }
143
144
145
146 func (iter OperationListResultIterator) Value() Operation {
147 if !iter.page.NotDone() {
148 return Operation{}
149 }
150 return iter.page.Values()[iter.i]
151 }
152
153
154 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
155 return OperationListResultIterator{page: page}
156 }
157
158
159 func (olr OperationListResult) IsEmpty() bool {
160 return olr.Value == nil || len(*olr.Value) == 0
161 }
162
163
164 func (olr OperationListResult) hasNextLink() bool {
165 return olr.NextLink != nil && len(*olr.NextLink) != 0
166 }
167
168
169
170 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
171 if !olr.hasNextLink() {
172 return nil, nil
173 }
174 return autorest.Prepare((&http.Request{}).WithContext(ctx),
175 autorest.AsJSON(),
176 autorest.AsGet(),
177 autorest.WithBaseURL(to.String(olr.NextLink)))
178 }
179
180
181 type OperationListResultPage struct {
182 fn func(context.Context, OperationListResult) (OperationListResult, error)
183 olr OperationListResult
184 }
185
186
187
188 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
189 if tracing.IsEnabled() {
190 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
191 defer func() {
192 sc := -1
193 if page.Response().Response.Response != nil {
194 sc = page.Response().Response.Response.StatusCode
195 }
196 tracing.EndSpan(ctx, sc, err)
197 }()
198 }
199 for {
200 next, err := page.fn(ctx, page.olr)
201 if err != nil {
202 return err
203 }
204 page.olr = next
205 if !next.hasNextLink() || !next.IsEmpty() {
206 break
207 }
208 }
209 return nil
210 }
211
212
213
214
215 func (page *OperationListResultPage) Next() error {
216 return page.NextWithContext(context.Background())
217 }
218
219
220 func (page OperationListResultPage) NotDone() bool {
221 return !page.olr.IsEmpty()
222 }
223
224
225 func (page OperationListResultPage) Response() OperationListResult {
226 return page.olr
227 }
228
229
230 func (page OperationListResultPage) Values() []Operation {
231 if page.olr.IsEmpty() {
232 return nil
233 }
234 return *page.olr.Value
235 }
236
237
238 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
239 return OperationListResultPage{
240 fn: getNextPage,
241 olr: cur,
242 }
243 }
244
245
246 type OperationsListResult struct {
247 autorest.Response `json:"-"`
248
249 Value *[]Result `json:"value,omitempty"`
250
251 NextLink *string `json:"nextLink,omitempty"`
252 }
253
254
255 type OperationsListResultIterator struct {
256 i int
257 page OperationsListResultPage
258 }
259
260
261
262 func (iter *OperationsListResultIterator) NextWithContext(ctx context.Context) (err error) {
263 if tracing.IsEnabled() {
264 ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultIterator.NextWithContext")
265 defer func() {
266 sc := -1
267 if iter.Response().Response.Response != nil {
268 sc = iter.Response().Response.Response.StatusCode
269 }
270 tracing.EndSpan(ctx, sc, err)
271 }()
272 }
273 iter.i++
274 if iter.i < len(iter.page.Values()) {
275 return nil
276 }
277 err = iter.page.NextWithContext(ctx)
278 if err != nil {
279 iter.i--
280 return err
281 }
282 iter.i = 0
283 return nil
284 }
285
286
287
288
289 func (iter *OperationsListResultIterator) Next() error {
290 return iter.NextWithContext(context.Background())
291 }
292
293
294 func (iter OperationsListResultIterator) NotDone() bool {
295 return iter.page.NotDone() && iter.i < len(iter.page.Values())
296 }
297
298
299 func (iter OperationsListResultIterator) Response() OperationsListResult {
300 return iter.page.Response()
301 }
302
303
304
305 func (iter OperationsListResultIterator) Value() Result {
306 if !iter.page.NotDone() {
307 return Result{}
308 }
309 return iter.page.Values()[iter.i]
310 }
311
312
313 func NewOperationsListResultIterator(page OperationsListResultPage) OperationsListResultIterator {
314 return OperationsListResultIterator{page: page}
315 }
316
317
318 func (olr OperationsListResult) IsEmpty() bool {
319 return olr.Value == nil || len(*olr.Value) == 0
320 }
321
322
323 func (olr OperationsListResult) hasNextLink() bool {
324 return olr.NextLink != nil && len(*olr.NextLink) != 0
325 }
326
327
328
329 func (olr OperationsListResult) operationsListResultPreparer(ctx context.Context) (*http.Request, error) {
330 if !olr.hasNextLink() {
331 return nil, nil
332 }
333 return autorest.Prepare((&http.Request{}).WithContext(ctx),
334 autorest.AsJSON(),
335 autorest.AsGet(),
336 autorest.WithBaseURL(to.String(olr.NextLink)))
337 }
338
339
340 type OperationsListResultPage struct {
341 fn func(context.Context, OperationsListResult) (OperationsListResult, error)
342 olr OperationsListResult
343 }
344
345
346
347 func (page *OperationsListResultPage) NextWithContext(ctx context.Context) (err error) {
348 if tracing.IsEnabled() {
349 ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultPage.NextWithContext")
350 defer func() {
351 sc := -1
352 if page.Response().Response.Response != nil {
353 sc = page.Response().Response.Response.StatusCode
354 }
355 tracing.EndSpan(ctx, sc, err)
356 }()
357 }
358 for {
359 next, err := page.fn(ctx, page.olr)
360 if err != nil {
361 return err
362 }
363 page.olr = next
364 if !next.hasNextLink() || !next.IsEmpty() {
365 break
366 }
367 }
368 return nil
369 }
370
371
372
373
374 func (page *OperationsListResultPage) Next() error {
375 return page.NextWithContext(context.Background())
376 }
377
378
379 func (page OperationsListResultPage) NotDone() bool {
380 return !page.olr.IsEmpty()
381 }
382
383
384 func (page OperationsListResultPage) Response() OperationsListResult {
385 return page.olr
386 }
387
388
389 func (page OperationsListResultPage) Values() []Result {
390 if page.olr.IsEmpty() {
391 return nil
392 }
393 return *page.olr.Value
394 }
395
396
397 func NewOperationsListResultPage(cur OperationsListResult, getNextPage func(context.Context, OperationsListResult) (OperationsListResult, error)) OperationsListResultPage {
398 return OperationsListResultPage{
399 fn: getNextPage,
400 olr: cur,
401 }
402 }
403
404
405 type Properties struct {
406
407 State *string `json:"state,omitempty"`
408 }
409
410
411 type ProxyResource struct {
412
413 ID *string `json:"id,omitempty"`
414
415 Name *string `json:"name,omitempty"`
416
417 Type *string `json:"type,omitempty"`
418 }
419
420
421 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
422 objectMap := make(map[string]interface{})
423 return json.Marshal(objectMap)
424 }
425
426
427 type Result struct {
428 autorest.Response `json:"-"`
429
430 Name *string `json:"name,omitempty"`
431
432 Properties *Properties `json:"properties,omitempty"`
433
434 ID *string `json:"id,omitempty"`
435
436 Type *string `json:"type,omitempty"`
437 }
438
439
440 type SubscriptionFeatureRegistration struct {
441 autorest.Response `json:"-"`
442 Properties *SubscriptionFeatureRegistrationProperties `json:"properties,omitempty"`
443
444 ID *string `json:"id,omitempty"`
445
446 Name *string `json:"name,omitempty"`
447
448 Type *string `json:"type,omitempty"`
449 }
450
451
452 func (sfr SubscriptionFeatureRegistration) MarshalJSON() ([]byte, error) {
453 objectMap := make(map[string]interface{})
454 if sfr.Properties != nil {
455 objectMap["properties"] = sfr.Properties
456 }
457 return json.Marshal(objectMap)
458 }
459
460
461 type SubscriptionFeatureRegistrationList struct {
462 autorest.Response `json:"-"`
463
464 NextLink *string `json:"nextLink,omitempty"`
465
466 Value *[]SubscriptionFeatureRegistration `json:"value,omitempty"`
467 }
468
469
470
471 type SubscriptionFeatureRegistrationListIterator struct {
472 i int
473 page SubscriptionFeatureRegistrationListPage
474 }
475
476
477
478 func (iter *SubscriptionFeatureRegistrationListIterator) NextWithContext(ctx context.Context) (err error) {
479 if tracing.IsEnabled() {
480 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionFeatureRegistrationListIterator.NextWithContext")
481 defer func() {
482 sc := -1
483 if iter.Response().Response.Response != nil {
484 sc = iter.Response().Response.Response.StatusCode
485 }
486 tracing.EndSpan(ctx, sc, err)
487 }()
488 }
489 iter.i++
490 if iter.i < len(iter.page.Values()) {
491 return nil
492 }
493 err = iter.page.NextWithContext(ctx)
494 if err != nil {
495 iter.i--
496 return err
497 }
498 iter.i = 0
499 return nil
500 }
501
502
503
504
505 func (iter *SubscriptionFeatureRegistrationListIterator) Next() error {
506 return iter.NextWithContext(context.Background())
507 }
508
509
510 func (iter SubscriptionFeatureRegistrationListIterator) NotDone() bool {
511 return iter.page.NotDone() && iter.i < len(iter.page.Values())
512 }
513
514
515 func (iter SubscriptionFeatureRegistrationListIterator) Response() SubscriptionFeatureRegistrationList {
516 return iter.page.Response()
517 }
518
519
520
521 func (iter SubscriptionFeatureRegistrationListIterator) Value() SubscriptionFeatureRegistration {
522 if !iter.page.NotDone() {
523 return SubscriptionFeatureRegistration{}
524 }
525 return iter.page.Values()[iter.i]
526 }
527
528
529 func NewSubscriptionFeatureRegistrationListIterator(page SubscriptionFeatureRegistrationListPage) SubscriptionFeatureRegistrationListIterator {
530 return SubscriptionFeatureRegistrationListIterator{page: page}
531 }
532
533
534 func (sfrl SubscriptionFeatureRegistrationList) IsEmpty() bool {
535 return sfrl.Value == nil || len(*sfrl.Value) == 0
536 }
537
538
539 func (sfrl SubscriptionFeatureRegistrationList) hasNextLink() bool {
540 return sfrl.NextLink != nil && len(*sfrl.NextLink) != 0
541 }
542
543
544
545 func (sfrl SubscriptionFeatureRegistrationList) subscriptionFeatureRegistrationListPreparer(ctx context.Context) (*http.Request, error) {
546 if !sfrl.hasNextLink() {
547 return nil, nil
548 }
549 return autorest.Prepare((&http.Request{}).WithContext(ctx),
550 autorest.AsJSON(),
551 autorest.AsGet(),
552 autorest.WithBaseURL(to.String(sfrl.NextLink)))
553 }
554
555
556 type SubscriptionFeatureRegistrationListPage struct {
557 fn func(context.Context, SubscriptionFeatureRegistrationList) (SubscriptionFeatureRegistrationList, error)
558 sfrl SubscriptionFeatureRegistrationList
559 }
560
561
562
563 func (page *SubscriptionFeatureRegistrationListPage) NextWithContext(ctx context.Context) (err error) {
564 if tracing.IsEnabled() {
565 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionFeatureRegistrationListPage.NextWithContext")
566 defer func() {
567 sc := -1
568 if page.Response().Response.Response != nil {
569 sc = page.Response().Response.Response.StatusCode
570 }
571 tracing.EndSpan(ctx, sc, err)
572 }()
573 }
574 for {
575 next, err := page.fn(ctx, page.sfrl)
576 if err != nil {
577 return err
578 }
579 page.sfrl = next
580 if !next.hasNextLink() || !next.IsEmpty() {
581 break
582 }
583 }
584 return nil
585 }
586
587
588
589
590 func (page *SubscriptionFeatureRegistrationListPage) Next() error {
591 return page.NextWithContext(context.Background())
592 }
593
594
595 func (page SubscriptionFeatureRegistrationListPage) NotDone() bool {
596 return !page.sfrl.IsEmpty()
597 }
598
599
600 func (page SubscriptionFeatureRegistrationListPage) Response() SubscriptionFeatureRegistrationList {
601 return page.sfrl
602 }
603
604
605 func (page SubscriptionFeatureRegistrationListPage) Values() []SubscriptionFeatureRegistration {
606 if page.sfrl.IsEmpty() {
607 return nil
608 }
609 return *page.sfrl.Value
610 }
611
612
613 func NewSubscriptionFeatureRegistrationListPage(cur SubscriptionFeatureRegistrationList, getNextPage func(context.Context, SubscriptionFeatureRegistrationList) (SubscriptionFeatureRegistrationList, error)) SubscriptionFeatureRegistrationListPage {
614 return SubscriptionFeatureRegistrationListPage{
615 fn: getNextPage,
616 sfrl: cur,
617 }
618 }
619
620
621 type SubscriptionFeatureRegistrationProperties struct {
622
623 TenantID *string `json:"tenantId,omitempty"`
624
625 SubscriptionID *string `json:"subscriptionId,omitempty"`
626
627 FeatureName *string `json:"featureName,omitempty"`
628
629 DisplayName *string `json:"displayName,omitempty"`
630
631 ProviderNamespace *string `json:"providerNamespace,omitempty"`
632
633 State SubscriptionFeatureRegistrationState `json:"state,omitempty"`
634 AuthorizationProfile *AuthorizationProfile `json:"authorizationProfile,omitempty"`
635
636 Metadata map[string]*string `json:"metadata"`
637
638 ReleaseDate *date.Time `json:"releaseDate,omitempty"`
639
640 RegistrationDate *date.Time `json:"registrationDate,omitempty"`
641
642 DocumentationLink *string `json:"documentationLink,omitempty"`
643
644 ApprovalType SubscriptionFeatureRegistrationApprovalType `json:"approvalType,omitempty"`
645
646 ShouldFeatureDisplayInPortal *bool `json:"shouldFeatureDisplayInPortal,omitempty"`
647
648 Description *string `json:"description,omitempty"`
649 }
650
651
652 func (sfr SubscriptionFeatureRegistrationProperties) MarshalJSON() ([]byte, error) {
653 objectMap := make(map[string]interface{})
654 if sfr.State != "" {
655 objectMap["state"] = sfr.State
656 }
657 if sfr.AuthorizationProfile != nil {
658 objectMap["authorizationProfile"] = sfr.AuthorizationProfile
659 }
660 if sfr.Metadata != nil {
661 objectMap["metadata"] = sfr.Metadata
662 }
663 if sfr.ShouldFeatureDisplayInPortal != nil {
664 objectMap["shouldFeatureDisplayInPortal"] = sfr.ShouldFeatureDisplayInPortal
665 }
666 if sfr.Description != nil {
667 objectMap["description"] = sfr.Description
668 }
669 return json.Marshal(objectMap)
670 }
671
View as plain text