File: _models.py

package info (click to toggle)
python-azure 20201208%2Bgit-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,437,920 kB
  • sloc: python: 4,287,452; javascript: 269; makefile: 198; sh: 187; xml: 106
file content (1172 lines) | stat: -rw-r--r-- 43,777 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class ApiError(Model):
    """Api error.

    :param details: The Api error details
    :type details: list[~azure.mgmt.imagebuilder.models.ApiErrorBase]
    :param inner_error: The Api inner error
    :type inner_error: ~azure.mgmt.imagebuilder.models.InnerError
    :param code: The error code.
    :type code: str
    :param target: The target of the particular error.
    :type target: str
    :param message: The error message.
    :type message: str
    """

    _attribute_map = {
        'details': {'key': 'details', 'type': '[ApiErrorBase]'},
        'inner_error': {'key': 'innerError', 'type': 'InnerError'},
        'code': {'key': 'code', 'type': 'str'},
        'target': {'key': 'target', 'type': 'str'},
        'message': {'key': 'message', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ApiError, self).__init__(**kwargs)
        self.details = kwargs.get('details', None)
        self.inner_error = kwargs.get('inner_error', None)
        self.code = kwargs.get('code', None)
        self.target = kwargs.get('target', None)
        self.message = kwargs.get('message', None)


class ApiErrorException(HttpOperationError):
    """Server responsed with exception of type: 'ApiError'.

    :param deserialize: A deserializer
    :param response: Server response to be deserialized.
    """

    def __init__(self, deserialize, response, *args):

        super(ApiErrorException, self).__init__(deserialize, response, 'ApiError', *args)


class ApiErrorBase(Model):
    """Api error base.

    :param code: The error code.
    :type code: str
    :param target: The target of the particular error.
    :type target: str
    :param message: The error message.
    :type message: str
    """

    _attribute_map = {
        'code': {'key': 'code', 'type': 'str'},
        'target': {'key': 'target', 'type': 'str'},
        'message': {'key': 'message', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ApiErrorBase, self).__init__(**kwargs)
        self.code = kwargs.get('code', None)
        self.target = kwargs.get('target', None)
        self.message = kwargs.get('message', None)


class CloudError(Model):
    """CloudError.
    """

    _attribute_map = {
    }


class Resource(Model):
    """The Resource model definition.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource Id
    :vartype id: str
    :ivar name: Resource name
    :vartype name: str
    :ivar type: Resource type
    :vartype type: str
    :param location: Required. Resource location
    :type location: str
    :param tags: Resource tags
    :type tags: dict[str, str]
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'location': {'required': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'location': {'key': 'location', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
    }

    def __init__(self, **kwargs):
        super(Resource, self).__init__(**kwargs)
        self.id = None
        self.name = None
        self.type = None
        self.location = kwargs.get('location', None)
        self.tags = kwargs.get('tags', None)


class ImageTemplate(Resource):
    """Image template is an ARM resource managed by Microsoft.VirtualMachineImages
    provider.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource Id
    :vartype id: str
    :ivar name: Resource name
    :vartype name: str
    :ivar type: Resource type
    :vartype type: str
    :param location: Required. Resource location
    :type location: str
    :param tags: Resource tags
    :type tags: dict[str, str]
    :param source: Required. Specifies the properties used to describe the
     source image.
    :type source: ~azure.mgmt.imagebuilder.models.ImageTemplateSource
    :param customize: Specifies the properties used to describe the
     customization steps of the image, like Image source etc
    :type customize:
     list[~azure.mgmt.imagebuilder.models.ImageTemplateCustomizer]
    :param distribute: Required. The distribution targets where the image
     output needs to go to.
    :type distribute:
     list[~azure.mgmt.imagebuilder.models.ImageTemplateDistributor]
    :ivar provisioning_state: Provisioning state of the resource. Possible
     values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting'
    :vartype provisioning_state: str or
     ~azure.mgmt.imagebuilder.models.ProvisioningState
    :ivar provisioning_error: Provisioning error, if any
    :vartype provisioning_error:
     ~azure.mgmt.imagebuilder.models.ProvisioningError
    :ivar last_run_status: State of 'run' that is currently executing or was
     last executed.
    :vartype last_run_status:
     ~azure.mgmt.imagebuilder.models.ImageTemplateLastRunStatus
    :param build_timeout_in_minutes: Maximum duration to wait while building
     the image template. Omit or specify 0 to use the default (4 hours).
    :type build_timeout_in_minutes: int
    :param vm_profile: Describes how virtual machine is set up to build images
    :type vm_profile: ~azure.mgmt.imagebuilder.models.ImageTemplateVmProfile
    :param identity: Required. The identity of the image template, if
     configured.
    :type identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'location': {'required': True},
        'source': {'required': True},
        'distribute': {'required': True},
        'provisioning_state': {'readonly': True},
        'provisioning_error': {'readonly': True},
        'last_run_status': {'readonly': True},
        'build_timeout_in_minutes': {'maximum': 960, 'minimum': 0},
        'identity': {'required': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'location': {'key': 'location', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
        'source': {'key': 'properties.source', 'type': 'ImageTemplateSource'},
        'customize': {'key': 'properties.customize', 'type': '[ImageTemplateCustomizer]'},
        'distribute': {'key': 'properties.distribute', 'type': '[ImageTemplateDistributor]'},
        'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'},
        'provisioning_error': {'key': 'properties.provisioningError', 'type': 'ProvisioningError'},
        'last_run_status': {'key': 'properties.lastRunStatus', 'type': 'ImageTemplateLastRunStatus'},
        'build_timeout_in_minutes': {'key': 'properties.buildTimeoutInMinutes', 'type': 'int'},
        'vm_profile': {'key': 'properties.vmProfile', 'type': 'ImageTemplateVmProfile'},
        'identity': {'key': 'identity', 'type': 'ImageTemplateIdentity'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplate, self).__init__(**kwargs)
        self.source = kwargs.get('source', None)
        self.customize = kwargs.get('customize', None)
        self.distribute = kwargs.get('distribute', None)
        self.provisioning_state = None
        self.provisioning_error = None
        self.last_run_status = None
        self.build_timeout_in_minutes = kwargs.get('build_timeout_in_minutes', None)
        self.vm_profile = kwargs.get('vm_profile', None)
        self.identity = kwargs.get('identity', None)


class ImageTemplateCustomizer(Model):
    """Describes a unit of image customization.

    You probably want to use the sub-classes and not this class directly. Known
    sub-classes are: ImageTemplateShellCustomizer,
    ImageTemplateRestartCustomizer, ImageTemplateWindowsUpdateCustomizer,
    ImageTemplatePowerShellCustomizer, ImageTemplateFileCustomizer

    All required parameters must be populated in order to send to Azure.

    :param name: Friendly Name to provide context on what this customization
     step does
    :type name: str
    :param type: Required. Constant filled by server.
    :type type: str
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
    }

    _subtype_map = {
        'type': {'Shell': 'ImageTemplateShellCustomizer', 'WindowsRestart': 'ImageTemplateRestartCustomizer', 'WindowsUpdate': 'ImageTemplateWindowsUpdateCustomizer', 'PowerShell': 'ImageTemplatePowerShellCustomizer', 'File': 'ImageTemplateFileCustomizer'}
    }

    def __init__(self, **kwargs):
        super(ImageTemplateCustomizer, self).__init__(**kwargs)
        self.name = kwargs.get('name', None)
        self.type = None


class ImageTemplateDistributor(Model):
    """Generic distribution object.

    You probably want to use the sub-classes and not this class directly. Known
    sub-classes are: ImageTemplateManagedImageDistributor,
    ImageTemplateSharedImageDistributor, ImageTemplateVhdDistributor

    All required parameters must be populated in order to send to Azure.

    :param run_output_name: Required. The name to be used for the associated
     RunOutput.
    :type run_output_name: str
    :param artifact_tags: Tags that will be applied to the artifact once it
     has been created/updated by the distributor.
    :type artifact_tags: dict[str, str]
    :param type: Required. Constant filled by server.
    :type type: str
    """

    _validation = {
        'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
        'type': {'required': True},
    }

    _attribute_map = {
        'run_output_name': {'key': 'runOutputName', 'type': 'str'},
        'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
        'type': {'key': 'type', 'type': 'str'},
    }

    _subtype_map = {
        'type': {'ManagedImage': 'ImageTemplateManagedImageDistributor', 'SharedImage': 'ImageTemplateSharedImageDistributor', 'VHD': 'ImageTemplateVhdDistributor'}
    }

    def __init__(self, **kwargs):
        super(ImageTemplateDistributor, self).__init__(**kwargs)
        self.run_output_name = kwargs.get('run_output_name', None)
        self.artifact_tags = kwargs.get('artifact_tags', None)
        self.type = None


class ImageTemplateFileCustomizer(ImageTemplateCustomizer):
    """Uploads files to VMs (Linux, Windows). Corresponds to Packer file
    provisioner.

    All required parameters must be populated in order to send to Azure.

    :param name: Friendly Name to provide context on what this customization
     step does
    :type name: str
    :param type: Required. Constant filled by server.
    :type type: str
    :param source_uri: The URI of the file to be uploaded for customizing the
     VM. It can be a github link, SAS URI for Azure Storage, etc
    :type source_uri: str
    :param sha256_checksum: SHA256 checksum of the file provided in the
     sourceUri field above
    :type sha256_checksum: str
    :param destination: The absolute path to a file (with nested directory
     structures already created) where the file (from sourceUri) will be
     uploaded to in the VM
    :type destination: str
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'source_uri': {'key': 'sourceUri', 'type': 'str'},
        'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'},
        'destination': {'key': 'destination', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateFileCustomizer, self).__init__(**kwargs)
        self.source_uri = kwargs.get('source_uri', None)
        self.sha256_checksum = kwargs.get('sha256_checksum', None)
        self.destination = kwargs.get('destination', None)
        self.type = 'File'


class ImageTemplateIdentity(Model):
    """Identity for the image template.

    :param type: The type of identity used for the image template. Possible
     values include: 'UserAssigned'
    :type type: str or ~azure.mgmt.imagebuilder.models.ResourceIdentityType
    :param user_assigned_identities: The list of user identities associated
     with the image template. The user identity dictionary key references will
     be ARM resource ids in the form:
     '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
    :type user_assigned_identities: dict[str,
     ~azure.mgmt.imagebuilder.models.ImageTemplateIdentityUserAssignedIdentitiesValue]
    """

    _attribute_map = {
        'type': {'key': 'type', 'type': 'ResourceIdentityType'},
        'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ImageTemplateIdentityUserAssignedIdentitiesValue}'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateIdentity, self).__init__(**kwargs)
        self.type = kwargs.get('type', None)
        self.user_assigned_identities = kwargs.get('user_assigned_identities', None)


class ImageTemplateIdentityUserAssignedIdentitiesValue(Model):
    """ImageTemplateIdentityUserAssignedIdentitiesValue.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    :ivar principal_id: The principal id of user assigned identity.
    :vartype principal_id: str
    :ivar client_id: The client id of user assigned identity.
    :vartype client_id: str
    """

    _validation = {
        'principal_id': {'readonly': True},
        'client_id': {'readonly': True},
    }

    _attribute_map = {
        'principal_id': {'key': 'principalId', 'type': 'str'},
        'client_id': {'key': 'clientId', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs)
        self.principal_id = None
        self.client_id = None


class ImageTemplateLastRunStatus(Model):
    """Describes the latest status of running an image template.

    :param start_time: Start time of the last run (UTC)
    :type start_time: datetime
    :param end_time: End time of the last run (UTC)
    :type end_time: datetime
    :param run_state: State of the last run. Possible values include:
     'Running', 'Canceling', 'Succeeded', 'PartiallySucceeded', 'Failed',
     'Canceled'
    :type run_state: str or ~azure.mgmt.imagebuilder.models.RunState
    :param run_sub_state: Sub-state of the last run. Possible values include:
     'Queued', 'Building', 'Customizing', 'Distributing'
    :type run_sub_state: str or ~azure.mgmt.imagebuilder.models.RunSubState
    :param message: Verbose information about the last run state
    :type message: str
    """

    _attribute_map = {
        'start_time': {'key': 'startTime', 'type': 'iso-8601'},
        'end_time': {'key': 'endTime', 'type': 'iso-8601'},
        'run_state': {'key': 'runState', 'type': 'RunState'},
        'run_sub_state': {'key': 'runSubState', 'type': 'RunSubState'},
        'message': {'key': 'message', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateLastRunStatus, self).__init__(**kwargs)
        self.start_time = kwargs.get('start_time', None)
        self.end_time = kwargs.get('end_time', None)
        self.run_state = kwargs.get('run_state', None)
        self.run_sub_state = kwargs.get('run_sub_state', None)
        self.message = kwargs.get('message', None)


class ImageTemplateManagedImageDistributor(ImageTemplateDistributor):
    """Distribute as a Managed Disk Image.

    All required parameters must be populated in order to send to Azure.

    :param run_output_name: Required. The name to be used for the associated
     RunOutput.
    :type run_output_name: str
    :param artifact_tags: Tags that will be applied to the artifact once it
     has been created/updated by the distributor.
    :type artifact_tags: dict[str, str]
    :param type: Required. Constant filled by server.
    :type type: str
    :param image_id: Required. Resource Id of the Managed Disk Image
    :type image_id: str
    :param location: Required. Azure location for the image, should match if
     image already exists
    :type location: str
    """

    _validation = {
        'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
        'type': {'required': True},
        'image_id': {'required': True},
        'location': {'required': True},
    }

    _attribute_map = {
        'run_output_name': {'key': 'runOutputName', 'type': 'str'},
        'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
        'type': {'key': 'type', 'type': 'str'},
        'image_id': {'key': 'imageId', 'type': 'str'},
        'location': {'key': 'location', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateManagedImageDistributor, self).__init__(**kwargs)
        self.image_id = kwargs.get('image_id', None)
        self.location = kwargs.get('location', None)
        self.type = 'ManagedImage'


class ImageTemplateSource(Model):
    """Describes a virtual machine image source for building, customizing and
    distributing.

    You probably want to use the sub-classes and not this class directly. Known
    sub-classes are: ImageTemplatePlatformImageSource,
    ImageTemplateManagedImageSource, ImageTemplateSharedImageVersionSource

    All required parameters must be populated in order to send to Azure.

    :param type: Required. Constant filled by server.
    :type type: str
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'type': {'key': 'type', 'type': 'str'},
    }

    _subtype_map = {
        'type': {'PlatformImage': 'ImageTemplatePlatformImageSource', 'ManagedImage': 'ImageTemplateManagedImageSource', 'SharedImageVersion': 'ImageTemplateSharedImageVersionSource'}
    }

    def __init__(self, **kwargs):
        super(ImageTemplateSource, self).__init__(**kwargs)
        self.type = None


class ImageTemplateManagedImageSource(ImageTemplateSource):
    """Describes an image source that is a managed image in customer subscription.

    All required parameters must be populated in order to send to Azure.

    :param type: Required. Constant filled by server.
    :type type: str
    :param image_id: Required. ARM resource id of the managed image in
     customer subscription
    :type image_id: str
    """

    _validation = {
        'type': {'required': True},
        'image_id': {'required': True},
    }

    _attribute_map = {
        'type': {'key': 'type', 'type': 'str'},
        'image_id': {'key': 'imageId', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateManagedImageSource, self).__init__(**kwargs)
        self.image_id = kwargs.get('image_id', None)
        self.type = 'ManagedImage'


class ImageTemplatePlatformImageSource(ImageTemplateSource):
    """Describes an image source from [Azure Gallery
    Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).

    All required parameters must be populated in order to send to Azure.

    :param type: Required. Constant filled by server.
    :type type: str
    :param publisher: Image Publisher in [Azure Gallery
     Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
    :type publisher: str
    :param offer: Image offer from the [Azure Gallery
     Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
    :type offer: str
    :param sku: Image sku from the [Azure Gallery
     Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
    :type sku: str
    :param version: Image version from the [Azure Gallery
     Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
    :type version: str
    :param plan_info: Optional configuration of purchase plan for platform
     image.
    :type plan_info: ~azure.mgmt.imagebuilder.models.PlatformImagePurchasePlan
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'type': {'key': 'type', 'type': 'str'},
        'publisher': {'key': 'publisher', 'type': 'str'},
        'offer': {'key': 'offer', 'type': 'str'},
        'sku': {'key': 'sku', 'type': 'str'},
        'version': {'key': 'version', 'type': 'str'},
        'plan_info': {'key': 'planInfo', 'type': 'PlatformImagePurchasePlan'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplatePlatformImageSource, self).__init__(**kwargs)
        self.publisher = kwargs.get('publisher', None)
        self.offer = kwargs.get('offer', None)
        self.sku = kwargs.get('sku', None)
        self.version = kwargs.get('version', None)
        self.plan_info = kwargs.get('plan_info', None)
        self.type = 'PlatformImage'


class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
    """Runs the specified PowerShell on the VM (Windows). Corresponds to Packer
    powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be
    specified.

    All required parameters must be populated in order to send to Azure.

    :param name: Friendly Name to provide context on what this customization
     step does
    :type name: str
    :param type: Required. Constant filled by server.
    :type type: str
    :param script_uri: URI of the PowerShell script to be run for customizing.
     It can be a github link, SAS URI for Azure Storage, etc
    :type script_uri: str
    :param sha256_checksum: SHA256 checksum of the power shell script provided
     in the scriptUri field above
    :type sha256_checksum: str
    :param inline: Array of PowerShell commands to execute
    :type inline: list[str]
    :param run_elevated: If specified, the PowerShell script will be run with
     elevated privileges
    :type run_elevated: bool
    :param valid_exit_codes: Valid exit codes for the PowerShell script.
     [Default: 0]
    :type valid_exit_codes: list[int]
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'script_uri': {'key': 'scriptUri', 'type': 'str'},
        'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'},
        'inline': {'key': 'inline', 'type': '[str]'},
        'run_elevated': {'key': 'runElevated', 'type': 'bool'},
        'valid_exit_codes': {'key': 'validExitCodes', 'type': '[int]'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplatePowerShellCustomizer, self).__init__(**kwargs)
        self.script_uri = kwargs.get('script_uri', None)
        self.sha256_checksum = kwargs.get('sha256_checksum', None)
        self.inline = kwargs.get('inline', None)
        self.run_elevated = kwargs.get('run_elevated', None)
        self.valid_exit_codes = kwargs.get('valid_exit_codes', None)
        self.type = 'PowerShell'


class ImageTemplateRestartCustomizer(ImageTemplateCustomizer):
    """Reboots a VM and waits for it to come back online (Windows). Corresponds to
    Packer windows-restart provisioner.

    All required parameters must be populated in order to send to Azure.

    :param name: Friendly Name to provide context on what this customization
     step does
    :type name: str
    :param type: Required. Constant filled by server.
    :type type: str
    :param restart_command: Command to execute the restart [Default: 'shutdown
     /r /f /t 0 /c "packer restart"']
    :type restart_command: str
    :param restart_check_command: Command to check if restart succeeded
     [Default: '']
    :type restart_check_command: str
    :param restart_timeout: Restart timeout specified as a string of magnitude
     and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']
    :type restart_timeout: str
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'restart_command': {'key': 'restartCommand', 'type': 'str'},
        'restart_check_command': {'key': 'restartCheckCommand', 'type': 'str'},
        'restart_timeout': {'key': 'restartTimeout', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateRestartCustomizer, self).__init__(**kwargs)
        self.restart_command = kwargs.get('restart_command', None)
        self.restart_check_command = kwargs.get('restart_check_command', None)
        self.restart_timeout = kwargs.get('restart_timeout', None)
        self.type = 'WindowsRestart'


class ImageTemplateSharedImageDistributor(ImageTemplateDistributor):
    """Distribute via Shared Image Gallery.

    All required parameters must be populated in order to send to Azure.

    :param run_output_name: Required. The name to be used for the associated
     RunOutput.
    :type run_output_name: str
    :param artifact_tags: Tags that will be applied to the artifact once it
     has been created/updated by the distributor.
    :type artifact_tags: dict[str, str]
    :param type: Required. Constant filled by server.
    :type type: str
    :param gallery_image_id: Required. Resource Id of the Shared Image Gallery
     image
    :type gallery_image_id: str
    :param replication_regions: Required. A list of regions that the image
     will be replicated to
    :type replication_regions: list[str]
    :param exclude_from_latest: Flag that indicates whether created image
     version should be excluded from latest. Omit to use the default (false).
    :type exclude_from_latest: bool
    :param storage_account_type: Storage account type to be used to store the
     shared image. Omit to use the default (Standard_LRS). Possible values
     include: 'Standard_LRS', 'Standard_ZRS'
    :type storage_account_type: str or
     ~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType
    """

    _validation = {
        'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
        'type': {'required': True},
        'gallery_image_id': {'required': True},
        'replication_regions': {'required': True},
    }

    _attribute_map = {
        'run_output_name': {'key': 'runOutputName', 'type': 'str'},
        'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
        'type': {'key': 'type', 'type': 'str'},
        'gallery_image_id': {'key': 'galleryImageId', 'type': 'str'},
        'replication_regions': {'key': 'replicationRegions', 'type': '[str]'},
        'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'},
        'storage_account_type': {'key': 'storageAccountType', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateSharedImageDistributor, self).__init__(**kwargs)
        self.gallery_image_id = kwargs.get('gallery_image_id', None)
        self.replication_regions = kwargs.get('replication_regions', None)
        self.exclude_from_latest = kwargs.get('exclude_from_latest', None)
        self.storage_account_type = kwargs.get('storage_account_type', None)
        self.type = 'SharedImage'


class ImageTemplateSharedImageVersionSource(ImageTemplateSource):
    """Describes an image source that is an image version in a shared image
    gallery.

    All required parameters must be populated in order to send to Azure.

    :param type: Required. Constant filled by server.
    :type type: str
    :param image_version_id: Required. ARM resource id of the image version in
     the shared image gallery
    :type image_version_id: str
    """

    _validation = {
        'type': {'required': True},
        'image_version_id': {'required': True},
    }

    _attribute_map = {
        'type': {'key': 'type', 'type': 'str'},
        'image_version_id': {'key': 'imageVersionId', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateSharedImageVersionSource, self).__init__(**kwargs)
        self.image_version_id = kwargs.get('image_version_id', None)
        self.type = 'SharedImageVersion'


class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
    """Runs a shell script during the customization phase (Linux). Corresponds to
    Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be
    specified.

    All required parameters must be populated in order to send to Azure.

    :param name: Friendly Name to provide context on what this customization
     step does
    :type name: str
    :param type: Required. Constant filled by server.
    :type type: str
    :param script_uri: URI of the shell script to be run for customizing. It
     can be a github link, SAS URI for Azure Storage, etc
    :type script_uri: str
    :param sha256_checksum: SHA256 checksum of the shell script provided in
     the scriptUri field
    :type sha256_checksum: str
    :param inline: Array of shell commands to execute
    :type inline: list[str]
    """

    _validation = {
        'type': {'required': True},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'script_uri': {'key': 'scriptUri', 'type': 'str'},
        'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'},
        'inline': {'key': 'inline', 'type': '[str]'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateShellCustomizer, self).__init__(**kwargs)
        self.script_uri = kwargs.get('script_uri', None)
        self.sha256_checksum = kwargs.get('sha256_checksum', None)
        self.inline = kwargs.get('inline', None)
        self.type = 'Shell'


class ImageTemplateUpdateParameters(Model):
    """Parameters for updating an image template.

    :param identity: The identity of the image template, if configured.
    :type identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity
    :param tags: The user-specified tags associated with the image template.
    :type tags: dict[str, str]
    """

    _attribute_map = {
        'identity': {'key': 'identity', 'type': 'ImageTemplateIdentity'},
        'tags': {'key': 'tags', 'type': '{str}'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateUpdateParameters, self).__init__(**kwargs)
        self.identity = kwargs.get('identity', None)
        self.tags = kwargs.get('tags', None)


class ImageTemplateVhdDistributor(ImageTemplateDistributor):
    """Distribute via VHD in a storage account.

    All required parameters must be populated in order to send to Azure.

    :param run_output_name: Required. The name to be used for the associated
     RunOutput.
    :type run_output_name: str
    :param artifact_tags: Tags that will be applied to the artifact once it
     has been created/updated by the distributor.
    :type artifact_tags: dict[str, str]
    :param type: Required. Constant filled by server.
    :type type: str
    """

    _validation = {
        'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
        'type': {'required': True},
    }

    _attribute_map = {
        'run_output_name': {'key': 'runOutputName', 'type': 'str'},
        'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
        'type': {'key': 'type', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateVhdDistributor, self).__init__(**kwargs)
        self.type = 'VHD'


class ImageTemplateVmProfile(Model):
    """Describes the virtual machine used to build, customize and capture images.

    :param vm_size: Size of the virtual machine used to build, customize and
     capture images. Omit or specify empty string to use the default
     (Standard_D1_v2).
    :type vm_size: str
    :param os_disk_size_gb: Size of the OS disk in GB. Omit or specify 0 to
     use Azure's default OS disk size.
    :type os_disk_size_gb: int
    :param vnet_config: Optional configuration of the virtual network to use
     to deploy the build virtual machine in. Omit if no specific virtual
     network needs to be used.
    :type vnet_config: ~azure.mgmt.imagebuilder.models.VirtualNetworkConfig
    """

    _validation = {
        'os_disk_size_gb': {'minimum': 0},
    }

    _attribute_map = {
        'vm_size': {'key': 'vmSize', 'type': 'str'},
        'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'},
        'vnet_config': {'key': 'vnetConfig', 'type': 'VirtualNetworkConfig'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateVmProfile, self).__init__(**kwargs)
        self.vm_size = kwargs.get('vm_size', None)
        self.os_disk_size_gb = kwargs.get('os_disk_size_gb', None)
        self.vnet_config = kwargs.get('vnet_config', None)


class ImageTemplateWindowsUpdateCustomizer(ImageTemplateCustomizer):
    """Installs Windows Updates. Corresponds to Packer Windows Update Provisioner
    (https://github.com/rgl/packer-provisioner-windows-update).

    All required parameters must be populated in order to send to Azure.

    :param name: Friendly Name to provide context on what this customization
     step does
    :type name: str
    :param type: Required. Constant filled by server.
    :type type: str
    :param search_criteria: Criteria to search updates. Omit or specify empty
     string to use the default (search all). Refer to above link for examples
     and detailed description of this field.
    :type search_criteria: str
    :param filters: Array of filters to select updates to apply. Omit or
     specify empty array to use the default (no filter). Refer to above link
     for examples and detailed description of this field.
    :type filters: list[str]
    :param update_limit: Maximum number of updates to apply at a time. Omit or
     specify 0 to use the default (1000)
    :type update_limit: int
    """

    _validation = {
        'type': {'required': True},
        'update_limit': {'minimum': 0},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'search_criteria': {'key': 'searchCriteria', 'type': 'str'},
        'filters': {'key': 'filters', 'type': '[str]'},
        'update_limit': {'key': 'updateLimit', 'type': 'int'},
    }

    def __init__(self, **kwargs):
        super(ImageTemplateWindowsUpdateCustomizer, self).__init__(**kwargs)
        self.search_criteria = kwargs.get('search_criteria', None)
        self.filters = kwargs.get('filters', None)
        self.update_limit = kwargs.get('update_limit', None)
        self.type = 'WindowsUpdate'


class InnerError(Model):
    """Inner error details.

    :param exception_type: The exception type.
    :type exception_type: str
    :param error_detail: The internal error message or exception dump.
    :type error_detail: str
    """

    _attribute_map = {
        'exception_type': {'key': 'exceptionType', 'type': 'str'},
        'error_detail': {'key': 'errorDetail', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(InnerError, self).__init__(**kwargs)
        self.exception_type = kwargs.get('exception_type', None)
        self.error_detail = kwargs.get('error_detail', None)


class Operation(Model):
    """A REST API operation.

    :param name: The operation name. This is of the format
     {provider}/{resource}/{operation}
    :type name: str
    :param display: The object that describes the operation.
    :type display: ~azure.mgmt.imagebuilder.models.OperationDisplay
    :param origin: The intended executor of the operation.
    :type origin: str
    :param properties: Properties of the operation.
    :type properties: object
    :param is_data_action: The flag that indicates whether the operation
     applies to data plane.
    :type is_data_action: bool
    """

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'display': {'key': 'display', 'type': 'OperationDisplay'},
        'origin': {'key': 'origin', 'type': 'str'},
        'properties': {'key': 'properties', 'type': 'object'},
        'is_data_action': {'key': 'isDataAction', 'type': 'bool'},
    }

    def __init__(self, **kwargs):
        super(Operation, self).__init__(**kwargs)
        self.name = kwargs.get('name', None)
        self.display = kwargs.get('display', None)
        self.origin = kwargs.get('origin', None)
        self.properties = kwargs.get('properties', None)
        self.is_data_action = kwargs.get('is_data_action', None)


class OperationDisplay(Model):
    """The object that describes the operation.

    :param provider: Friendly name of the resource provider.
    :type provider: str
    :param operation: The operation type. For example: read, write, delete, or
     listKeys/action
    :type operation: str
    :param resource: The resource type on which the operation is performed.
    :type resource: str
    :param description: The friendly name of the operation.
    :type description: str
    """

    _attribute_map = {
        'provider': {'key': 'provider', 'type': 'str'},
        'operation': {'key': 'operation', 'type': 'str'},
        'resource': {'key': 'resource', 'type': 'str'},
        'description': {'key': 'description', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(OperationDisplay, self).__init__(**kwargs)
        self.provider = kwargs.get('provider', None)
        self.operation = kwargs.get('operation', None)
        self.resource = kwargs.get('resource', None)
        self.description = kwargs.get('description', None)


class PlatformImagePurchasePlan(Model):
    """Purchase plan configuration for platform image.

    All required parameters must be populated in order to send to Azure.

    :param plan_name: Required. Name of the purchase plan.
    :type plan_name: str
    :param plan_product: Required. Product of the purchase plan.
    :type plan_product: str
    :param plan_publisher: Required. Publisher of the purchase plan.
    :type plan_publisher: str
    """

    _validation = {
        'plan_name': {'required': True},
        'plan_product': {'required': True},
        'plan_publisher': {'required': True},
    }

    _attribute_map = {
        'plan_name': {'key': 'planName', 'type': 'str'},
        'plan_product': {'key': 'planProduct', 'type': 'str'},
        'plan_publisher': {'key': 'planPublisher', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(PlatformImagePurchasePlan, self).__init__(**kwargs)
        self.plan_name = kwargs.get('plan_name', None)
        self.plan_product = kwargs.get('plan_product', None)
        self.plan_publisher = kwargs.get('plan_publisher', None)


class ProvisioningError(Model):
    """Describes the error happened when create or update an image template.

    :param provisioning_error_code: Error code of the provisioning failure.
     Possible values include: 'BadSourceType', 'BadPIRSource',
     'BadManagedImageSource', 'BadSharedImageVersionSource',
     'BadCustomizerType', 'UnsupportedCustomizerType', 'NoCustomizerScript',
     'BadDistributeType', 'BadSharedImageDistribute', 'ServerError', 'Other'
    :type provisioning_error_code: str or
     ~azure.mgmt.imagebuilder.models.ProvisioningErrorCode
    :param message: Verbose error message about the provisioning failure
    :type message: str
    """

    _attribute_map = {
        'provisioning_error_code': {'key': 'provisioningErrorCode', 'type': 'str'},
        'message': {'key': 'message', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ProvisioningError, self).__init__(**kwargs)
        self.provisioning_error_code = kwargs.get('provisioning_error_code', None)
        self.message = kwargs.get('message', None)


class SubResource(Model):
    """The Sub Resource model definition.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource Id
    :vartype id: str
    :param name: Required. Resource name
    :type name: str
    :ivar type: Resource type
    :vartype type: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'required': True},
        'type': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(SubResource, self).__init__(**kwargs)
        self.id = None
        self.name = kwargs.get('name', None)
        self.type = None


class RunOutput(SubResource):
    """Represents an output that was created by running an image template.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource Id
    :vartype id: str
    :param name: Required. Resource name
    :type name: str
    :ivar type: Resource type
    :vartype type: str
    :param artifact_id: The resource id of the artifact.
    :type artifact_id: str
    :param artifact_uri: The location URI of the artifact.
    :type artifact_uri: str
    :ivar provisioning_state: Provisioning state of the resource. Possible
     values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting'
    :vartype provisioning_state: str or
     ~azure.mgmt.imagebuilder.models.ProvisioningState
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'required': True},
        'type': {'readonly': True},
        'provisioning_state': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'artifact_id': {'key': 'properties.artifactId', 'type': 'str'},
        'artifact_uri': {'key': 'properties.artifactUri', 'type': 'str'},
        'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'},
    }

    def __init__(self, **kwargs):
        super(RunOutput, self).__init__(**kwargs)
        self.artifact_id = kwargs.get('artifact_id', None)
        self.artifact_uri = kwargs.get('artifact_uri', None)
        self.provisioning_state = None


class VirtualNetworkConfig(Model):
    """Virtual Network configuration.

    :param subnet_id: Resource id of a pre-existing subnet.
    :type subnet_id: str
    """

    _attribute_map = {
        'subnet_id': {'key': 'subnetId', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(VirtualNetworkConfig, self).__init__(**kwargs)
        self.subnet_id = kwargs.get('subnet_id', None)