aws_sdk_devicefarm/operation/create_project/
_create_project_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents a request to the create project operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateProjectInput {
7    /// <p>The project's name.</p>
8    pub name: ::std::option::Option<::std::string::String>,
9    /// <p>Sets the execution timeout value (in minutes) for a project. All test runs in this project use the specified execution timeout value unless overridden when scheduling a run.</p>
10    pub default_job_timeout_minutes: ::std::option::Option<i32>,
11    /// <p>The VPC security groups and subnets that are attached to a project.</p>
12    pub vpc_config: ::std::option::Option<crate::types::VpcConfig>,
13    /// <p>A set of environment variables which are used by default for all runs in the project. These environment variables are applied to the test run during the execution of a test spec file.</p>
14    /// <p>For more information about using test spec files, please see <a href="https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html">Custom test environments </a> in <i>AWS Device Farm.</i></p>
15    pub environment_variables: ::std::option::Option<::std::vec::Vec<crate::types::EnvironmentVariable>>,
16    /// <p>An IAM role to be assumed by the test host for all runs in the project.</p>
17    pub execution_role_arn: ::std::option::Option<::std::string::String>,
18}
19impl CreateProjectInput {
20    /// <p>The project's name.</p>
21    pub fn name(&self) -> ::std::option::Option<&str> {
22        self.name.as_deref()
23    }
24    /// <p>Sets the execution timeout value (in minutes) for a project. All test runs in this project use the specified execution timeout value unless overridden when scheduling a run.</p>
25    pub fn default_job_timeout_minutes(&self) -> ::std::option::Option<i32> {
26        self.default_job_timeout_minutes
27    }
28    /// <p>The VPC security groups and subnets that are attached to a project.</p>
29    pub fn vpc_config(&self) -> ::std::option::Option<&crate::types::VpcConfig> {
30        self.vpc_config.as_ref()
31    }
32    /// <p>A set of environment variables which are used by default for all runs in the project. These environment variables are applied to the test run during the execution of a test spec file.</p>
33    /// <p>For more information about using test spec files, please see <a href="https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html">Custom test environments </a> in <i>AWS Device Farm.</i></p>
34    ///
35    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.environment_variables.is_none()`.
36    pub fn environment_variables(&self) -> &[crate::types::EnvironmentVariable] {
37        self.environment_variables.as_deref().unwrap_or_default()
38    }
39    /// <p>An IAM role to be assumed by the test host for all runs in the project.</p>
40    pub fn execution_role_arn(&self) -> ::std::option::Option<&str> {
41        self.execution_role_arn.as_deref()
42    }
43}
44impl CreateProjectInput {
45    /// Creates a new builder-style object to manufacture [`CreateProjectInput`](crate::operation::create_project::CreateProjectInput).
46    pub fn builder() -> crate::operation::create_project::builders::CreateProjectInputBuilder {
47        crate::operation::create_project::builders::CreateProjectInputBuilder::default()
48    }
49}
50
51/// A builder for [`CreateProjectInput`](crate::operation::create_project::CreateProjectInput).
52#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
53#[non_exhaustive]
54pub struct CreateProjectInputBuilder {
55    pub(crate) name: ::std::option::Option<::std::string::String>,
56    pub(crate) default_job_timeout_minutes: ::std::option::Option<i32>,
57    pub(crate) vpc_config: ::std::option::Option<crate::types::VpcConfig>,
58    pub(crate) environment_variables: ::std::option::Option<::std::vec::Vec<crate::types::EnvironmentVariable>>,
59    pub(crate) execution_role_arn: ::std::option::Option<::std::string::String>,
60}
61impl CreateProjectInputBuilder {
62    /// <p>The project's name.</p>
63    /// This field is required.
64    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
65        self.name = ::std::option::Option::Some(input.into());
66        self
67    }
68    /// <p>The project's name.</p>
69    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
70        self.name = input;
71        self
72    }
73    /// <p>The project's name.</p>
74    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
75        &self.name
76    }
77    /// <p>Sets the execution timeout value (in minutes) for a project. All test runs in this project use the specified execution timeout value unless overridden when scheduling a run.</p>
78    pub fn default_job_timeout_minutes(mut self, input: i32) -> Self {
79        self.default_job_timeout_minutes = ::std::option::Option::Some(input);
80        self
81    }
82    /// <p>Sets the execution timeout value (in minutes) for a project. All test runs in this project use the specified execution timeout value unless overridden when scheduling a run.</p>
83    pub fn set_default_job_timeout_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
84        self.default_job_timeout_minutes = input;
85        self
86    }
87    /// <p>Sets the execution timeout value (in minutes) for a project. All test runs in this project use the specified execution timeout value unless overridden when scheduling a run.</p>
88    pub fn get_default_job_timeout_minutes(&self) -> &::std::option::Option<i32> {
89        &self.default_job_timeout_minutes
90    }
91    /// <p>The VPC security groups and subnets that are attached to a project.</p>
92    pub fn vpc_config(mut self, input: crate::types::VpcConfig) -> Self {
93        self.vpc_config = ::std::option::Option::Some(input);
94        self
95    }
96    /// <p>The VPC security groups and subnets that are attached to a project.</p>
97    pub fn set_vpc_config(mut self, input: ::std::option::Option<crate::types::VpcConfig>) -> Self {
98        self.vpc_config = input;
99        self
100    }
101    /// <p>The VPC security groups and subnets that are attached to a project.</p>
102    pub fn get_vpc_config(&self) -> &::std::option::Option<crate::types::VpcConfig> {
103        &self.vpc_config
104    }
105    /// Appends an item to `environment_variables`.
106    ///
107    /// To override the contents of this collection use [`set_environment_variables`](Self::set_environment_variables).
108    ///
109    /// <p>A set of environment variables which are used by default for all runs in the project. These environment variables are applied to the test run during the execution of a test spec file.</p>
110    /// <p>For more information about using test spec files, please see <a href="https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html">Custom test environments </a> in <i>AWS Device Farm.</i></p>
111    pub fn environment_variables(mut self, input: crate::types::EnvironmentVariable) -> Self {
112        let mut v = self.environment_variables.unwrap_or_default();
113        v.push(input);
114        self.environment_variables = ::std::option::Option::Some(v);
115        self
116    }
117    /// <p>A set of environment variables which are used by default for all runs in the project. These environment variables are applied to the test run during the execution of a test spec file.</p>
118    /// <p>For more information about using test spec files, please see <a href="https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html">Custom test environments </a> in <i>AWS Device Farm.</i></p>
119    pub fn set_environment_variables(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::EnvironmentVariable>>) -> Self {
120        self.environment_variables = input;
121        self
122    }
123    /// <p>A set of environment variables which are used by default for all runs in the project. These environment variables are applied to the test run during the execution of a test spec file.</p>
124    /// <p>For more information about using test spec files, please see <a href="https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html">Custom test environments </a> in <i>AWS Device Farm.</i></p>
125    pub fn get_environment_variables(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::EnvironmentVariable>> {
126        &self.environment_variables
127    }
128    /// <p>An IAM role to be assumed by the test host for all runs in the project.</p>
129    pub fn execution_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.execution_role_arn = ::std::option::Option::Some(input.into());
131        self
132    }
133    /// <p>An IAM role to be assumed by the test host for all runs in the project.</p>
134    pub fn set_execution_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.execution_role_arn = input;
136        self
137    }
138    /// <p>An IAM role to be assumed by the test host for all runs in the project.</p>
139    pub fn get_execution_role_arn(&self) -> &::std::option::Option<::std::string::String> {
140        &self.execution_role_arn
141    }
142    /// Consumes the builder and constructs a [`CreateProjectInput`](crate::operation::create_project::CreateProjectInput).
143    pub fn build(
144        self,
145    ) -> ::std::result::Result<crate::operation::create_project::CreateProjectInput, ::aws_smithy_types::error::operation::BuildError> {
146        ::std::result::Result::Ok(crate::operation::create_project::CreateProjectInput {
147            name: self.name,
148            default_job_timeout_minutes: self.default_job_timeout_minutes,
149            vpc_config: self.vpc_config,
150            environment_variables: self.environment_variables,
151            execution_role_arn: self.execution_role_arn,
152        })
153    }
154}