1 package azureadexternalidentities
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/azure"
14 "github.com/Azure/go-autorest/autorest/date"
15 "net/http"
16 )
17
18
19 const fqdn = "github.com/Azure/azure-sdk-for-go/services/azureadexternalidentities/mgmt/2021-04-01/azureadexternalidentities"
20
21
22 type AvailableOperations struct {
23 autorest.Response `json:"-"`
24
25 Value *[]OperationDetail `json:"value,omitempty"`
26
27
28 NextLink *string `json:"nextLink,omitempty"`
29 }
30
31
32
33 type B2CResourceSKU struct {
34
35 Name B2CResourceSKUName `json:"name,omitempty"`
36
37 Tier B2CResourceSKUTier `json:"tier,omitempty"`
38 }
39
40
41 type B2CTenantResource struct {
42 autorest.Response `json:"-"`
43
44 Type TypeValue `json:"type,omitempty"`
45 Sku *B2CResourceSKU `json:"sku,omitempty"`
46
47 *B2CTenantResourceProperties `json:"properties,omitempty"`
48
49 ID *string `json:"id,omitempty"`
50
51 Name *string `json:"name,omitempty"`
52
53 Location *string `json:"location,omitempty"`
54
55 Tags map[string]*string `json:"tags"`
56
57 SystemData *SystemData `json:"systemData,omitempty"`
58 }
59
60
61 func (btr B2CTenantResource) MarshalJSON() ([]byte, error) {
62 objectMap := make(map[string]interface{})
63 if btr.Sku != nil {
64 objectMap["sku"] = btr.Sku
65 }
66 if btr.B2CTenantResourceProperties != nil {
67 objectMap["properties"] = btr.B2CTenantResourceProperties
68 }
69 if btr.Location != nil {
70 objectMap["location"] = btr.Location
71 }
72 if btr.Tags != nil {
73 objectMap["tags"] = btr.Tags
74 }
75 return json.Marshal(objectMap)
76 }
77
78
79 func (btr *B2CTenantResource) UnmarshalJSON(body []byte) error {
80 var m map[string]*json.RawMessage
81 err := json.Unmarshal(body, &m)
82 if err != nil {
83 return err
84 }
85 for k, v := range m {
86 switch k {
87 case "type":
88 if v != nil {
89 var typeVar TypeValue
90 err = json.Unmarshal(*v, &typeVar)
91 if err != nil {
92 return err
93 }
94 btr.Type = typeVar
95 }
96 case "sku":
97 if v != nil {
98 var sku B2CResourceSKU
99 err = json.Unmarshal(*v, &sku)
100 if err != nil {
101 return err
102 }
103 btr.Sku = &sku
104 }
105 case "properties":
106 if v != nil {
107 var b2CTenantResourceProperties B2CTenantResourceProperties
108 err = json.Unmarshal(*v, &b2CTenantResourceProperties)
109 if err != nil {
110 return err
111 }
112 btr.B2CTenantResourceProperties = &b2CTenantResourceProperties
113 }
114 case "id":
115 if v != nil {
116 var ID string
117 err = json.Unmarshal(*v, &ID)
118 if err != nil {
119 return err
120 }
121 btr.ID = &ID
122 }
123 case "name":
124 if v != nil {
125 var name string
126 err = json.Unmarshal(*v, &name)
127 if err != nil {
128 return err
129 }
130 btr.Name = &name
131 }
132 case "location":
133 if v != nil {
134 var location string
135 err = json.Unmarshal(*v, &location)
136 if err != nil {
137 return err
138 }
139 btr.Location = &location
140 }
141 case "tags":
142 if v != nil {
143 var tags map[string]*string
144 err = json.Unmarshal(*v, &tags)
145 if err != nil {
146 return err
147 }
148 btr.Tags = tags
149 }
150 case "systemData":
151 if v != nil {
152 var systemData SystemData
153 err = json.Unmarshal(*v, &systemData)
154 if err != nil {
155 return err
156 }
157 btr.SystemData = &systemData
158 }
159 }
160 }
161
162 return nil
163 }
164
165
166 type B2CTenantResourceList struct {
167 autorest.Response `json:"-"`
168
169 Value *[]B2CTenantResource `json:"value,omitempty"`
170 }
171
172
173 func (btrl B2CTenantResourceList) MarshalJSON() ([]byte, error) {
174 objectMap := make(map[string]interface{})
175 return json.Marshal(objectMap)
176 }
177
178
179 type B2CTenantResourceProperties struct {
180
181 BillingConfig *B2CTenantResourcePropertiesBillingConfig `json:"billingConfig,omitempty"`
182
183 TenantID *string `json:"tenantId,omitempty"`
184 }
185
186
187 type B2CTenantResourcePropertiesBillingConfig struct {
188
189 BillingType BillingType `json:"billingType,omitempty"`
190
191 EffectiveStartDateUtc *string `json:"effectiveStartDateUtc,omitempty"`
192 }
193
194
195 func (btrpC B2CTenantResourcePropertiesBillingConfig) MarshalJSON() ([]byte, error) {
196 objectMap := make(map[string]interface{})
197 if btrpC.BillingType != "" {
198 objectMap["billingType"] = btrpC.BillingType
199 }
200 return json.Marshal(objectMap)
201 }
202
203
204
205 type B2CTenantsCreateFuture struct {
206 azure.FutureAPI
207
208
209 Result func(B2CTenantsClient) (B2CTenantResource, error)
210 }
211
212
213 func (future *B2CTenantsCreateFuture) UnmarshalJSON(body []byte) error {
214 var azFuture azure.Future
215 if err := json.Unmarshal(body, &azFuture); err != nil {
216 return err
217 }
218 future.FutureAPI = &azFuture
219 future.Result = future.result
220 return nil
221 }
222
223
224 func (future *B2CTenantsCreateFuture) result(client B2CTenantsClient) (btr B2CTenantResource, err error) {
225 var done bool
226 done, err = future.DoneWithContext(context.Background(), client)
227 if err != nil {
228 err = autorest.NewErrorWithError(err, "azureadexternalidentities.B2CTenantsCreateFuture", "Result", future.Response(), "Polling failure")
229 return
230 }
231 if !done {
232 btr.Response.Response = future.Response()
233 err = azure.NewAsyncOpIncompleteError("azureadexternalidentities.B2CTenantsCreateFuture")
234 return
235 }
236 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
237 if btr.Response.Response, err = future.GetResult(sender); err == nil && btr.Response.Response.StatusCode != http.StatusNoContent {
238 btr, err = client.CreateResponder(btr.Response.Response)
239 if err != nil {
240 err = autorest.NewErrorWithError(err, "azureadexternalidentities.B2CTenantsCreateFuture", "Result", btr.Response.Response, "Failure responding to request")
241 }
242 }
243 return
244 }
245
246
247
248 type B2CTenantsDeleteFuture struct {
249 azure.FutureAPI
250
251
252 Result func(B2CTenantsClient) (autorest.Response, error)
253 }
254
255
256 func (future *B2CTenantsDeleteFuture) UnmarshalJSON(body []byte) error {
257 var azFuture azure.Future
258 if err := json.Unmarshal(body, &azFuture); err != nil {
259 return err
260 }
261 future.FutureAPI = &azFuture
262 future.Result = future.result
263 return nil
264 }
265
266
267 func (future *B2CTenantsDeleteFuture) result(client B2CTenantsClient) (ar autorest.Response, err error) {
268 var done bool
269 done, err = future.DoneWithContext(context.Background(), client)
270 if err != nil {
271 err = autorest.NewErrorWithError(err, "azureadexternalidentities.B2CTenantsDeleteFuture", "Result", future.Response(), "Polling failure")
272 return
273 }
274 if !done {
275 ar.Response = future.Response()
276 err = azure.NewAsyncOpIncompleteError("azureadexternalidentities.B2CTenantsDeleteFuture")
277 return
278 }
279 ar.Response = future.Response()
280 return
281 }
282
283
284 type B2CTenantUpdateRequest struct {
285 Sku *B2CResourceSKU `json:"sku,omitempty"`
286
287 *B2CTenantResourceProperties `json:"properties,omitempty"`
288
289 Tags map[string]*string `json:"tags"`
290 }
291
292
293 func (btur B2CTenantUpdateRequest) MarshalJSON() ([]byte, error) {
294 objectMap := make(map[string]interface{})
295 if btur.Sku != nil {
296 objectMap["sku"] = btur.Sku
297 }
298 if btur.B2CTenantResourceProperties != nil {
299 objectMap["properties"] = btur.B2CTenantResourceProperties
300 }
301 if btur.Tags != nil {
302 objectMap["tags"] = btur.Tags
303 }
304 return json.Marshal(objectMap)
305 }
306
307
308 func (btur *B2CTenantUpdateRequest) UnmarshalJSON(body []byte) error {
309 var m map[string]*json.RawMessage
310 err := json.Unmarshal(body, &m)
311 if err != nil {
312 return err
313 }
314 for k, v := range m {
315 switch k {
316 case "sku":
317 if v != nil {
318 var sku B2CResourceSKU
319 err = json.Unmarshal(*v, &sku)
320 if err != nil {
321 return err
322 }
323 btur.Sku = &sku
324 }
325 case "properties":
326 if v != nil {
327 var b2CTenantResourceProperties B2CTenantResourceProperties
328 err = json.Unmarshal(*v, &b2CTenantResourceProperties)
329 if err != nil {
330 return err
331 }
332 btur.B2CTenantResourceProperties = &b2CTenantResourceProperties
333 }
334 case "tags":
335 if v != nil {
336 var tags map[string]*string
337 err = json.Unmarshal(*v, &tags)
338 if err != nil {
339 return err
340 }
341 btur.Tags = tags
342 }
343 }
344 }
345
346 return nil
347 }
348
349
350
351 type CheckNameAvailabilityRequestBody struct {
352
353 Name *string `json:"name,omitempty"`
354 CountryCode *string `json:"countryCode,omitempty"`
355 }
356
357
358 type CloudError struct {
359 Error *ErrorResponse `json:"error,omitempty"`
360 }
361
362
363
364 type CreateTenantProperties struct {
365
366 DisplayName *string `json:"displayName,omitempty"`
367 CountryCode *string `json:"countryCode,omitempty"`
368 }
369
370
371
372 type CreateTenantRequestBody struct {
373
374 Location *string `json:"location,omitempty"`
375 *CreateTenantRequestBodyProperties `json:"properties,omitempty"`
376 Sku *B2CResourceSKU `json:"sku,omitempty"`
377
378 Tags map[string]*string `json:"tags"`
379 }
380
381
382 func (ctrb CreateTenantRequestBody) MarshalJSON() ([]byte, error) {
383 objectMap := make(map[string]interface{})
384 if ctrb.Location != nil {
385 objectMap["location"] = ctrb.Location
386 }
387 if ctrb.CreateTenantRequestBodyProperties != nil {
388 objectMap["properties"] = ctrb.CreateTenantRequestBodyProperties
389 }
390 if ctrb.Sku != nil {
391 objectMap["sku"] = ctrb.Sku
392 }
393 if ctrb.Tags != nil {
394 objectMap["tags"] = ctrb.Tags
395 }
396 return json.Marshal(objectMap)
397 }
398
399
400 func (ctrb *CreateTenantRequestBody) UnmarshalJSON(body []byte) error {
401 var m map[string]*json.RawMessage
402 err := json.Unmarshal(body, &m)
403 if err != nil {
404 return err
405 }
406 for k, v := range m {
407 switch k {
408 case "location":
409 if v != nil {
410 var location string
411 err = json.Unmarshal(*v, &location)
412 if err != nil {
413 return err
414 }
415 ctrb.Location = &location
416 }
417 case "properties":
418 if v != nil {
419 var createTenantRequestBodyProperties CreateTenantRequestBodyProperties
420 err = json.Unmarshal(*v, &createTenantRequestBodyProperties)
421 if err != nil {
422 return err
423 }
424 ctrb.CreateTenantRequestBodyProperties = &createTenantRequestBodyProperties
425 }
426 case "sku":
427 if v != nil {
428 var sku B2CResourceSKU
429 err = json.Unmarshal(*v, &sku)
430 if err != nil {
431 return err
432 }
433 ctrb.Sku = &sku
434 }
435 case "tags":
436 if v != nil {
437 var tags map[string]*string
438 err = json.Unmarshal(*v, &tags)
439 if err != nil {
440 return err
441 }
442 ctrb.Tags = tags
443 }
444 }
445 }
446
447 return nil
448 }
449
450
451 type CreateTenantRequestBodyProperties struct {
452 *CreateTenantProperties `json:"createTenantProperties,omitempty"`
453 }
454
455
456 func (ctrb CreateTenantRequestBodyProperties) MarshalJSON() ([]byte, error) {
457 objectMap := make(map[string]interface{})
458 if ctrb.CreateTenantProperties != nil {
459 objectMap["createTenantProperties"] = ctrb.CreateTenantProperties
460 }
461 return json.Marshal(objectMap)
462 }
463
464
465 func (ctrb *CreateTenantRequestBodyProperties) UnmarshalJSON(body []byte) error {
466 var m map[string]*json.RawMessage
467 err := json.Unmarshal(body, &m)
468 if err != nil {
469 return err
470 }
471 for k, v := range m {
472 switch k {
473 case "createTenantProperties":
474 if v != nil {
475 var createTenantProperties CreateTenantProperties
476 err = json.Unmarshal(*v, &createTenantProperties)
477 if err != nil {
478 return err
479 }
480 ctrb.CreateTenantProperties = &createTenantProperties
481 }
482 }
483 }
484
485 return nil
486 }
487
488
489 type ErrorAdditionalInfo struct {
490
491 Type *string `json:"type,omitempty"`
492
493 Info interface{} `json:"info,omitempty"`
494 }
495
496
497 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
498 objectMap := make(map[string]interface{})
499 return json.Marshal(objectMap)
500 }
501
502
503
504 type ErrorResponse struct {
505
506 Code *string `json:"code,omitempty"`
507
508 Message *string `json:"message,omitempty"`
509
510 Target *string `json:"target,omitempty"`
511
512 Details *[]ErrorResponse `json:"details,omitempty"`
513
514 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
515 }
516
517
518 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
519 objectMap := make(map[string]interface{})
520 return json.Marshal(objectMap)
521 }
522
523
524 type GuestUsagesResource struct {
525 autorest.Response `json:"-"`
526
527 ID *string `json:"id,omitempty"`
528
529 Name *string `json:"name,omitempty"`
530
531 Type *string `json:"type,omitempty"`
532
533 Location *string `json:"location,omitempty"`
534
535 Tags map[string]*string `json:"tags"`
536
537 *GuestUsagesResourceProperties `json:"properties,omitempty"`
538
539 SystemData *SystemData `json:"systemData,omitempty"`
540 }
541
542
543 func (gur GuestUsagesResource) MarshalJSON() ([]byte, error) {
544 objectMap := make(map[string]interface{})
545 if gur.Location != nil {
546 objectMap["location"] = gur.Location
547 }
548 if gur.Tags != nil {
549 objectMap["tags"] = gur.Tags
550 }
551 if gur.GuestUsagesResourceProperties != nil {
552 objectMap["properties"] = gur.GuestUsagesResourceProperties
553 }
554 return json.Marshal(objectMap)
555 }
556
557
558 func (gur *GuestUsagesResource) UnmarshalJSON(body []byte) error {
559 var m map[string]*json.RawMessage
560 err := json.Unmarshal(body, &m)
561 if err != nil {
562 return err
563 }
564 for k, v := range m {
565 switch k {
566 case "id":
567 if v != nil {
568 var ID string
569 err = json.Unmarshal(*v, &ID)
570 if err != nil {
571 return err
572 }
573 gur.ID = &ID
574 }
575 case "name":
576 if v != nil {
577 var name string
578 err = json.Unmarshal(*v, &name)
579 if err != nil {
580 return err
581 }
582 gur.Name = &name
583 }
584 case "type":
585 if v != nil {
586 var typeVar string
587 err = json.Unmarshal(*v, &typeVar)
588 if err != nil {
589 return err
590 }
591 gur.Type = &typeVar
592 }
593 case "location":
594 if v != nil {
595 var location string
596 err = json.Unmarshal(*v, &location)
597 if err != nil {
598 return err
599 }
600 gur.Location = &location
601 }
602 case "tags":
603 if v != nil {
604 var tags map[string]*string
605 err = json.Unmarshal(*v, &tags)
606 if err != nil {
607 return err
608 }
609 gur.Tags = tags
610 }
611 case "properties":
612 if v != nil {
613 var guestUsagesResourceProperties GuestUsagesResourceProperties
614 err = json.Unmarshal(*v, &guestUsagesResourceProperties)
615 if err != nil {
616 return err
617 }
618 gur.GuestUsagesResourceProperties = &guestUsagesResourceProperties
619 }
620 case "systemData":
621 if v != nil {
622 var systemData SystemData
623 err = json.Unmarshal(*v, &systemData)
624 if err != nil {
625 return err
626 }
627 gur.SystemData = &systemData
628 }
629 }
630 }
631
632 return nil
633 }
634
635
636 type GuestUsagesResourceList struct {
637 autorest.Response `json:"-"`
638
639 Value *[]GuestUsagesResource `json:"value,omitempty"`
640 }
641
642
643 func (gurl GuestUsagesResourceList) MarshalJSON() ([]byte, error) {
644 objectMap := make(map[string]interface{})
645 return json.Marshal(objectMap)
646 }
647
648
649 type GuestUsagesResourcePatch struct {
650
651 Tags map[string]*string `json:"tags"`
652 }
653
654
655 func (gurp GuestUsagesResourcePatch) MarshalJSON() ([]byte, error) {
656 objectMap := make(map[string]interface{})
657 if gurp.Tags != nil {
658 objectMap["tags"] = gurp.Tags
659 }
660 return json.Marshal(objectMap)
661 }
662
663
664 type GuestUsagesResourceProperties struct {
665
666 TenantID *string `json:"tenantId,omitempty"`
667 }
668
669
670 type NameAvailabilityResponse struct {
671 autorest.Response `json:"-"`
672
673 Message *string `json:"message,omitempty"`
674
675 NameAvailable *bool `json:"nameAvailable,omitempty"`
676
677 Reason NameAvailabilityReasonType `json:"reason,omitempty"`
678 }
679
680
681 type OperationDetail struct {
682
683 Name *string `json:"name,omitempty"`
684
685 IsDataAction *bool `json:"isDataAction,omitempty"`
686
687 Display *OperationDisplay `json:"display,omitempty"`
688
689 Origin *string `json:"origin,omitempty"`
690 }
691
692
693 type OperationDisplay struct {
694
695 Provider *string `json:"provider,omitempty"`
696
697 Resource *string `json:"resource,omitempty"`
698
699 Operation *string `json:"operation,omitempty"`
700
701 Description *string `json:"description,omitempty"`
702 }
703
704
705 type SystemData struct {
706
707 CreatedBy *string `json:"createdBy,omitempty"`
708
709 CreatedByType CreatedByType `json:"createdByType,omitempty"`
710
711 CreatedAt *date.Time `json:"createdAt,omitempty"`
712
713 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
714
715 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
716
717 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
718 }
719
View as plain text