azure_mgmt_imagebuilder/package_2023_07/
models.rs

1#![allow(non_camel_case_types)]
2#![allow(unused_imports)]
3use serde::de::{value, Deserializer, IntoDeserializer};
4use serde::{Deserialize, Serialize, Serializer};
5use std::str::FromStr;
6#[doc = "Version numbering scheme to be used."]
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8#[serde(tag = "scheme")]
9pub enum DistributeVersionerUnion {
10    Latest(DistributeVersionerLatest),
11    Source(DistributeVersionerSource),
12}
13#[doc = "Generates version number that will be latest based on existing version numbers."]
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct DistributeVersionerLatest {
16    #[doc = "Major version for the generated version number. Determine what is \"latest\" based on versions with this value as the major version. -1 is equivalent to leaving it unset."]
17    #[serde(default, skip_serializing_if = "Option::is_none")]
18    pub major: Option<i32>,
19}
20impl DistributeVersionerLatest {
21    pub fn new() -> Self {
22        Self { major: None }
23    }
24}
25#[doc = "Generates version number based on version number of source image"]
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub struct DistributeVersionerSource {}
28impl DistributeVersionerSource {
29    pub fn new() -> Self {
30        Self {}
31    }
32}
33#[doc = "The resource management error additional info."]
34#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
35pub struct ErrorAdditionalInfo {
36    #[doc = "The additional info type."]
37    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
38    pub type_: Option<String>,
39    #[doc = "The additional info."]
40    #[serde(default, skip_serializing_if = "Option::is_none")]
41    pub info: Option<serde_json::Value>,
42}
43impl ErrorAdditionalInfo {
44    pub fn new() -> Self {
45        Self::default()
46    }
47}
48#[doc = "The error detail."]
49#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
50pub struct ErrorDetail {
51    #[doc = "The error code."]
52    #[serde(default, skip_serializing_if = "Option::is_none")]
53    pub code: Option<String>,
54    #[doc = "The error message."]
55    #[serde(default, skip_serializing_if = "Option::is_none")]
56    pub message: Option<String>,
57    #[doc = "The error target."]
58    #[serde(default, skip_serializing_if = "Option::is_none")]
59    pub target: Option<String>,
60    #[doc = "The error details."]
61    #[serde(
62        default,
63        deserialize_with = "azure_core::util::deserialize_null_as_default",
64        skip_serializing_if = "Vec::is_empty"
65    )]
66    pub details: Vec<ErrorDetail>,
67    #[doc = "The error additional info."]
68    #[serde(
69        rename = "additionalInfo",
70        default,
71        deserialize_with = "azure_core::util::deserialize_null_as_default",
72        skip_serializing_if = "Vec::is_empty"
73    )]
74    pub additional_info: Vec<ErrorAdditionalInfo>,
75}
76impl ErrorDetail {
77    pub fn new() -> Self {
78        Self::default()
79    }
80}
81#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."]
82#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
83pub struct ErrorResponse {
84    #[doc = "The error detail."]
85    #[serde(default, skip_serializing_if = "Option::is_none")]
86    pub error: Option<ErrorDetail>,
87}
88impl azure_core::Continuable for ErrorResponse {
89    type Continuation = String;
90    fn continuation(&self) -> Option<Self::Continuation> {
91        None
92    }
93}
94impl ErrorResponse {
95    pub fn new() -> Self {
96        Self::default()
97    }
98}
99#[doc = "Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider"]
100#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
101pub struct ImageTemplate {
102    #[serde(flatten)]
103    pub tracked_resource: TrackedResource,
104    #[doc = "Describes the properties of an image template"]
105    #[serde(default, skip_serializing_if = "Option::is_none")]
106    pub properties: Option<ImageTemplateProperties>,
107    #[doc = "Identity for the image template."]
108    pub identity: ImageTemplateIdentity,
109}
110impl ImageTemplate {
111    pub fn new(tracked_resource: TrackedResource, identity: ImageTemplateIdentity) -> Self {
112        Self {
113            tracked_resource,
114            properties: None,
115            identity,
116        }
117    }
118}
119#[doc = "Describes a unit of image customization"]
120#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
121pub struct ImageTemplateCustomizer {
122    #[doc = "Friendly Name to provide context on what this customization step does"]
123    #[serde(default, skip_serializing_if = "Option::is_none")]
124    pub name: Option<String>,
125}
126impl ImageTemplateCustomizer {
127    pub fn new() -> Self {
128        Self { name: None }
129    }
130}
131#[doc = "The type of customization tool you want to use on the Image. For example, \"Shell\" can be shell customizer"]
132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
133#[serde(tag = "type")]
134pub enum ImageTemplateCustomizerUnion {
135    File(ImageTemplateFileCustomizer),
136    PowerShell(ImageTemplatePowerShellCustomizer),
137    WindowsRestart(ImageTemplateRestartCustomizer),
138    Shell(ImageTemplateShellCustomizer),
139    WindowsUpdate(ImageTemplateWindowsUpdateCustomizer),
140}
141#[doc = "Generic distribution object"]
142#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
143pub struct ImageTemplateDistributor {
144    #[doc = "The name to be used for the associated RunOutput."]
145    #[serde(rename = "runOutputName")]
146    pub run_output_name: String,
147    #[doc = "Tags that will be applied to the artifact once it has been created/updated by the distributor."]
148    #[serde(rename = "artifactTags", default, skip_serializing_if = "Option::is_none")]
149    pub artifact_tags: Option<serde_json::Value>,
150}
151impl ImageTemplateDistributor {
152    pub fn new(run_output_name: String) -> Self {
153        Self {
154            run_output_name,
155            artifact_tags: None,
156        }
157    }
158}
159#[doc = "Type of distribution."]
160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
161#[serde(tag = "type")]
162pub enum ImageTemplateDistributorUnion {
163    ManagedImage(ImageTemplateManagedImageDistributor),
164    SharedImage(ImageTemplateSharedImageDistributor),
165    #[serde(rename = "VHD")]
166    Vhd(ImageTemplateVhdDistributor),
167}
168#[doc = "Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner"]
169#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
170pub struct ImageTemplateFileCustomizer {
171    #[serde(flatten)]
172    pub image_template_customizer: ImageTemplateCustomizer,
173    #[doc = "The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc"]
174    #[serde(rename = "sourceUri", default, skip_serializing_if = "Option::is_none")]
175    pub source_uri: Option<String>,
176    #[doc = "SHA256 checksum of the file provided in the sourceUri field above"]
177    #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")]
178    pub sha256_checksum: Option<String>,
179    #[doc = "The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM"]
180    #[serde(default, skip_serializing_if = "Option::is_none")]
181    pub destination: Option<String>,
182}
183impl ImageTemplateFileCustomizer {
184    pub fn new(image_template_customizer: ImageTemplateCustomizer) -> Self {
185        Self {
186            image_template_customizer,
187            source_uri: None,
188            sha256_checksum: None,
189            destination: None,
190        }
191    }
192}
193#[doc = "Uploads files required for validation to VMs (Linux, Windows). Corresponds to Packer file provisioner"]
194#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
195pub struct ImageTemplateFileValidator {
196    #[serde(flatten)]
197    pub image_template_in_vm_validator: ImageTemplateInVmValidator,
198    #[doc = "The URI of the file to be uploaded to the VM for validation. It can be a github link, Azure Storage URI (authorized or SAS), etc"]
199    #[serde(rename = "sourceUri", default, skip_serializing_if = "Option::is_none")]
200    pub source_uri: Option<String>,
201    #[doc = "SHA256 checksum of the file provided in the sourceUri field above"]
202    #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")]
203    pub sha256_checksum: Option<String>,
204    #[doc = "The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM"]
205    #[serde(default, skip_serializing_if = "Option::is_none")]
206    pub destination: Option<String>,
207}
208impl ImageTemplateFileValidator {
209    pub fn new(image_template_in_vm_validator: ImageTemplateInVmValidator) -> Self {
210        Self {
211            image_template_in_vm_validator,
212            source_uri: None,
213            sha256_checksum: None,
214            destination: None,
215        }
216    }
217}
218#[doc = "Identity for the image template."]
219#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
220pub struct ImageTemplateIdentity {
221    #[doc = "The type of identity used for the image template. The type 'None' will remove any identities from the image template."]
222    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
223    pub type_: Option<image_template_identity::Type>,
224    #[doc = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests."]
225    #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")]
226    pub user_assigned_identities: Option<UserAssignedIdentities>,
227}
228impl ImageTemplateIdentity {
229    pub fn new() -> Self {
230        Self::default()
231    }
232}
233pub mod image_template_identity {
234    use super::*;
235    #[doc = "The type of identity used for the image template. The type 'None' will remove any identities from the image template."]
236    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
237    pub enum Type {
238        UserAssigned,
239        None,
240    }
241}
242#[doc = "Describes a unit of in-VM validation of image"]
243#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
244pub struct ImageTemplateInVmValidator {
245    #[doc = "Friendly Name to provide context on what this validation step does"]
246    #[serde(default, skip_serializing_if = "Option::is_none")]
247    pub name: Option<String>,
248}
249impl ImageTemplateInVmValidator {
250    pub fn new() -> Self {
251        Self { name: None }
252    }
253}
254#[doc = "The type of validation you want to use on the Image. For example, \"Shell\" can be shell validation"]
255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
256#[serde(tag = "type")]
257pub enum ImageTemplateInVmValidatorUnion {
258    File(ImageTemplateFileValidator),
259    PowerShell(ImageTemplatePowerShellValidator),
260    Shell(ImageTemplateShellValidator),
261}
262#[doc = "Describes the latest status of running an image template"]
263#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
264pub struct ImageTemplateLastRunStatus {
265    #[doc = "Start time of the last run (UTC)"]
266    #[serde(rename = "startTime", default, with = "azure_core::date::rfc3339::option")]
267    pub start_time: Option<::time::OffsetDateTime>,
268    #[doc = "End time of the last run (UTC)"]
269    #[serde(rename = "endTime", default, with = "azure_core::date::rfc3339::option")]
270    pub end_time: Option<::time::OffsetDateTime>,
271    #[doc = "State of the last run"]
272    #[serde(rename = "runState", default, skip_serializing_if = "Option::is_none")]
273    pub run_state: Option<image_template_last_run_status::RunState>,
274    #[doc = "Sub-state of the last run"]
275    #[serde(rename = "runSubState", default, skip_serializing_if = "Option::is_none")]
276    pub run_sub_state: Option<image_template_last_run_status::RunSubState>,
277    #[doc = "Verbose information about the last run state"]
278    #[serde(default, skip_serializing_if = "Option::is_none")]
279    pub message: Option<String>,
280}
281impl ImageTemplateLastRunStatus {
282    pub fn new() -> Self {
283        Self::default()
284    }
285}
286pub mod image_template_last_run_status {
287    use super::*;
288    #[doc = "State of the last run"]
289    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
290    pub enum RunState {
291        Running,
292        Canceling,
293        Succeeded,
294        PartiallySucceeded,
295        Failed,
296        Canceled,
297    }
298    #[doc = "Sub-state of the last run"]
299    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
300    pub enum RunSubState {
301        Queued,
302        Building,
303        Customizing,
304        Optimizing,
305        Validating,
306        Distributing,
307    }
308}
309#[doc = "The result of List image templates operation"]
310#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
311pub struct ImageTemplateListResult {
312    #[doc = "An array of image templates"]
313    #[serde(
314        default,
315        deserialize_with = "azure_core::util::deserialize_null_as_default",
316        skip_serializing_if = "Vec::is_empty"
317    )]
318    pub value: Vec<ImageTemplate>,
319    #[doc = "The continuation token."]
320    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
321    pub next_link: Option<String>,
322}
323impl azure_core::Continuable for ImageTemplateListResult {
324    type Continuation = String;
325    fn continuation(&self) -> Option<Self::Continuation> {
326        self.next_link.clone().filter(|value| !value.is_empty())
327    }
328}
329impl ImageTemplateListResult {
330    pub fn new() -> Self {
331        Self::default()
332    }
333}
334#[doc = "Distribute as a Managed Disk Image."]
335#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
336pub struct ImageTemplateManagedImageDistributor {
337    #[serde(flatten)]
338    pub image_template_distributor: ImageTemplateDistributor,
339    #[doc = "Resource Id of the Managed Disk Image"]
340    #[serde(rename = "imageId")]
341    pub image_id: String,
342    #[doc = "Azure location for the image, should match if image already exists"]
343    pub location: String,
344}
345impl ImageTemplateManagedImageDistributor {
346    pub fn new(image_template_distributor: ImageTemplateDistributor, image_id: String, location: String) -> Self {
347        Self {
348            image_template_distributor,
349            image_id,
350            location,
351        }
352    }
353}
354#[doc = "Describes an image source that is a managed image in customer subscription. This image must reside in the same subscription and region as the Image Builder template."]
355#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
356pub struct ImageTemplateManagedImageSource {
357    #[doc = "ARM resource id of the managed image in customer subscription"]
358    #[serde(rename = "imageId")]
359    pub image_id: String,
360}
361impl ImageTemplateManagedImageSource {
362    pub fn new(image_id: String) -> Self {
363        Self { image_id }
364    }
365}
366#[doc = "Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages)."]
367#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
368pub struct ImageTemplatePlatformImageSource {
369    #[doc = "Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages)."]
370    #[serde(default, skip_serializing_if = "Option::is_none")]
371    pub publisher: Option<String>,
372    #[doc = "Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages)."]
373    #[serde(default, skip_serializing_if = "Option::is_none")]
374    pub offer: Option<String>,
375    #[doc = "Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages)."]
376    #[serde(default, skip_serializing_if = "Option::is_none")]
377    pub sku: Option<String>,
378    #[doc = "Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). If 'latest' is specified here, the version is evaluated when the image build takes place, not when the template is submitted."]
379    #[serde(default, skip_serializing_if = "Option::is_none")]
380    pub version: Option<String>,
381    #[doc = "Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'."]
382    #[serde(rename = "exactVersion", default, skip_serializing_if = "Option::is_none")]
383    pub exact_version: Option<String>,
384    #[doc = "Purchase plan configuration for platform image."]
385    #[serde(rename = "planInfo", default, skip_serializing_if = "Option::is_none")]
386    pub plan_info: Option<PlatformImagePurchasePlan>,
387}
388impl ImageTemplatePlatformImageSource {
389    pub fn new() -> Self {
390        Self {
391            publisher: None,
392            offer: None,
393            sku: None,
394            version: None,
395            exact_version: None,
396            plan_info: None,
397        }
398    }
399}
400#[doc = "Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified."]
401#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
402pub struct ImageTemplatePowerShellCustomizer {
403    #[serde(flatten)]
404    pub image_template_customizer: ImageTemplateCustomizer,
405    #[doc = "URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc"]
406    #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")]
407    pub script_uri: Option<String>,
408    #[doc = "SHA256 checksum of the power shell script provided in the scriptUri field above"]
409    #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")]
410    pub sha256_checksum: Option<String>,
411    #[doc = "Array of PowerShell commands to execute"]
412    #[serde(
413        default,
414        deserialize_with = "azure_core::util::deserialize_null_as_default",
415        skip_serializing_if = "Vec::is_empty"
416    )]
417    pub inline: Vec<String>,
418    #[doc = "If specified, the PowerShell script will be run with elevated privileges"]
419    #[serde(rename = "runElevated", default, skip_serializing_if = "Option::is_none")]
420    pub run_elevated: Option<bool>,
421    #[doc = "If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true."]
422    #[serde(rename = "runAsSystem", default, skip_serializing_if = "Option::is_none")]
423    pub run_as_system: Option<bool>,
424    #[doc = "Valid exit codes for the PowerShell script. [Default: 0]"]
425    #[serde(
426        rename = "validExitCodes",
427        default,
428        deserialize_with = "azure_core::util::deserialize_null_as_default",
429        skip_serializing_if = "Vec::is_empty"
430    )]
431    pub valid_exit_codes: Vec<i32>,
432}
433impl ImageTemplatePowerShellCustomizer {
434    pub fn new(image_template_customizer: ImageTemplateCustomizer) -> Self {
435        Self {
436            image_template_customizer,
437            script_uri: None,
438            sha256_checksum: None,
439            inline: Vec::new(),
440            run_elevated: None,
441            run_as_system: None,
442            valid_exit_codes: Vec::new(),
443        }
444    }
445}
446#[doc = "Runs the specified PowerShell script during the validation phase (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified."]
447#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
448pub struct ImageTemplatePowerShellValidator {
449    #[serde(flatten)]
450    pub image_template_in_vm_validator: ImageTemplateInVmValidator,
451    #[doc = "URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc"]
452    #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")]
453    pub script_uri: Option<String>,
454    #[doc = "SHA256 checksum of the power shell script provided in the scriptUri field above"]
455    #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")]
456    pub sha256_checksum: Option<String>,
457    #[doc = "Array of PowerShell commands to execute"]
458    #[serde(
459        default,
460        deserialize_with = "azure_core::util::deserialize_null_as_default",
461        skip_serializing_if = "Vec::is_empty"
462    )]
463    pub inline: Vec<String>,
464    #[doc = "If specified, the PowerShell script will be run with elevated privileges"]
465    #[serde(rename = "runElevated", default, skip_serializing_if = "Option::is_none")]
466    pub run_elevated: Option<bool>,
467    #[doc = "If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true."]
468    #[serde(rename = "runAsSystem", default, skip_serializing_if = "Option::is_none")]
469    pub run_as_system: Option<bool>,
470    #[doc = "Valid exit codes for the PowerShell script. [Default: 0]"]
471    #[serde(
472        rename = "validExitCodes",
473        default,
474        deserialize_with = "azure_core::util::deserialize_null_as_default",
475        skip_serializing_if = "Vec::is_empty"
476    )]
477    pub valid_exit_codes: Vec<i32>,
478}
479impl ImageTemplatePowerShellValidator {
480    pub fn new(image_template_in_vm_validator: ImageTemplateInVmValidator) -> Self {
481        Self {
482            image_template_in_vm_validator,
483            script_uri: None,
484            sha256_checksum: None,
485            inline: Vec::new(),
486            run_elevated: None,
487            run_as_system: None,
488            valid_exit_codes: Vec::new(),
489        }
490    }
491}
492#[doc = "Describes the properties of an image template"]
493#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
494pub struct ImageTemplateProperties {
495    #[doc = "Describes a virtual machine image source for building, customizing and distributing"]
496    pub source: ImageTemplateSourceUnion,
497    #[doc = "Specifies the properties used to describe the customization steps of the image, like Image source etc"]
498    #[serde(
499        default,
500        deserialize_with = "azure_core::util::deserialize_null_as_default",
501        skip_serializing_if = "Vec::is_empty"
502    )]
503    pub customize: Vec<ImageTemplateCustomizerUnion>,
504    #[doc = "Specifies optimization to be performed on image."]
505    #[serde(default, skip_serializing_if = "Option::is_none")]
506    pub optimize: Option<image_template_properties::Optimize>,
507    #[doc = "Configuration options and list of validations to be performed on the resulting image."]
508    #[serde(default, skip_serializing_if = "Option::is_none")]
509    pub validate: Option<image_template_properties::Validate>,
510    #[doc = "The distribution targets where the image output needs to go to."]
511    pub distribute: Vec<ImageTemplateDistributorUnion>,
512    #[doc = "Error handling options upon a build failure"]
513    #[serde(rename = "errorHandling", default, skip_serializing_if = "Option::is_none")]
514    pub error_handling: Option<image_template_properties::ErrorHandling>,
515    #[doc = "Provisioning state of the resource"]
516    #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")]
517    pub provisioning_state: Option<ProvisioningState>,
518    #[doc = "Describes the error happened when create or update an image template"]
519    #[serde(rename = "provisioningError", default, skip_serializing_if = "Option::is_none")]
520    pub provisioning_error: Option<ProvisioningError>,
521    #[doc = "Describes the latest status of running an image template"]
522    #[serde(rename = "lastRunStatus", default, skip_serializing_if = "Option::is_none")]
523    pub last_run_status: Option<ImageTemplateLastRunStatus>,
524    #[doc = "Maximum duration to wait while building the image template (includes all customizations, optimization, validations, and distributions). Omit or specify 0 to use the default (4 hours)."]
525    #[serde(rename = "buildTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")]
526    pub build_timeout_in_minutes: Option<i32>,
527    #[doc = "Describes the virtual machines used to build and validate images"]
528    #[serde(rename = "vmProfile", default, skip_serializing_if = "Option::is_none")]
529    pub vm_profile: Option<ImageTemplateVmProfile>,
530    #[doc = "The staging resource group id in the same subscription as the image template that will be used to build the image. If this field is empty, a resource group with a random name will be created. If the resource group specified in this field doesn't exist, it will be created with the same name. If the resource group specified exists, it must be empty and in the same region as the image template. The resource group created will be deleted during template deletion if this field is empty or the resource group specified doesn't exist, but if the resource group specified exists the resources created in the resource group will be deleted during template deletion and the resource group itself will remain."]
531    #[serde(rename = "stagingResourceGroup", default, skip_serializing_if = "Option::is_none")]
532    pub staging_resource_group: Option<String>,
533    #[doc = "The staging resource group id in the same subscription as the image template that will be used to build the image. This read-only field differs from 'stagingResourceGroup' only if the value specified in the 'stagingResourceGroup' field is empty."]
534    #[serde(rename = "exactStagingResourceGroup", default, skip_serializing_if = "Option::is_none")]
535    pub exact_staging_resource_group: Option<String>,
536}
537impl ImageTemplateProperties {
538    pub fn new(source: ImageTemplateSourceUnion, distribute: Vec<ImageTemplateDistributorUnion>) -> Self {
539        Self {
540            source,
541            customize: Vec::new(),
542            optimize: None,
543            validate: None,
544            distribute,
545            error_handling: None,
546            provisioning_state: None,
547            provisioning_error: None,
548            last_run_status: None,
549            build_timeout_in_minutes: None,
550            vm_profile: None,
551            staging_resource_group: None,
552            exact_staging_resource_group: None,
553        }
554    }
555}
556pub mod image_template_properties {
557    use super::*;
558    #[doc = "Specifies optimization to be performed on image."]
559    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
560    pub struct Optimize {
561        #[doc = "Optimization is applied on the image for a faster VM boot."]
562        #[serde(rename = "vmBoot", default, skip_serializing_if = "Option::is_none")]
563        pub vm_boot: Option<optimize::VmBoot>,
564    }
565    impl Optimize {
566        pub fn new() -> Self {
567            Self::default()
568        }
569    }
570    pub mod optimize {
571        use super::*;
572        #[doc = "Optimization is applied on the image for a faster VM boot."]
573        #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
574        pub struct VmBoot {
575            #[doc = "Enabling this field will improve VM boot time by optimizing the final customized image output."]
576            #[serde(default, skip_serializing_if = "Option::is_none")]
577            pub state: Option<vm_boot::State>,
578        }
579        impl VmBoot {
580            pub fn new() -> Self {
581                Self::default()
582            }
583        }
584        pub mod vm_boot {
585            use super::*;
586            #[doc = "Enabling this field will improve VM boot time by optimizing the final customized image output."]
587            #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
588            pub enum State {
589                Enabled,
590                Disabled,
591            }
592        }
593    }
594    #[doc = "Configuration options and list of validations to be performed on the resulting image."]
595    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
596    pub struct Validate {
597        #[doc = "If validation fails and this field is set to false, output image(s) will not be distributed. This is the default behavior. If validation fails and this field is set to true, output image(s) will still be distributed. Please use this option with caution as it may result in bad images being distributed for use. In either case (true or false), the end to end image run will be reported as having failed in case of a validation failure. [Note: This field has no effect if validation succeeds.]"]
598        #[serde(rename = "continueDistributeOnFailure", default, skip_serializing_if = "Option::is_none")]
599        pub continue_distribute_on_failure: Option<bool>,
600        #[doc = "If this field is set to true, the image specified in the 'source' section will directly be validated. No separate build will be run to generate and then validate a customized image."]
601        #[serde(rename = "sourceValidationOnly", default, skip_serializing_if = "Option::is_none")]
602        pub source_validation_only: Option<bool>,
603        #[doc = "List of validations to be performed."]
604        #[serde(
605            rename = "inVMValidations",
606            default,
607            deserialize_with = "azure_core::util::deserialize_null_as_default",
608            skip_serializing_if = "Vec::is_empty"
609        )]
610        pub in_vm_validations: Vec<ImageTemplateInVmValidatorUnion>,
611    }
612    impl Validate {
613        pub fn new() -> Self {
614            Self::default()
615        }
616    }
617    #[doc = "Error handling options upon a build failure"]
618    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
619    pub struct ErrorHandling {
620        #[doc = "Error handling behavior upon build failure"]
621        #[serde(rename = "onCustomizerError", default, skip_serializing_if = "Option::is_none")]
622        pub on_customizer_error: Option<OnBuildError>,
623        #[doc = "Error handling behavior upon build failure"]
624        #[serde(rename = "onValidationError", default, skip_serializing_if = "Option::is_none")]
625        pub on_validation_error: Option<OnBuildError>,
626    }
627    impl ErrorHandling {
628        pub fn new() -> Self {
629            Self::default()
630        }
631    }
632}
633#[doc = "Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner"]
634#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
635pub struct ImageTemplateRestartCustomizer {
636    #[serde(flatten)]
637    pub image_template_customizer: ImageTemplateCustomizer,
638    #[doc = "Command to execute the restart [Default: 'shutdown /r /f /t 0 /c \"packer restart\"']"]
639    #[serde(rename = "restartCommand", default, skip_serializing_if = "Option::is_none")]
640    pub restart_command: Option<String>,
641    #[doc = "Command to check if restart succeeded [Default: '']"]
642    #[serde(rename = "restartCheckCommand", default, skip_serializing_if = "Option::is_none")]
643    pub restart_check_command: Option<String>,
644    #[doc = "Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']"]
645    #[serde(rename = "restartTimeout", default, skip_serializing_if = "Option::is_none")]
646    pub restart_timeout: Option<String>,
647}
648impl ImageTemplateRestartCustomizer {
649    pub fn new(image_template_customizer: ImageTemplateCustomizer) -> Self {
650        Self {
651            image_template_customizer,
652            restart_command: None,
653            restart_check_command: None,
654            restart_timeout: None,
655        }
656    }
657}
658#[doc = "Distribute via Azure Compute Gallery."]
659#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
660pub struct ImageTemplateSharedImageDistributor {
661    #[serde(flatten)]
662    pub image_template_distributor: ImageTemplateDistributor,
663    #[doc = "Resource Id of the Azure Compute Gallery image"]
664    #[serde(rename = "galleryImageId")]
665    pub gallery_image_id: String,
666    #[doc = "[Deprecated] A list of regions that the image will be replicated to. This list can be specified only if targetRegions is not specified. This field is deprecated - use targetRegions instead."]
667    #[serde(
668        rename = "replicationRegions",
669        default,
670        deserialize_with = "azure_core::util::deserialize_null_as_default",
671        skip_serializing_if = "Vec::is_empty"
672    )]
673    pub replication_regions: Vec<String>,
674    #[doc = "Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false)."]
675    #[serde(rename = "excludeFromLatest", default, skip_serializing_if = "Option::is_none")]
676    pub exclude_from_latest: Option<bool>,
677    #[doc = "Specifies the storage account type to be used to store the Azure Compute Gallery image version in."]
678    #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")]
679    pub storage_account_type: Option<SharedImageStorageAccountType>,
680    #[doc = "The target regions where the distributed Image Version is going to be replicated to. This object supersedes replicationRegions and can be specified only if replicationRegions is not specified."]
681    #[serde(
682        rename = "targetRegions",
683        default,
684        deserialize_with = "azure_core::util::deserialize_null_as_default",
685        skip_serializing_if = "Vec::is_empty"
686    )]
687    pub target_regions: Vec<TargetRegion>,
688    #[doc = "Describes how to generate new x.y.z version number for distribution."]
689    #[serde(default, skip_serializing_if = "Option::is_none")]
690    pub versioning: Option<DistributeVersionerUnion>,
691}
692impl ImageTemplateSharedImageDistributor {
693    pub fn new(image_template_distributor: ImageTemplateDistributor, gallery_image_id: String) -> Self {
694        Self {
695            image_template_distributor,
696            gallery_image_id,
697            replication_regions: Vec::new(),
698            exclude_from_latest: None,
699            storage_account_type: None,
700            target_regions: Vec::new(),
701            versioning: None,
702        }
703    }
704}
705#[doc = "Describes an image source that is an image version in an Azure Compute Gallery or a Direct Shared Gallery."]
706#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
707pub struct ImageTemplateSharedImageVersionSource {
708    #[doc = "ARM resource id of the image version. When image version name is 'latest', the version is evaluated when the image build takes place."]
709    #[serde(rename = "imageVersionId")]
710    pub image_version_id: String,
711    #[doc = "Exact ARM resource id of the image version. This readonly field differs from the image version Id in 'imageVersionId' only if the version name specified in 'imageVersionId' field is 'latest'."]
712    #[serde(rename = "exactVersion", default, skip_serializing_if = "Option::is_none")]
713    pub exact_version: Option<String>,
714}
715impl ImageTemplateSharedImageVersionSource {
716    pub fn new(image_version_id: String) -> Self {
717        Self {
718            image_version_id,
719            exact_version: None,
720        }
721    }
722}
723#[doc = "Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified."]
724#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
725pub struct ImageTemplateShellCustomizer {
726    #[serde(flatten)]
727    pub image_template_customizer: ImageTemplateCustomizer,
728    #[doc = "URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc"]
729    #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")]
730    pub script_uri: Option<String>,
731    #[doc = "SHA256 checksum of the shell script provided in the scriptUri field"]
732    #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")]
733    pub sha256_checksum: Option<String>,
734    #[doc = "Array of shell commands to execute"]
735    #[serde(
736        default,
737        deserialize_with = "azure_core::util::deserialize_null_as_default",
738        skip_serializing_if = "Vec::is_empty"
739    )]
740    pub inline: Vec<String>,
741}
742impl ImageTemplateShellCustomizer {
743    pub fn new(image_template_customizer: ImageTemplateCustomizer) -> Self {
744        Self {
745            image_template_customizer,
746            script_uri: None,
747            sha256_checksum: None,
748            inline: Vec::new(),
749        }
750    }
751}
752#[doc = "Runs the specified shell script during the validation phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified."]
753#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
754pub struct ImageTemplateShellValidator {
755    #[serde(flatten)]
756    pub image_template_in_vm_validator: ImageTemplateInVmValidator,
757    #[doc = "URI of the shell script to be run for validation. It can be a github link, Azure Storage URI, etc"]
758    #[serde(rename = "scriptUri", default, skip_serializing_if = "Option::is_none")]
759    pub script_uri: Option<String>,
760    #[doc = "SHA256 checksum of the shell script provided in the scriptUri field"]
761    #[serde(rename = "sha256Checksum", default, skip_serializing_if = "Option::is_none")]
762    pub sha256_checksum: Option<String>,
763    #[doc = "Array of shell commands to execute"]
764    #[serde(
765        default,
766        deserialize_with = "azure_core::util::deserialize_null_as_default",
767        skip_serializing_if = "Vec::is_empty"
768    )]
769    pub inline: Vec<String>,
770}
771impl ImageTemplateShellValidator {
772    pub fn new(image_template_in_vm_validator: ImageTemplateInVmValidator) -> Self {
773        Self {
774            image_template_in_vm_validator,
775            script_uri: None,
776            sha256_checksum: None,
777            inline: Vec::new(),
778        }
779    }
780}
781#[doc = "Specifies the type of source image you want to start with."]
782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
783#[serde(tag = "type")]
784pub enum ImageTemplateSourceUnion {
785    ManagedImage(ImageTemplateManagedImageSource),
786    PlatformImage(ImageTemplatePlatformImageSource),
787    SharedImageVersion(ImageTemplateSharedImageVersionSource),
788}
789#[doc = "Parameters for updating an image template."]
790#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
791pub struct ImageTemplateUpdateParameters {
792    #[doc = "Identity for the image template."]
793    #[serde(default, skip_serializing_if = "Option::is_none")]
794    pub identity: Option<ImageTemplateIdentity>,
795    #[doc = "The user-specified tags associated with the image template."]
796    #[serde(default, skip_serializing_if = "Option::is_none")]
797    pub tags: Option<serde_json::Value>,
798    #[doc = "Parameters for updating an image template."]
799    #[serde(default, skip_serializing_if = "Option::is_none")]
800    pub properties: Option<image_template_update_parameters::Properties>,
801}
802impl ImageTemplateUpdateParameters {
803    pub fn new() -> Self {
804        Self::default()
805    }
806}
807pub mod image_template_update_parameters {
808    use super::*;
809    #[doc = "Parameters for updating an image template."]
810    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
811    pub struct Properties {
812        #[doc = "The distribution targets where the image output needs to go to."]
813        #[serde(
814            default,
815            deserialize_with = "azure_core::util::deserialize_null_as_default",
816            skip_serializing_if = "Vec::is_empty"
817        )]
818        pub distribute: Vec<ImageTemplateDistributorUnion>,
819    }
820    impl Properties {
821        pub fn new() -> Self {
822            Self::default()
823        }
824    }
825}
826#[doc = "Distribute via VHD in a storage account."]
827#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
828pub struct ImageTemplateVhdDistributor {
829    #[serde(flatten)]
830    pub image_template_distributor: ImageTemplateDistributor,
831    #[doc = "Optional Azure Storage URI for the distributed VHD blob. Omit to use the default (empty string) in which case VHD would be published to the storage account in the staging resource group."]
832    #[serde(default, skip_serializing_if = "Option::is_none")]
833    pub uri: Option<String>,
834}
835impl ImageTemplateVhdDistributor {
836    pub fn new(image_template_distributor: ImageTemplateDistributor) -> Self {
837        Self {
838            image_template_distributor,
839            uri: None,
840        }
841    }
842}
843#[doc = "Describes the virtual machines used to build and validate images"]
844#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
845pub struct ImageTemplateVmProfile {
846    #[doc = "Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2 images)."]
847    #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")]
848    pub vm_size: Option<String>,
849    #[doc = "Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size."]
850    #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")]
851    pub os_disk_size_gb: Option<i32>,
852    #[doc = "Optional array of resource IDs of user assigned managed identities to be configured on the build VM and validation VM. This may include the identity of the image template."]
853    #[serde(
854        rename = "userAssignedIdentities",
855        default,
856        deserialize_with = "azure_core::util::deserialize_null_as_default",
857        skip_serializing_if = "Vec::is_empty"
858    )]
859    pub user_assigned_identities: Vec<String>,
860    #[doc = "Virtual Network configuration."]
861    #[serde(rename = "vnetConfig", default, skip_serializing_if = "Option::is_none")]
862    pub vnet_config: Option<VirtualNetworkConfig>,
863}
864impl ImageTemplateVmProfile {
865    pub fn new() -> Self {
866        Self::default()
867    }
868}
869#[doc = "Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update)"]
870#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
871pub struct ImageTemplateWindowsUpdateCustomizer {
872    #[serde(flatten)]
873    pub image_template_customizer: ImageTemplateCustomizer,
874    #[doc = "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."]
875    #[serde(rename = "searchCriteria", default, skip_serializing_if = "Option::is_none")]
876    pub search_criteria: Option<String>,
877    #[doc = "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."]
878    #[serde(
879        default,
880        deserialize_with = "azure_core::util::deserialize_null_as_default",
881        skip_serializing_if = "Vec::is_empty"
882    )]
883    pub filters: Vec<String>,
884    #[doc = "Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000)"]
885    #[serde(rename = "updateLimit", default, skip_serializing_if = "Option::is_none")]
886    pub update_limit: Option<i32>,
887}
888impl ImageTemplateWindowsUpdateCustomizer {
889    pub fn new(image_template_customizer: ImageTemplateCustomizer) -> Self {
890        Self {
891            image_template_customizer,
892            search_criteria: None,
893            filters: Vec::new(),
894            update_limit: None,
895        }
896    }
897}
898#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
899pub struct Operation {
900    #[doc = "This is of the format {provider}/{resource}/{operation}"]
901    #[serde(default, skip_serializing_if = "Option::is_none")]
902    pub name: Option<String>,
903    #[serde(default, skip_serializing_if = "Option::is_none")]
904    pub display: Option<operation::Display>,
905    #[serde(default, skip_serializing_if = "Option::is_none")]
906    pub origin: Option<String>,
907    #[serde(default, skip_serializing_if = "Option::is_none")]
908    pub properties: Option<serde_json::Value>,
909    #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")]
910    pub is_data_action: Option<bool>,
911}
912impl Operation {
913    pub fn new() -> Self {
914        Self::default()
915    }
916}
917pub mod operation {
918    use super::*;
919    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
920    pub struct Display {
921        #[serde(default, skip_serializing_if = "Option::is_none")]
922        pub provider: Option<String>,
923        #[doc = "For example: read, write, delete, or listKeys/action"]
924        #[serde(default, skip_serializing_if = "Option::is_none")]
925        pub operation: Option<String>,
926        #[serde(default, skip_serializing_if = "Option::is_none")]
927        pub resource: Option<String>,
928        #[serde(default, skip_serializing_if = "Option::is_none")]
929        pub description: Option<String>,
930    }
931    impl Display {
932        pub fn new() -> Self {
933            Self::default()
934        }
935    }
936}
937#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
938pub struct OperationListResult {
939    #[serde(
940        default,
941        deserialize_with = "azure_core::util::deserialize_null_as_default",
942        skip_serializing_if = "Vec::is_empty"
943    )]
944    pub value: Vec<Operation>,
945    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
946    pub next_link: Option<String>,
947}
948impl azure_core::Continuable for OperationListResult {
949    type Continuation = String;
950    fn continuation(&self) -> Option<Self::Continuation> {
951        self.next_link.clone().filter(|value| !value.is_empty())
952    }
953}
954impl OperationListResult {
955    pub fn new() -> Self {
956        Self::default()
957    }
958}
959#[doc = "Purchase plan configuration for platform image."]
960#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
961pub struct PlatformImagePurchasePlan {
962    #[doc = "Name of the purchase plan."]
963    #[serde(rename = "planName")]
964    pub plan_name: String,
965    #[doc = "Product of the purchase plan."]
966    #[serde(rename = "planProduct")]
967    pub plan_product: String,
968    #[doc = "Publisher of the purchase plan."]
969    #[serde(rename = "planPublisher")]
970    pub plan_publisher: String,
971}
972impl PlatformImagePurchasePlan {
973    pub fn new(plan_name: String, plan_product: String, plan_publisher: String) -> Self {
974        Self {
975            plan_name,
976            plan_product,
977            plan_publisher,
978        }
979    }
980}
981#[doc = "Describes the error happened when create or update an image template"]
982#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
983pub struct ProvisioningError {
984    #[doc = "Error code of the provisioning failure"]
985    #[serde(rename = "provisioningErrorCode", default, skip_serializing_if = "Option::is_none")]
986    pub provisioning_error_code: Option<provisioning_error::ProvisioningErrorCode>,
987    #[doc = "Verbose error message about the provisioning failure"]
988    #[serde(default, skip_serializing_if = "Option::is_none")]
989    pub message: Option<String>,
990}
991impl ProvisioningError {
992    pub fn new() -> Self {
993        Self::default()
994    }
995}
996pub mod provisioning_error {
997    use super::*;
998    #[doc = "Error code of the provisioning failure"]
999    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1000    #[serde(remote = "ProvisioningErrorCode")]
1001    pub enum ProvisioningErrorCode {
1002        BadSourceType,
1003        #[serde(rename = "BadPIRSource")]
1004        BadPirSource,
1005        BadManagedImageSource,
1006        BadSharedImageVersionSource,
1007        BadCustomizerType,
1008        UnsupportedCustomizerType,
1009        NoCustomizerScript,
1010        BadValidatorType,
1011        UnsupportedValidatorType,
1012        NoValidatorScript,
1013        BadDistributeType,
1014        BadSharedImageDistribute,
1015        BadStagingResourceGroup,
1016        ServerError,
1017        Other,
1018        #[serde(skip_deserializing)]
1019        UnknownValue(String),
1020    }
1021    impl FromStr for ProvisioningErrorCode {
1022        type Err = value::Error;
1023        fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1024            Self::deserialize(s.into_deserializer())
1025        }
1026    }
1027    impl<'de> Deserialize<'de> for ProvisioningErrorCode {
1028        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1029        where
1030            D: Deserializer<'de>,
1031        {
1032            let s = String::deserialize(deserializer)?;
1033            let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
1034            Ok(deserialized)
1035        }
1036    }
1037    impl Serialize for ProvisioningErrorCode {
1038        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1039        where
1040            S: Serializer,
1041        {
1042            match self {
1043                Self::BadSourceType => serializer.serialize_unit_variant("ProvisioningErrorCode", 0u32, "BadSourceType"),
1044                Self::BadPirSource => serializer.serialize_unit_variant("ProvisioningErrorCode", 1u32, "BadPIRSource"),
1045                Self::BadManagedImageSource => serializer.serialize_unit_variant("ProvisioningErrorCode", 2u32, "BadManagedImageSource"),
1046                Self::BadSharedImageVersionSource => {
1047                    serializer.serialize_unit_variant("ProvisioningErrorCode", 3u32, "BadSharedImageVersionSource")
1048                }
1049                Self::BadCustomizerType => serializer.serialize_unit_variant("ProvisioningErrorCode", 4u32, "BadCustomizerType"),
1050                Self::UnsupportedCustomizerType => {
1051                    serializer.serialize_unit_variant("ProvisioningErrorCode", 5u32, "UnsupportedCustomizerType")
1052                }
1053                Self::NoCustomizerScript => serializer.serialize_unit_variant("ProvisioningErrorCode", 6u32, "NoCustomizerScript"),
1054                Self::BadValidatorType => serializer.serialize_unit_variant("ProvisioningErrorCode", 7u32, "BadValidatorType"),
1055                Self::UnsupportedValidatorType => {
1056                    serializer.serialize_unit_variant("ProvisioningErrorCode", 8u32, "UnsupportedValidatorType")
1057                }
1058                Self::NoValidatorScript => serializer.serialize_unit_variant("ProvisioningErrorCode", 9u32, "NoValidatorScript"),
1059                Self::BadDistributeType => serializer.serialize_unit_variant("ProvisioningErrorCode", 10u32, "BadDistributeType"),
1060                Self::BadSharedImageDistribute => {
1061                    serializer.serialize_unit_variant("ProvisioningErrorCode", 11u32, "BadSharedImageDistribute")
1062                }
1063                Self::BadStagingResourceGroup => {
1064                    serializer.serialize_unit_variant("ProvisioningErrorCode", 12u32, "BadStagingResourceGroup")
1065                }
1066                Self::ServerError => serializer.serialize_unit_variant("ProvisioningErrorCode", 13u32, "ServerError"),
1067                Self::Other => serializer.serialize_unit_variant("ProvisioningErrorCode", 14u32, "Other"),
1068                Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
1069            }
1070        }
1071    }
1072}
1073#[doc = "Provisioning state of the resource"]
1074#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1075pub enum ProvisioningState {
1076    Creating,
1077    Updating,
1078    Succeeded,
1079    Failed,
1080    Deleting,
1081    Canceled,
1082}
1083#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"]
1084#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1085pub struct ProxyResource {
1086    #[serde(flatten)]
1087    pub resource: Resource,
1088}
1089impl ProxyResource {
1090    pub fn new() -> Self {
1091        Self::default()
1092    }
1093}
1094#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"]
1095#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1096pub struct Resource {
1097    #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"]
1098    #[serde(default, skip_serializing_if = "Option::is_none")]
1099    pub id: Option<String>,
1100    #[doc = "The name of the resource"]
1101    #[serde(default, skip_serializing_if = "Option::is_none")]
1102    pub name: Option<String>,
1103    #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""]
1104    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
1105    pub type_: Option<String>,
1106    #[doc = "Metadata pertaining to creation and last modification of the resource."]
1107    #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")]
1108    pub system_data: Option<SystemData>,
1109}
1110impl Resource {
1111    pub fn new() -> Self {
1112        Self::default()
1113    }
1114}
1115#[doc = "Represents an output that was created by running an image template."]
1116#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1117pub struct RunOutput {
1118    #[serde(flatten)]
1119    pub proxy_resource: ProxyResource,
1120    #[doc = "Describes the properties of a run output"]
1121    #[serde(default, skip_serializing_if = "Option::is_none")]
1122    pub properties: Option<RunOutputProperties>,
1123}
1124impl RunOutput {
1125    pub fn new() -> Self {
1126        Self::default()
1127    }
1128}
1129#[doc = "The result of List run outputs operation"]
1130#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1131pub struct RunOutputCollection {
1132    #[doc = "An array of run outputs"]
1133    #[serde(
1134        default,
1135        deserialize_with = "azure_core::util::deserialize_null_as_default",
1136        skip_serializing_if = "Vec::is_empty"
1137    )]
1138    pub value: Vec<RunOutput>,
1139    #[doc = "The continuation token."]
1140    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
1141    pub next_link: Option<String>,
1142}
1143impl azure_core::Continuable for RunOutputCollection {
1144    type Continuation = String;
1145    fn continuation(&self) -> Option<Self::Continuation> {
1146        self.next_link.clone().filter(|value| !value.is_empty())
1147    }
1148}
1149impl RunOutputCollection {
1150    pub fn new() -> Self {
1151        Self::default()
1152    }
1153}
1154#[doc = "Describes the properties of a run output"]
1155#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1156pub struct RunOutputProperties {
1157    #[doc = "The resource id of the artifact."]
1158    #[serde(rename = "artifactId", default, skip_serializing_if = "Option::is_none")]
1159    pub artifact_id: Option<String>,
1160    #[doc = "The location URI of the artifact."]
1161    #[serde(rename = "artifactUri", default, skip_serializing_if = "Option::is_none")]
1162    pub artifact_uri: Option<String>,
1163    #[doc = "Provisioning state of the resource"]
1164    #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")]
1165    pub provisioning_state: Option<ProvisioningState>,
1166}
1167impl RunOutputProperties {
1168    pub fn new() -> Self {
1169        Self::default()
1170    }
1171}
1172#[doc = "Specifies the storage account type to be used to store the Azure Compute Gallery image version in."]
1173#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1174#[serde(remote = "SharedImageStorageAccountType")]
1175pub enum SharedImageStorageAccountType {
1176    #[serde(rename = "Standard_LRS")]
1177    StandardLrs,
1178    #[serde(rename = "Standard_ZRS")]
1179    StandardZrs,
1180    #[serde(rename = "Premium_LRS")]
1181    PremiumLrs,
1182    #[serde(skip_deserializing)]
1183    UnknownValue(String),
1184}
1185impl FromStr for SharedImageStorageAccountType {
1186    type Err = value::Error;
1187    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1188        Self::deserialize(s.into_deserializer())
1189    }
1190}
1191impl<'de> Deserialize<'de> for SharedImageStorageAccountType {
1192    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1193    where
1194        D: Deserializer<'de>,
1195    {
1196        let s = String::deserialize(deserializer)?;
1197        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
1198        Ok(deserialized)
1199    }
1200}
1201impl Serialize for SharedImageStorageAccountType {
1202    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1203    where
1204        S: Serializer,
1205    {
1206        match self {
1207            Self::StandardLrs => serializer.serialize_unit_variant("SharedImageStorageAccountType", 0u32, "Standard_LRS"),
1208            Self::StandardZrs => serializer.serialize_unit_variant("SharedImageStorageAccountType", 1u32, "Standard_ZRS"),
1209            Self::PremiumLrs => serializer.serialize_unit_variant("SharedImageStorageAccountType", 2u32, "Premium_LRS"),
1210            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
1211        }
1212    }
1213}
1214#[doc = "Properties of SourceImage kind of trigger"]
1215#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1216pub struct SourceImageTriggerProperties {
1217    #[serde(flatten)]
1218    pub trigger_properties: TriggerProperties,
1219}
1220impl SourceImageTriggerProperties {
1221    pub fn new(trigger_properties: TriggerProperties) -> Self {
1222        Self { trigger_properties }
1223    }
1224}
1225#[doc = "Describes the target region information."]
1226#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1227pub struct TargetRegion {
1228    #[doc = "The name of the region."]
1229    pub name: String,
1230    #[doc = "The number of replicas of the Image Version to be created in this region. Omit to use the default (1)."]
1231    #[serde(rename = "replicaCount", default, skip_serializing_if = "Option::is_none")]
1232    pub replica_count: Option<i32>,
1233    #[doc = "Specifies the storage account type to be used to store the Azure Compute Gallery image version in."]
1234    #[serde(rename = "storageAccountType", default, skip_serializing_if = "Option::is_none")]
1235    pub storage_account_type: Option<SharedImageStorageAccountType>,
1236}
1237impl TargetRegion {
1238    pub fn new(name: String) -> Self {
1239        Self {
1240            name,
1241            replica_count: None,
1242            storage_account_type: None,
1243        }
1244    }
1245}
1246#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"]
1247#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1248pub struct TrackedResource {
1249    #[serde(flatten)]
1250    pub resource: Resource,
1251    #[doc = "Resource tags."]
1252    #[serde(default, skip_serializing_if = "Option::is_none")]
1253    pub tags: Option<serde_json::Value>,
1254    #[doc = "The geo-location where the resource lives"]
1255    pub location: String,
1256}
1257impl TrackedResource {
1258    pub fn new(location: String) -> Self {
1259        Self {
1260            resource: Resource::default(),
1261            tags: None,
1262            location,
1263        }
1264    }
1265}
1266#[doc = "Represents a trigger that can invoke an image template build."]
1267#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1268pub struct Trigger {
1269    #[serde(flatten)]
1270    pub proxy_resource: ProxyResource,
1271    #[doc = "Describes the properties of a trigger"]
1272    #[serde(default, skip_serializing_if = "Option::is_none")]
1273    pub properties: Option<TriggerPropertiesUnion>,
1274}
1275impl Trigger {
1276    pub fn new() -> Self {
1277        Self::default()
1278    }
1279}
1280#[doc = "The result of List triggers operation"]
1281#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1282pub struct TriggerCollection {
1283    #[doc = "An array of triggers"]
1284    pub value: Vec<Trigger>,
1285    #[doc = "The continuation token."]
1286    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
1287    pub next_link: Option<String>,
1288}
1289impl azure_core::Continuable for TriggerCollection {
1290    type Continuation = String;
1291    fn continuation(&self) -> Option<Self::Continuation> {
1292        self.next_link.clone().filter(|value| !value.is_empty())
1293    }
1294}
1295impl TriggerCollection {
1296    pub fn new(value: Vec<Trigger>) -> Self {
1297        Self { value, next_link: None }
1298    }
1299}
1300#[doc = "Describes the properties of a trigger"]
1301#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1302pub struct TriggerProperties {
1303    #[doc = "Describes the status of a trigger"]
1304    #[serde(default, skip_serializing_if = "Option::is_none")]
1305    pub status: Option<TriggerStatus>,
1306    #[doc = "Provisioning state of the resource"]
1307    #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")]
1308    pub provisioning_state: Option<ProvisioningState>,
1309}
1310impl TriggerProperties {
1311    pub fn new() -> Self {
1312        Self {
1313            status: None,
1314            provisioning_state: None,
1315        }
1316    }
1317}
1318#[doc = "The kind of trigger."]
1319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1320#[serde(tag = "kind")]
1321pub enum TriggerPropertiesUnion {
1322    SourceImage(SourceImageTriggerProperties),
1323}
1324#[doc = "Describes the status of a trigger"]
1325#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1326pub struct TriggerStatus {
1327    #[doc = "The status code."]
1328    #[serde(default, skip_serializing_if = "Option::is_none")]
1329    pub code: Option<String>,
1330    #[doc = "The detailed status message, including for alerts and error messages."]
1331    #[serde(default, skip_serializing_if = "Option::is_none")]
1332    pub message: Option<String>,
1333    #[doc = "The time of the status."]
1334    #[serde(default, with = "azure_core::date::rfc3339::option")]
1335    pub time: Option<::time::OffsetDateTime>,
1336}
1337impl TriggerStatus {
1338    pub fn new() -> Self {
1339        Self::default()
1340    }
1341}
1342#[doc = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests."]
1343#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1344pub struct UserAssignedIdentities {}
1345impl UserAssignedIdentities {
1346    pub fn new() -> Self {
1347        Self::default()
1348    }
1349}
1350#[doc = "User assigned identity properties"]
1351#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1352pub struct UserAssignedIdentity {
1353    #[doc = "The principal ID of the assigned identity."]
1354    #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")]
1355    pub principal_id: Option<String>,
1356    #[doc = "The client ID of the assigned identity."]
1357    #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")]
1358    pub client_id: Option<String>,
1359}
1360impl UserAssignedIdentity {
1361    pub fn new() -> Self {
1362        Self::default()
1363    }
1364}
1365#[doc = "Virtual Network configuration."]
1366#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1367pub struct VirtualNetworkConfig {
1368    #[doc = "Resource id of a pre-existing subnet."]
1369    #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")]
1370    pub subnet_id: Option<String>,
1371    #[doc = "Size of the proxy virtual machine used to pass traffic to the build VM and validation VM. Omit or specify empty string to use the default (Standard_A1_v2)."]
1372    #[serde(rename = "proxyVmSize", default, skip_serializing_if = "Option::is_none")]
1373    pub proxy_vm_size: Option<String>,
1374}
1375impl VirtualNetworkConfig {
1376    pub fn new() -> Self {
1377        Self::default()
1378    }
1379}
1380#[doc = "Error handling behavior upon build failure"]
1381#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1382#[serde(remote = "OnBuildError")]
1383pub enum OnBuildError {
1384    #[serde(rename = "cleanup")]
1385    Cleanup,
1386    #[serde(rename = "abort")]
1387    Abort,
1388    #[serde(skip_deserializing)]
1389    UnknownValue(String),
1390}
1391impl FromStr for OnBuildError {
1392    type Err = value::Error;
1393    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1394        Self::deserialize(s.into_deserializer())
1395    }
1396}
1397impl<'de> Deserialize<'de> for OnBuildError {
1398    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1399    where
1400        D: Deserializer<'de>,
1401    {
1402        let s = String::deserialize(deserializer)?;
1403        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
1404        Ok(deserialized)
1405    }
1406}
1407impl Serialize for OnBuildError {
1408    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1409    where
1410        S: Serializer,
1411    {
1412        match self {
1413            Self::Cleanup => serializer.serialize_unit_variant("OnBuildError", 0u32, "cleanup"),
1414            Self::Abort => serializer.serialize_unit_variant("OnBuildError", 1u32, "abort"),
1415            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
1416        }
1417    }
1418}
1419#[doc = "Metadata pertaining to creation and last modification of the resource."]
1420#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
1421pub struct SystemData {
1422    #[doc = "The identity that created the resource."]
1423    #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")]
1424    pub created_by: Option<String>,
1425    #[doc = "The type of identity that created the resource."]
1426    #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")]
1427    pub created_by_type: Option<system_data::CreatedByType>,
1428    #[doc = "The timestamp of resource creation (UTC)."]
1429    #[serde(rename = "createdAt", default, with = "azure_core::date::rfc3339::option")]
1430    pub created_at: Option<::time::OffsetDateTime>,
1431    #[doc = "The identity that last modified the resource."]
1432    #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")]
1433    pub last_modified_by: Option<String>,
1434    #[doc = "The type of identity that last modified the resource."]
1435    #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")]
1436    pub last_modified_by_type: Option<system_data::LastModifiedByType>,
1437    #[doc = "The timestamp of resource last modification (UTC)"]
1438    #[serde(rename = "lastModifiedAt", default, with = "azure_core::date::rfc3339::option")]
1439    pub last_modified_at: Option<::time::OffsetDateTime>,
1440}
1441impl SystemData {
1442    pub fn new() -> Self {
1443        Self::default()
1444    }
1445}
1446pub mod system_data {
1447    use super::*;
1448    #[doc = "The type of identity that created the resource."]
1449    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1450    #[serde(remote = "CreatedByType")]
1451    pub enum CreatedByType {
1452        User,
1453        Application,
1454        ManagedIdentity,
1455        Key,
1456        #[serde(skip_deserializing)]
1457        UnknownValue(String),
1458    }
1459    impl FromStr for CreatedByType {
1460        type Err = value::Error;
1461        fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1462            Self::deserialize(s.into_deserializer())
1463        }
1464    }
1465    impl<'de> Deserialize<'de> for CreatedByType {
1466        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1467        where
1468            D: Deserializer<'de>,
1469        {
1470            let s = String::deserialize(deserializer)?;
1471            let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
1472            Ok(deserialized)
1473        }
1474    }
1475    impl Serialize for CreatedByType {
1476        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1477        where
1478            S: Serializer,
1479        {
1480            match self {
1481                Self::User => serializer.serialize_unit_variant("CreatedByType", 0u32, "User"),
1482                Self::Application => serializer.serialize_unit_variant("CreatedByType", 1u32, "Application"),
1483                Self::ManagedIdentity => serializer.serialize_unit_variant("CreatedByType", 2u32, "ManagedIdentity"),
1484                Self::Key => serializer.serialize_unit_variant("CreatedByType", 3u32, "Key"),
1485                Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
1486            }
1487        }
1488    }
1489    #[doc = "The type of identity that last modified the resource."]
1490    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1491    #[serde(remote = "LastModifiedByType")]
1492    pub enum LastModifiedByType {
1493        User,
1494        Application,
1495        ManagedIdentity,
1496        Key,
1497        #[serde(skip_deserializing)]
1498        UnknownValue(String),
1499    }
1500    impl FromStr for LastModifiedByType {
1501        type Err = value::Error;
1502        fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1503            Self::deserialize(s.into_deserializer())
1504        }
1505    }
1506    impl<'de> Deserialize<'de> for LastModifiedByType {
1507        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1508        where
1509            D: Deserializer<'de>,
1510        {
1511            let s = String::deserialize(deserializer)?;
1512            let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
1513            Ok(deserialized)
1514        }
1515    }
1516    impl Serialize for LastModifiedByType {
1517        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1518        where
1519            S: Serializer,
1520        {
1521            match self {
1522                Self::User => serializer.serialize_unit_variant("LastModifiedByType", 0u32, "User"),
1523                Self::Application => serializer.serialize_unit_variant("LastModifiedByType", 1u32, "Application"),
1524                Self::ManagedIdentity => serializer.serialize_unit_variant("LastModifiedByType", 2u32, "ManagedIdentity"),
1525                Self::Key => serializer.serialize_unit_variant("LastModifiedByType", 3u32, "Key"),
1526                Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
1527            }
1528        }
1529    }
1530}