outscale_api/models/
create_vms_request.rs

1/*
2 * 3DS OUTSCALE API
3 *
4 * Welcome to the OUTSCALE API documentation.<br /> The OUTSCALE API enables you to manage your resources in the OUTSCALE Cloud. This documentation describes the different actions available along with code examples.<br /><br /> Throttling: To protect against overloads, the number of identical requests allowed in a given time period is limited.<br /> Brute force: To protect against brute force attacks, the number of failed authentication attempts in a given time period is limited.<br /><br /> Note that the OUTSCALE Cloud is compatible with Amazon Web Services (AWS) APIs, but there are [differences in resource names](https://docs.outscale.com/en/userguide/About-the-APIs.html) between AWS and the OUTSCALE API.<br /> You can also manage your resources using the [Cockpit](https://docs.outscale.com/en/userguide/About-Cockpit.html) web interface.<br /><br /> An OpenAPI description of the OUTSCALE API is also available in this [GitHub repository](https://github.com/outscale/osc-api).<br /> # Authentication Schemes ### Access Key/Secret Key The main way to authenticate your requests to the OUTSCALE API is to use an access key and a secret key.<br /> The mechanism behind this is based on AWS Signature Version 4, whose technical implementation details are described in [Signature of API Requests](https://docs.outscale.com/en/userguide/Signature-of-API-Requests.html).<br /><br /> In practice, the way to specify your access key and secret key depends on the tool or SDK you want to use to interact with the API.<br />  > For example, if you use OSC CLI: > 1. You need to create an **~/.osc/config.json** file to specify your access key, secret key, and the Region of your account. > 2. You then specify the `--profile` option when executing OSC CLI commands. > > For more information, see [Installing and Configuring OSC CLI](https://docs.outscale.com/en/userguide/Installing-and-Configuring-OSC-CLI.html).  See the code samples in each section of this documentation for specific examples in different programming languages.<br /> For more information about access keys, see [About Access Keys](https://docs.outscale.com/en/userguide/About-Access-Keys.html).  > If you try to sign requests with an invalid access key four times in a row, further authentication attempts will be prevented for 1 minute. This lockout time increases 1 minute every four failed attempts, for up to 10 minutes.  ### Login/Password For certain API actions, you can also use basic authentication with the login (email address) and password of your TINA account.<br /> This is useful only in special circumstances, for example if you do not know your access key/secret key and want to retrieve them programmatically.<br /> In most cases, however, you can use the Cockpit web interface to retrieve them.<br />  > For example, if you use OSC CLI: > 1. You need to create an **~/.osc/config.json** file to specify the Region of your account, but you leave the access key value and secret key value empty (`&quot;&quot;`). > 2. You then specify the `--profile`, `--authentication-method`, `--login`, and `--password` options when executing OSC CLI commands.  See the code samples in each section of this documentation for specific examples in different programming languages.  > If you try to sign requests with an invalid password four times in a row, further authentication attempts will be prevented for 1 minute. This lockout time increases 1 minute every four failed attempts, for up to 10 minutes.  ### No Authentication A few API actions do not require any authentication. They are indicated as such in this documentation.<br /> ### Other Security Mechanisms In parallel with the authentication schemes, you can add other security mechanisms to your OUTSCALE account, for example to restrict API requests by IP or other criteria.<br /> For more information, see [Managing Your API Accesses](https://docs.outscale.com/en/userguide/Managing-Your-API-Accesses.html). # Pagination Tutorial You can learn more about the pagination methods for read calls in the dedicated [pagination tutorial](https://docs.outscale.com/en/userguide/Tutorial-Paginating-an-API-Request.html). # Error Codes Reference You can learn more about errors returned by the API in the dedicated [errors page](api-errors.html).
5 *
6 * The version of the OpenAPI document: 1.34.3
7 * Contact: support@outscale.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct CreateVmsRequest {
13    /// One or more block device mappings.
14    #[serde(
15        rename = "BlockDeviceMappings",
16        skip_serializing_if = "Option::is_none"
17    )]
18    pub block_device_mappings: Option<Vec<crate::models::BlockDeviceMappingVmCreation>>,
19    /// By default or if true, the VM is started on creation. If false, the VM is stopped on creation.
20    #[serde(rename = "BootOnCreation", skip_serializing_if = "Option::is_none")]
21    pub boot_on_creation: Option<bool>,
22    /// This parameter is not available. It is present in our API for the sake of historical compatibility with AWS.
23    #[serde(rename = "BsuOptimized", skip_serializing_if = "Option::is_none")]
24    pub bsu_optimized: Option<bool>,
25    /// A unique identifier which enables you to manage the idempotency.
26    #[serde(rename = "ClientToken", skip_serializing_if = "Option::is_none")]
27    pub client_token: Option<String>,
28    /// If true, you cannot delete the VM unless you change this parameter back to false.
29    #[serde(rename = "DeletionProtection", skip_serializing_if = "Option::is_none")]
30    pub deletion_protection: Option<bool>,
31    /// If true, checks whether you have the required permissions to perform the action.
32    #[serde(rename = "DryRun", skip_serializing_if = "Option::is_none")]
33    pub dry_run: Option<bool>,
34    /// The ID of the OMI used to create the VM. You can find the list of OMIs by calling the [ReadImages](#readimages) method.
35    #[serde(rename = "ImageId")]
36    pub image_id: String,
37    /// The name of the keypair.
38    #[serde(rename = "KeypairName", skip_serializing_if = "Option::is_none")]
39    pub keypair_name: Option<String>,
40    /// The maximum number of VMs you want to create. If all the VMs cannot be created, the largest possible number of VMs above MinVmsCount is created.
41    #[serde(rename = "MaxVmsCount", skip_serializing_if = "Option::is_none")]
42    pub max_vms_count: Option<i32>,
43    /// The minimum number of VMs you want to create. If this number of VMs cannot be created, no VMs are created.
44    #[serde(rename = "MinVmsCount", skip_serializing_if = "Option::is_none")]
45    pub min_vms_count: Option<i32>,
46    /// (dedicated tenancy only) If true, nested virtualization is enabled. If false, it is disabled.
47    #[serde(
48        rename = "NestedVirtualization",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub nested_virtualization: Option<bool>,
52    /// One or more NICs. If you specify this parameter, you must not specify the `SubnetId` and `SubregionName` parameters. You also must define one NIC as the primary network interface of the VM with `0` as its device number.
53    #[serde(rename = "Nics", skip_serializing_if = "Option::is_none")]
54    pub nics: Option<Vec<crate::models::NicForVmCreation>>,
55    /// The performance of the VM (`medium` \\| `high` \\|  `highest`). By default, `high`. This parameter is ignored if you specify a performance flag directly in the `VmType` parameter.
56    #[serde(rename = "Performance", skip_serializing_if = "Option::is_none")]
57    pub performance: Option<Performance>,
58    #[serde(rename = "Placement", skip_serializing_if = "Option::is_none")]
59    pub placement: Option<Box<crate::models::Placement>>,
60    /// One or more private IPs of the VM.
61    #[serde(rename = "PrivateIps", skip_serializing_if = "Option::is_none")]
62    pub private_ips: Option<Vec<String>>,
63    /// One or more IDs of security group for the VMs.
64    #[serde(rename = "SecurityGroupIds", skip_serializing_if = "Option::is_none")]
65    pub security_group_ids: Option<Vec<String>>,
66    /// One or more names of security groups for the VMs.
67    #[serde(rename = "SecurityGroups", skip_serializing_if = "Option::is_none")]
68    pub security_groups: Option<Vec<String>>,
69    /// The ID of the Subnet in which you want to create the VM. If you specify this parameter, you must not specify the `Nics` parameter.
70    #[serde(rename = "SubnetId", skip_serializing_if = "Option::is_none")]
71    pub subnet_id: Option<String>,
72    /// Data or script used to add a specific configuration to the VM. It must be Base64-encoded and is limited to 500 kibibytes (KiB). For more information about user data, see [Configuring a VM with User Data and OUTSCALE Tags](https://docs.outscale.com/en/userguide/Configuring-a-VM-with-User-Data-and-OUTSCALE-Tags.html).
73    #[serde(rename = "UserData", skip_serializing_if = "Option::is_none")]
74    pub user_data: Option<String>,
75    /// The VM behavior when you stop it. By default or if set to `stop`, the VM stops. If set to `restart`, the VM stops then automatically restarts. If set to `terminate`, the VM stops and is terminated.
76    #[serde(
77        rename = "VmInitiatedShutdownBehavior",
78        skip_serializing_if = "Option::is_none"
79    )]
80    pub vm_initiated_shutdown_behavior: Option<String>,
81    /// The type of VM. You can specify a TINA type (in the `tinavW.cXrYpZ` or `tinavW.cXrY` format), or an AWS type (for example, `t2.small`, which is the default value).<br /> If you specify an AWS type, it is converted in the background to its corresponding TINA type, but the AWS type is still returned. If the specified or converted TINA type includes a performance flag, this performance flag is applied regardless of the value you may have provided in the `Performance` parameter. For more information, see [VM Types](https://docs.outscale.com/en/userguide/VM-Types.html).
82    #[serde(rename = "VmType", skip_serializing_if = "Option::is_none")]
83    pub vm_type: Option<String>,
84}
85
86impl CreateVmsRequest {
87    pub fn new(image_id: String) -> CreateVmsRequest {
88        CreateVmsRequest {
89            block_device_mappings: None,
90            boot_on_creation: None,
91            bsu_optimized: None,
92            client_token: None,
93            deletion_protection: None,
94            dry_run: None,
95            image_id,
96            keypair_name: None,
97            max_vms_count: None,
98            min_vms_count: None,
99            nested_virtualization: None,
100            nics: None,
101            performance: None,
102            placement: None,
103            private_ips: None,
104            security_group_ids: None,
105            security_groups: None,
106            subnet_id: None,
107            user_data: None,
108            vm_initiated_shutdown_behavior: None,
109            vm_type: None,
110        }
111    }
112}
113
114/// The performance of the VM (`medium` \\| `high` \\|  `highest`). By default, `high`. This parameter is ignored if you specify a performance flag directly in the `VmType` parameter.
115#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
116pub enum Performance {
117    #[serde(rename = "medium")]
118    Medium,
119    #[serde(rename = "high")]
120    High,
121    #[serde(rename = "highest")]
122    Highest,
123}
124
125impl Default for Performance {
126    fn default() -> Performance {
127        Self::Medium
128    }
129}